Two-stage chain detection: resolve testnet/signet/regtest ambiguity via API #23
8144225309
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Context
PR #22 adds client-side chain detection that scans decoded TX output addresses and shows a dynamic banner identifying the target network. This works instantly but has inherent ambiguity — some address prefixes map to multiple chains.
Address Prefix Ambiguity Matrix
bc1...bcrt1...tb1...1.../3...m.../n.../2...Proposed Two-Stage Detection
Stage 1: Instant (client-side, implemented in PR #22)
Detect address prefix → show banner with best guess. For
tb1...it says "TESTNET" but could be signet. Form/n/2it says "TESTNET" but could be regtest. Fast, no network round-trip.Stage 2: Resolved (future, API call)
Query an endpoint like
/api/check-address?addr=tb1q...that hits the server's configured RPC node. The server asks its Bitcoin node "do you know this address?" — if the node is signet and recognizes it, the banner updates to "SIGNET (confirmed)". This resolves the ambiguity. Single API call, definitive answer.Edge Cases
tb1...addresses the banner could say "TESTNET / SIGNET" with a note that resolution requires an API call.Related
network.calready hasdetect_address_network()with full prefix matching (currently UNHOOKED)network_check_address()handles the ambiguity logic server-side (also UNHOOKED)All reactions