Progress on bech32 for future Segwit Versions (BIP-173)



Summary:

Pieter Wuille, a Bitcoin Core developer, proposed a new strategy for a bech32 library that is external to Bitcoin Core. The strategy involves defaulting to the new M under the same bech32 brand and providing an interface for explicitly using both M=1 and M=0x2bc830a3. In case of decoding failure, an error would be thrown, but the other M would be informed of its potential success. Additionally, Pieter suggests providing an interface for a BIP173 implementation to peek at the witness version byte of the data part and checking the byte for errors using a BIP173-specific understanding of the appropriate checksum. There are two possible interfaces suggested by Pieter, which include having the caller explicitly specify whether they want bech32 or bech32m, or having the bech32 decoding function return a tristate (failed, valid as bech32, valid as bech32m). While the former is cleaner and the only choice for error location hinting, the latter is more efficient if decoding twice is a performance concern.


Updated on: 2023-05-20T23:57:48.244586+00:00