Encodings
Bech32m
BIP350 bech32m. Bech32 with a new checksum constant for SegWit v1 and later and Taproot
Encoding / Bech32
Bech32m
Bech32 with the length bug fixed.
- Overhead
- +62% on random bytes
- Checksum
- checked on decode
- Standard
- BIP350
- Used by
- Taproot
family 2 / 20
Sample
- Out
- hi1dpjkcmr0ypmk7unvvsssa376qt
- Back
- "hello world!" · prefix hi
qpzry9x8gf2tvdw0s3jn54khce6mua7l
Options
Access
- Import
import { bech32m } from "@agntn/encodings/bech32" - CLI
encodings encode bech32m 'hello world!' --prefix hi - Tryplayground with the sample above
- Kinbech32
Bech32 had one embarrassing flaw. End a string in p, add or drop q characters right before it, and the checksum still passed. BIP350 fixed it by changing one constant. That's bech32m.
decode("bech32m", "bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqzk5jj0");
// bytes: 79be667e…16f81798, details: { prefix: "bc", witnessVersion: 1 }
Taproot addresses, bc1p…, are bech32m. Version 0 stays on bech32. Hand a v0 address to bech32m and it fails. Annoying? It's exactly the point.