Skip to content
LearnBitcoin

LearnGlossary

BIP 32 (HD Wallets)

Pieter Wuille's 2012 standard for deterministic key derivation: one seed becomes a tree of keys, all reproducible from a single backup.

BIP 32, authored by Pieter Wuille in February 2012, is the foundational standard for hierarchical deterministic (HD) Bitcoin wallets. One seed of 128 to 512 bits (the BIP 39 seed is 512) produces a tree of keys, all reproducible from that single seed. Back up the seed, and you've backed up every key your wallet will ever derive.

The construction is straightforward. The seed is run through HMAC-SHA512 with the fixed key "Bitcoin seed", and the 512-bit result is split into a 256-bit master private key and a 256-bit chaincode, bundled together as an extended private key (xprv). To derive a child key, HMAC-SHA512 is computed over the parent key and the child index, with the chaincode as the HMAC key. The left half of the output, added to the parent key, gives the child's key; the right half is the new chaincode. Repeat at each level to walk the tree.

Two derivation modes matter:

  • Non-hardened (child index < 2^31). The child public key can be derived from the parent public key plus the chaincode. This is what makes xpub useful: hand someone the xpub and they can derive every receive address without ever seeing the private side.
  • Hardened (child index >= 2^31). The derivation requires the parent private key. An attacker who learns one hardened child private key cannot reconstruct the parent or its siblings. This closes a famous attack on non-hardened derivation. BIP 44 conventionally uses hardened derivation for account-level paths so a leaked account key doesn't compromise other accounts.

Why this matters in practice:

  • One backup, infinite addresses. Generate a fresh address for every transaction without making more backups.
  • Watch-only wallets. Import an xpub into a phone app to monitor a hardware wallet's balance without exposing any private key.
  • Multi-account separation. BIP 44 uses hardened account-level paths so an exposed account doesn't bleed into siblings.
  • Cross-wallet portability. Restore the seed in another wallet that uses the same derivation path and script type and you get the same addresses; BIP 32 leaves the tree layout advisory, which is why BIP 44 and output descriptors pin it down. The seed is the asset; the software is replaceable.

BIP 32 alone says only that the seed is random bytes; it doesn't specify how to back it up in a form humans can write down. That's BIP 39: mnemonic seed phrases. Together they're the foundation of modern Bitcoin self-custody.

Spec: BIP-32.

Derivation paths

One seed, a whole tree of keys. Pick a path and see which address the demo wallet finds there.

Path

m/84'/0'/0'/0/0

Address

bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu

The next five on this chain

  1. 1 bc1qnjg0jd8228aq7egyzacy8cys3knf9xvrerkf9g
  2. 2 bc1qp59yckz4ae5c4efgw2s5wfyvrz0ala7rgvuz8z
  3. 3 bc1qgl5vlg0zdl7yvprgxj9fevsc6q6x5dmcyk3cn3
  4. 4 bc1qm97vqzgj934vnaq9s53ynkyf9dgr05rargr04n
  5. 5 bc1qnpzzqjzet8gd5gl8l6gzhuc4s9xv0djt0rlu7a

Account xpub m/84'/0'/0'

xpub6CatWdiZiodmUeTDp8LT5or8nmbKNcuyvz7WyksVFkKB4RHwCD3XyuvPEbvqAQY3rAPshWcMLoP2fMFMKHPJ4ZeZXYVUhLv1VMrjPC7PW6V

Anyone with this key can list every address in the account, receive and change, and watch what it holds. It cannot spend.

An apostrophe marks a hardened level. Deriving one takes the private key, which is why an xpub reaches the addresses of its own account and nothing above or beside it.

Demo wallet: the test phrase of BIP 84 and BIP 86, whose keys are public. Never send coins to these addresses.

Key takeaways

  • Defines extended keys (xpub / xprv) and child-key derivation via HMAC-SHA512
  • Hardened derivation (index >= 2^31) closes the parent-key recovery attack
  • Widely adopted: Bitcoin Core has derived keys this way since 0.13 (2016), and BIP 39 and BIP 44 build on it

On the mailing list

BIP 32 came up in 117 threads on bitcoin-dev between December 2012 and November 2026. Read them in the archive.

The topic timeline: HD wallets, seeds and derivation (126 threads).

Corrected

  • Was: The entry said BIP 32 starts from one 512-bit seed that is split directly into the master private key and chaincode, and that restoring a BIP 32 seed in any standard wallet gives the same addresses.

    Now: BIP 32 accepts a seed of 128 to 512 bits and runs it through HMAC-SHA512 keyed with the string 'Bitcoin seed'; it is that 512-bit output that is split into the master key and chaincode. The same addresses follow only when both wallets use the same derivation path and script type, because BIP 32 leaves the tree layout advisory. Details

Sources (5)

External references (2)

Related terms (10)

Published . Revised . One correction logged for this page.

Edit this page on GitHub