Bitcoin HD Wallets Explained: BIP32 Keys and Derivation
A hierarchical deterministic (HD) Bitcoin wallet can derive many keys from one root rather than storing unrelated private keys. BIP32 specifies the extended-key derivation system; it does not itself prescribe mnemonic words or one universal account layout.
What is an extended key?
A BIP32 extended key contains key material plus a 32-byte chain code, depth, parent fingerprint, child number, and version information. An extended private key can derive private descendants. An extended public key can derive non-hardened public descendants without revealing the corresponding private keys.
Hardened versus non-hardened derivation
Normal derivation uses child indices below 2^31. Hardened derivation uses indices from 2^31 upward and requires the parent private key. Hardened boundaries are useful between account-level secrets and public-facing address derivation. An xpub is sensitive wallet metadata: it can reveal many addresses and financial activity, even though it cannot directly sign transactions.
Why can an xpub be dangerous in some configurations?
For non-hardened BIP32 children, exposure of a parent xpub together with one corresponding non-hardened child private key can reveal the parent private key. Do not treat public derivation as equivalent to unlimited key isolation. Keep signing keys outside untrusted indexers and agents.
What does BIP32 not define?
BIP32 does not define mnemonic backups (BIP39), the purpose/account/address layout (BIP44 family), or which script type a wallet uses. Those are separate conventions. A wallet's derivation path, script descriptor, and network all matter for restoring the correct addresses.
Developer checklist
Verify the intended network and extended-key version; distinguish private from public derivation; enforce hardened boundaries; test address generation with published vectors; and never log seed material, xprvs, or child private keys. Use a watch-only xpub or descriptor only where its privacy tradeoff is acceptable.
Primary references
- BIP32 — Hierarchical Deterministic Wallets: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
- BIP44 — Multi-Account Hierarchy: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
