Can you break down what data is encoded into a bech32 address?
How do bech32 addresses on testnet, regtest, signet compare?
Bitcoin Stack Exchange is a question and answer site for Bitcoin users, developers, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
Bech32 addresses are defined in BIP 173.
This slide is taken from Pieter Wuille's presentation on bech32 at SF Bitcoin Devs in March 2017.
A list of address prefixes on the Bitcoin wiki is here.
bcis representing Bitcoin (mainnet)
tb(although an earlier iteration of Signet used
bcrt. This is defined in chainparams.cpp here. Discussion on why regtest addresses don't have the same prefix as testnet and signet is here.
1is just a separator and doesn't represent any particular data
qis the witness version. This represents zero as the first SegWit witness version introduced was SegWit v0. Taproot introduces SegWit v1 with
prepresenting one (v1).
w508d6qejxtdg4y5r3zarvary0c5xw7kis the witness program.
v8f3t4is the checksum
As the slide says, mainnet P2WPKH addresses are 42 characters and mainnet P2WSH addresses are 62 characters under SegWit v0. Future witness versions can be up to 74 characters although SegWit v1 addresses (Taproot) will be the same length as v0 P2WSH addresses (62 characters). Witness programs as defined under SegWit v1 are 32 bytes.
There is a bech32 demo decoder site here.
Please note that SegWit v1 (Taproot) addresses will use bech32m encoding rather than bech32.