Skip to content
wigy edited this page Jul 1, 2019 · 2 revisions

Relation to BIP32 version bytes

Most wallets support BIP32 to allow the user to backup their secrets once and generate multiple keys and receiving addresses from that secret. BIP32 defines a serialization format of the extended private and public keys and uses a 4-byte length "version bytes" (xpub and xprv on the BTC mainnet). There are competing extensions to that serialization format. SLIP-0132 registers extra version bytes that were introduced by the Trezor and the Electrum wallets (ypub, zpub...). Another extension, SLIP-0032 serializes the full derivation path and therefore lets the wallet that imports the extended key detect the used script templates by the purpose part (BIP-0043) of the key derivation. This is made possible, because BIP-0084 uses m/84' as a subtree for P2WPKH scripts and BIP-0049 uses m/49' as a subtree for P2WPKH-nested-in-P2SH scripts.

This BIP-0178 seems to completely ignore that keys are nowadays in a hierarchy and the derivation path determines the script templates. If we assume that each key is independently created, backed up and later restored onto a fresh device, I completely see the purpose of this suggestion. But then I would even extend it with a way to backup a custom script template at the end of the exported WIF together with the private key.

-- Wigy, 2019-05-30