Bech32m (The Taproot Standard)
Bech32m (The Taproot Standard)
When Taproot (P2TR) was developed, engineers discovered a subtle flaw in the original Bech32 checksum algorithm. This led to the creation of Bech32m (BIP350), the current standard for modern Bitcoin addresses.
1. The "q" vs. "p" Problem
The original Bech32 algorithm had a weakness: if you appended a q character (0) to the end of a string, the checksum wouldn't always change.
-
In SegWit (v0), this wasn't a major issue because the data length was fixed.
-
In future versions (like v1 Taproot), it could lead to situations where an invalid address might be accepted as valid.
2. The Solution: Bech32m
Bech32m is identical to Bech32 in every way, except for a tiny change in the constant used in the checksum math.
-
Bech32 Constant:
1 -
Bech32m Constant:
0x2be89091
This simple change completely eliminates the "Length Extension" vulnerability and ensures that Taproot addresses are as secure as possible.
3. The "p" Prefix
Taproot addresses are identified by the character p immediately after the bc1.
Example: bc1p5d7rjAbCdEfGhIjKlMnOpQrStUvWxYz...
-
The
ptells the wallet this is a Witness Version 1 output. -
The wallet then uses the Bech32m math to verify the checksum instead of the old Bech32 math.
4. Compatibility
Modern Bitcoin nodes and wallets support both:
-
Bech32 for version 0 (Starting with
bc1q). -
Bech32m for version 1 and higher (Starting with
bc1p). This allows the network to gradually transition to newer technology without breaking existing wallets.
5. Summary of Prefixes
| Witness Version | Prefix | Encoding Standard | Script Type |
|---|---|---|---|
| None (Legacy) | 1 |
Base58Check | P2PKH |
| None (Legacy) | 3 |
Base58Check | P2SH |
| 0 | bc1q |
Bech32 | P2WPKH / P2WSH |
| 1 | bc1p |
Bech32m | P2TR (Taproot) |
In the final section, we will build a Python Address Auditor.
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: