BIP 49 (Derivation Paths for Wrapped Segwit)

2 min read

Bitcoin Improvement Proposal (BIP) 49 defines the standard derivation path for wallets which generate wrapped SegWit (P2SH-P2WPKH) addresses. BIP 49 also defines the prefixes to be used with associated extended keys.

According to BIP 49, wallets which generate wrapped SegWit addresses should use a derivation path beginning with “m/49’/”. This means the first address generated by a mainnet Bitcoin wallet will have a derivation path of “m/49’/0’/0’/0/0”.

In addition, all such wallets which use mainnet Bitcoin should use “ypub” or “yprv” prefixes for extended public and private keys respectively. Extended keys following the BIP 49 standard are thus called ypubs and yprvs respectively. If the wallet is a testnet wallet, “upub” and “uprv” prefixes are used instead.

This standard was implemented to ensure that Hierarchical Deterministic (HD) wallets, as defined in BIP 32, can import extended keys and find the bitcoin stored on that wallet.

The HD wallet scheme defines a method for deriving a practically unlimited number of public and private keys from a single extended key. However, if an extended key is imported to a wallet with no guidance, it may be hard for the wallet to find the keys with bitcoin, a requirement for displaying the correct balance to the user.

The standards set by BIP 49, along with BIP 44 and BIP 84, fix this problem. When a wallet imports an extended key, the prefix indicates exactly which derivation path to use to find bitcoin and derive new addresses.