LearnBitcoin

Glossary

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.

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

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