Skip to content
BIP ATLAS

BIP 0032

How can one seed grow an entire wallet?

One seed can reproduce a whole tree of keys. Sharing a branch can let another system derive receiving keys while the spending keys stay private.

A wallet needs fresh keys as it receives payments. Backing up every key separately would make that wallet harder to preserve. BIP 32 lets a single seed reproduce a whole tree of keys, so the backup does not have to grow with the tree.123

The tree can also be shared in parts. A server can derive receiving keys from an extended public key without holding the private keys that spend the money. Hardened branches set a boundary on what that public key can reach.456

Source revision
bitcoin/bips @ 3a10b5b
Source checked
1 October 2026
Review state
Awaiting review
Source details

This chapter is an independent explanation, not the proposal itself. Preamble fields are shown as the pinned files record them, without author e-mail addresses. Status is the proposal’s own field. It is not an endorsement or a sign of consensus.

BIP 32: Hierarchical Deterministic Wallets

BIP
32
Layer
Applications
Title
Hierarchical Deterministic Wallets
Authors
Pieter Wuille
Status
Deployed
Type
Informational
Assigned
2012-02-11
License
BSD-2-Clause

Pinned source · Reader view on bips.dev
SHA-256 e5e00a8289db2f681052cf24a745320afc225e66b25d1e489a7c884d2fc7f11f
Git blob 558bbaab60d63e3e50648816d5e3449cfb887f85

Fig. A02.1 The first split

The first splitThe 16-byte seed 000102030405060708090a0b0c0d0e0f goes into HMAC-SHA512 keyed with the text "Bitcoin seed". Out come 64 bytes, e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d508. They are cut in half: the first 32 bytes, e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35, are the master private key; the last 32, 873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d508, are the master chain code. Together they serialize to the master xprv listed on BIP 32 line 223.SEED · 16 BYTES · TEST VECTOR 1000102030405060708090a0b0c0d0e0fHMAC-SHA512KEY"Bitcoin seed"I · 64 BYTESe8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d508I_L → MASTER PRIVATE KEYI_R → MASTER CHAIN CODE(k, c) = m · xprv9s21ZrQH…MATCHES BIP 32 LINE 223
Exact master extended private keyxprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi
HMAC-SHA512 turns a seed into 64 bytes. The left half becomes the master private key; the right half becomes the master chain code.78

Keys with an extra 32 bytes

Every node in the tree is an extended key: an ordinary key plus a chain code, 32 more bytes of entropy. BIP 32 adds the chain code so that a node’s children do not depend on the key alone. The chain code is the same in the private and the public version of a node.9

A public key alone is not enough to derive child public keys. The derivation also needs the chain code. Together, the public key and chain code form an extended public key, or xpub.39

An extended private key is the pair (k, c): private key and chain code. Its public counterpart is (K, c), where K is the public key for k. Turning the first into the second is called neutering it, because the result can no longer sign transactions.1011

Fig. A02.2 Key plus chain code

Key plus chain codeAn extended private key is two parts: the private key k (e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35) and the chain code c (873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d508), shown for the master node of BIP 32 test vector 1. Neutering it, N(), replaces k with its public key K (0339a36013301597daef41fbe593a02cc513d0b55527ec2df1050e2e8ff49c85c2) and keeps the same chain code. The result, (K, c), is the extended public key: it cannot sign.873dff81…chain code c · 32 Be8f32e72…private key k · 32 BEXTENDED PRIVATE KEY (k, c)CAN SIGNN( )NEUTER873dff81…chain code c · 32 B0339a360…public key K · 33 BEXTENDED PUBLIC KEY (K, c)CANNOT SIGN · SAME c
Key plus chain codeAn extended private key is two parts: the private key k (e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35) and the chain code c (873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d508), shown for the master node of BIP 32 test vector 1. Neutering it, N(), replaces k with its public key K (0339a36013301597daef41fbe593a02cc513d0b55527ec2df1050e2e8ff49c85c2) and keeps the same chain code. The result, (K, c), is the extended public key: it cannot sign.873dff81…chain code c · 32 Be8f32e72…private key k · 32 BEXTENDED PRIVATE KEY (k, c)CAN SIGNN( ) · NEUTER873dff81…chain code c · 32 B0339a360…public key K · 33 BEXTENDED PUBLIC KEY (K, c)CANNOT SIGN · SAME c
Exact values (master node of test vector 1)
Private key k
e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35
Public key K
0339a36013301597daef41fbe593a02cc513d0b55527ec2df1050e2e8ff49c85c2
Chain code c
873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d508
An extended key is a key and a chain code. Neutering swaps the private key for its public key and keeps the very same chain code.91011

One step down the tree

To derive child number i, use the parent’s chain code as the key for HMAC-SHA512. Split the 64-byte output into two halves. Add the left half to the parent’s private key, modulo the curve order, to obtain the child’s private key. The right half becomes the child’s chain code.1213

What goes into the HMAC depends on the index. Indices 0 to 2³¹ − 1 are normal, and the input is the parent’s public key followed by the index. Indices from 2³¹ upward are hardened, and the input is the parent’s private key, padded with a zero byte, followed by the index. Paths mark hardened indices with an H: m/0H/1 is normal child 1 of hardened child 0 of the master.13141516

Fig. A02.3 What goes into the HMAC

What goes into the HMACNormal child m/0H/1 of m/0H: the 37 bytes of HMAC data are public key K of m/0H (33 bytes, 035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56), then i (4 bytes, 00000001). Hardened child m/0H of m: the 37 bytes of HMAC data are 00 (1 bytes, 00), then private key k of m (32 bytes, e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35), then i (4 bytes, 80000000). The first byte of the hardened index, 80, is 10000000 in binary: its top bit is set, so the index is at least 2^31. Both are keyed by the parent's chain code.NORMAL · m/0H → m/0H/108162432public key K of m/0H 035a7846… · 33 Bii = 00000001HARDENED · m → m/0Hprivate key k of m e8f32e72… · 32 Bii = 8000000000: ONE ZERO BYTE37 BFIRST BYTE 0x80 = 10000000TOP BIT SET:i ≥ 2³¹, HARDENEDBOTH KEYED BY THE PARENT’SCHAIN CODE c
Exact HMAC data, both steps
m/0H/1 (normal)
035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc5600000001
m/0H (hardened)
00e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b3580000000
The same 37 bytes of HMAC data, filled two ways. A normal child hashes the parent’s public key; a hardened child hashes its private key, padded with a zero byte.131415

Switch from holding the extended private key to holding only the extended public key. Then toggle the normal and hardened branch. Watch which keys that holder can derive and which branches it cannot reach.3568

Fig. A02.4 Who can derive what

Static view: the tree held as m, with branch m/0H/1 opened. With JavaScript you can switch to holding only M, make branch 1 hardened, and open any branch.

Who can derive whatKey tree from BIP 32 test vector 1, seen by someone holding m: m, the master extended private key; m/0H (hardened child of m); m/0H/0 (normal child of m/0H); m/0H/1 (normal child of m/0H); m/0H/1/2H (hardened child of m/0H/1); m/1 (normal child of m); m/1/0 (normal child of m/1). One branch is opened into a zoom box; the status line below names it and what goes into its HMAC.0H012H10mm/0Hm/0H/0m/0H/1m/0H/1/2Hm/1m/1/0m → m/0H · HARDENED · i = 0HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k e8f32e72…80000000HMAC-SHA512I_L 04bfb2dd…k′ = I_L + k (mod n)c′ = I_Rm/0Hm/0H → m/0H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cc 47fdacbd…HMAC DATA · 37 BYTESK 035a7846…00000000HMAC-SHA512I_L 59f340e0…k′ = I_L + k (mod n)c′ = I_Rm/0H/0m/0H → m/0H/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cc 47fdacbd…HMAC DATA · 37 BYTESK 035a7846…00000001HMAC-SHA512I_L 4eb9d781…k′ = I_L + k (mod n)c′ = I_Rm/0H/1m/0H/1 → m/0H/1/2H · HARDENED · i = 2HHMAC KEY: CHAIN CODE cc 2a785763…HMAC DATA · 37 BYTES00k 3c6cb8d0…80000002HMAC-SHA512I_L 8f6154a0…k′ = I_L + k (mod n)c′ = I_Rm/0H/1/2Hm → m/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTESK 0339a360…00000001HMAC-SHA512I_L 6505fd0f…k′ = I_L + k (mod n)c′ = I_Rm/1m/1 → m/1/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cc 8dd96414…HMAC DATA · 37 BYTESK 037c2098…00000000HMAC-SHA512I_L 060110cb…k′ = I_L + k (mod n)c′ = I_Rm/1/0
Who can derive whatKey tree from BIP 32 test vector 1, seen by someone holding m: m, the master extended private key; m/0H (hardened child of m); m/0H/0 (normal child of m/0H); m/0H/1 (normal child of m/0H); m/0H/1/2H (hardened child of m/0H/1); m/1 (normal child of m); m/1/0 (normal child of m/1). One branch is opened into a zoom box; the status line below names it and what goes into its HMAC.0H012H10mm/0Hm/0H/0m/0H/1m/0H/1/2Hm/1m/1/0m → m/0H · HARDENED · i = 0HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k e8f32e72…80000000HMAC-SHA512I_L 04bfb2dd…k′ = I_L + k (mod n)c′ = I_Rm/0Hm/0H → m/0H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cc 47fdacbd…HMAC DATA · 37 BYTESK 035a7846…00000000HMAC-SHA512I_L 59f340e0…k′ = I_L + k (mod n)c′ = I_Rm/0H/0m/0H → m/0H/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cc 47fdacbd…HMAC DATA · 37 BYTESK 035a7846…00000001HMAC-SHA512I_L 4eb9d781…k′ = I_L + k (mod n)c′ = I_Rm/0H/1m/0H/1 → m/0H/1/2H · HARDENED · i = 2HHMAC KEY: CHAIN CODE cc 2a785763…HMAC DATA · 37 BYTES00k 3c6cb8d0…80000002HMAC-SHA512I_L 8f6154a0…k′ = I_L + k (mod n)c′ = I_Rm/0H/1/2Hm → m/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTESK 0339a360…00000001HMAC-SHA512I_L 6505fd0f…k′ = I_L + k (mod n)c′ = I_Rm/1m/1 → m/1/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cc 8dd96414…HMAC DATA · 37 BYTESK 037c2098…00000000HMAC-SHA512I_L 060110cb…k′ = I_L + k (mod n)c′ = I_Rm/1/0
Who can derive whatKey tree from BIP 32 test vector 1, seen by someone holding m: m, the master extended private key; m/0H (hardened child of m); m/0H/0 (normal child of m/0H); m/0H/1 (normal child of m/0H); m/0H/1/2H (hardened child of m/0H/1); m/1H (hardened child of m); m/1H/0 (normal child of m/1H). One branch is opened into a zoom box; the status line below names it and what goes into its HMAC.0H012H1H0mm/0Hm/0H/0m/0H/1m/0H/1/2Hm/1Hm/1H/0m → m/0H · HARDENED · i = 0HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k e8f32e72…80000000HMAC-SHA512I_L 04bfb2dd…k′ = I_L + k (mod n)c′ = I_Rm/0Hm/0H → m/0H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cc 47fdacbd…HMAC DATA · 37 BYTESK 035a7846…00000000HMAC-SHA512I_L 59f340e0…k′ = I_L + k (mod n)c′ = I_Rm/0H/0m/0H → m/0H/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cc 47fdacbd…HMAC DATA · 37 BYTESK 035a7846…00000001HMAC-SHA512I_L 4eb9d781…k′ = I_L + k (mod n)c′ = I_Rm/0H/1m/0H/1 → m/0H/1/2H · HARDENED · i = 2HHMAC KEY: CHAIN CODE cc 2a785763…HMAC DATA · 37 BYTES00k 3c6cb8d0…80000002HMAC-SHA512I_L 8f6154a0…k′ = I_L + k (mod n)c′ = I_Rm/0H/1/2Hm → m/1H · HARDENED · i = 1HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k e8f32e72…80000001HMAC-SHA512I_L 0588de7e…k′ = I_L + k (mod n)c′ = I_Rm/1Hm/1H → m/1H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cc cc99f161…HMAC DATA · 37 BYTESK 0338b919…00000000HMAC-SHA512I_L 9f9f0036…k′ = I_L + k (mod n)c′ = I_Rm/1H/0
Who can derive whatKey tree from BIP 32 test vector 1, seen by someone holding m: m, the master extended private key; m/0H (hardened child of m); m/0H/0 (normal child of m/0H); m/0H/1 (normal child of m/0H); m/0H/1/2H (hardened child of m/0H/1); m/1H (hardened child of m); m/1H/0 (normal child of m/1H). One branch is opened into a zoom box; the status line below names it and what goes into its HMAC.0H012H1H0mm/0Hm/0H/0m/0H/1m/0H/1/2Hm/1Hm/1H/0m → m/0H · HARDENED · i = 0HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k e8f32e72…80000000HMAC-SHA512I_L 04bfb2dd…k′ = I_L + k (mod n)c′ = I_Rm/0Hm/0H → m/0H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cc 47fdacbd…HMAC DATA · 37 BYTESK 035a7846…00000000HMAC-SHA512I_L 59f340e0…k′ = I_L + k (mod n)c′ = I_Rm/0H/0m/0H → m/0H/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cc 47fdacbd…HMAC DATA · 37 BYTESK 035a7846…00000001HMAC-SHA512I_L 4eb9d781…k′ = I_L + k (mod n)c′ = I_Rm/0H/1m/0H/1 → m/0H/1/2H · HARDENED · i = 2HHMAC KEY: CHAIN CODE cc 2a785763…HMAC DATA · 37 BYTES00k 3c6cb8d0…80000002HMAC-SHA512I_L 8f6154a0…k′ = I_L + k (mod n)c′ = I_Rm/0H/1/2Hm → m/1H · HARDENED · i = 1HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k e8f32e72…80000001HMAC-SHA512I_L 0588de7e…k′ = I_L + k (mod n)c′ = I_Rm/1Hm/1H → m/1H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cc cc99f161…HMAC DATA · 37 BYTESK 0338b919…00000000HMAC-SHA512I_L 9f9f0036…k′ = I_L + k (mod n)c′ = I_Rm/1H/0
Who can derive whatKey tree from BIP 32 test vector 1, seen by someone holding only M: M, the master extended public key; m/0H (hardened child of M), not derivable from M; m/0H/0 (normal child of m/0H), not derivable from M; m/0H/1 (normal child of m/0H), not derivable from M; m/0H/1/2H (hardened child of m/0H/1), not derivable from M; M/1 (normal child of M); M/1/0 (normal child of M/1). One branch is opened into a zoom box; the status line below names it and what goes into its HMAC.0H012H10CKDPUB STOPSMm/0Hm/0H/0m/0H/1m/0H/1/2HM/1M/1/0M → m/0H · HARDENED · i = 0HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k: not held80000000HMAC-SHA512CANNOT DERIVENEEDS A PRIVATE KEY:M HOLDS NONEm/0H → m/0H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTESK: not known to M00000000HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREm/0H → m/0H/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTESK: not known to M00000001HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREm/0H/1 → m/0H/1/2H · HARDENED · i = 2HHMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTES00k: not held80000002HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREM → M/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTESK 0339a360…00000001HMAC-SHA512I_L 6505fd0f…K′ = point(I_L) + Kc′ = I_RM/1M/1 → M/1/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cc 8dd96414…HMAC DATA · 37 BYTESK 037c2098…00000000HMAC-SHA512I_L 060110cb…K′ = point(I_L) + Kc′ = I_RM/1/0
Who can derive whatKey tree from BIP 32 test vector 1, seen by someone holding only M: M, the master extended public key; m/0H (hardened child of M), not derivable from M; m/0H/0 (normal child of m/0H), not derivable from M; m/0H/1 (normal child of m/0H), not derivable from M; m/0H/1/2H (hardened child of m/0H/1), not derivable from M; M/1 (normal child of M); M/1/0 (normal child of M/1). One branch is opened into a zoom box; the status line below names it and what goes into its HMAC.0H012H10CKDPUB STOPSMm/0Hm/0H/0m/0H/1m/0H/1/2HM/1M/1/0M → m/0H · HARDENED · i = 0HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k: not held80000000HMAC-SHA512CANNOT DERIVENEEDS A PRIVATE KEY:M HOLDS NONEm/0H → m/0H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTESK: not known to M00000000HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREm/0H → m/0H/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTESK: not known to M00000001HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREm/0H/1 → m/0H/1/2H · HARDENED · i = 2HHMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTES00k: not held80000002HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREM → M/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTESK 0339a360…00000001HMAC-SHA512I_L 6505fd0f…K′ = point(I_L) + Kc′ = I_RM/1M/1 → M/1/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cc 8dd96414…HMAC DATA · 37 BYTESK 037c2098…00000000HMAC-SHA512I_L 060110cb…K′ = point(I_L) + Kc′ = I_RM/1/0
Who can derive whatKey tree from BIP 32 test vector 1, seen by someone holding only M: M, the master extended public key; m/0H (hardened child of M), not derivable from M; m/0H/0 (normal child of m/0H), not derivable from M; m/0H/1 (normal child of m/0H), not derivable from M; m/0H/1/2H (hardened child of m/0H/1), not derivable from M; m/1H (hardened child of M), not derivable from M; m/1H/0 (normal child of m/1H), not derivable from M. One branch is opened into a zoom box; the status line below names it and what goes into its HMAC.0H012H1H0CKDPUB STOPSCKDPUB STOPSMm/0Hm/0H/0m/0H/1m/0H/1/2Hm/1Hm/1H/0M → m/0H · HARDENED · i = 0HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k: not held80000000HMAC-SHA512CANNOT DERIVENEEDS A PRIVATE KEY:M HOLDS NONEm/0H → m/0H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTESK: not known to M00000000HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREm/0H → m/0H/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTESK: not known to M00000001HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREm/0H/1 → m/0H/1/2H · HARDENED · i = 2HHMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTES00k: not held80000002HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREM → m/1H · HARDENED · i = 1HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k: not held80000001HMAC-SHA512CANNOT DERIVENEEDS A PRIVATE KEY:M HOLDS NONEm/1H → m/1H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTESK: not known to M00000000HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HERE
Who can derive whatKey tree from BIP 32 test vector 1, seen by someone holding only M: M, the master extended public key; m/0H (hardened child of M), not derivable from M; m/0H/0 (normal child of m/0H), not derivable from M; m/0H/1 (normal child of m/0H), not derivable from M; m/0H/1/2H (hardened child of m/0H/1), not derivable from M; m/1H (hardened child of M), not derivable from M; m/1H/0 (normal child of m/1H), not derivable from M. One branch is opened into a zoom box; the status line below names it and what goes into its HMAC.0H012H1H0CKDPUB STOPSCKDPUB STOPSMm/0Hm/0H/0m/0H/1m/0H/1/2Hm/1Hm/1H/0M → m/0H · HARDENED · i = 0HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k: not held80000000HMAC-SHA512CANNOT DERIVENEEDS A PRIVATE KEY:M HOLDS NONEm/0H → m/0H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTESK: not known to M00000000HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREm/0H → m/0H/1 · NORMAL · i = 1HMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTESK: not known to M00000001HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREm/0H/1 → m/0H/1/2H · HARDENED · i = 2HHMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTES00k: not held80000002HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HEREM → m/1H · HARDENED · i = 1HHMAC KEY: CHAIN CODE cc 873dff81…HMAC DATA · 37 BYTES00k: not held80000001HMAC-SHA512CANNOT DERIVENEEDS A PRIVATE KEY:M HOLDS NONEm/1H → m/1H/0 · NORMAL · i = 0HMAC KEY: CHAIN CODE cnot known to MHMAC DATA · 37 BYTESK: not known to M00000000HMAC-SHA512CANNOT DERIVEPARENT OUT OF REACH:M HOLDS NO KEY OR c HERE

Holding m, the extended private key. Branch m/0H/1 is normal. HMAC-SHA512 keyed by m/0H’s chain code hashes its public key and 00000001; the left half is added to its private key.

Exact values for this branch
Chain code of m/0H
47fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141
Public key of m/0H
035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56
HMAC data
035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc5600000001
HMAC-SHA512 output I = I_L ‖ I_R
4eb9d78157bae7a24115001621c4d91e3a3110e11e143c5259eaa4e55c5ec4bf2a7857631386ba23dacac34180dd1983734e444fdbf774041578e9b6adb37c19
Private key of m/0H/1
3c6cb8d0f6a264c91ea8b5030fadaa8e538b020f0a387421a12de9319dc93368
Public key of m/0H/1
03501e454bf00751f24b1b489aa925215d66af2234e3891c3b21a52bedb3cd711c
xprv of m/0H/1 (BIP 32 line 229)
xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu53Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs

Seed: BIP 32 test vector 1 (line 220). Every key here is public test material; never use it for funds.

A hardened edge is a wall for public keys. Holding M, you can follow normal edges down to M/1/0, but you cannot cross into m/0H: deriving it needs a private key you do not have.3568
When derivation skips a child

In rare cases a step produces an invalid key, and the wallet moves on to the next index. BIP 32 puts the odds below one in 2¹²⁷.1517

What an extended public key can do

Normal derivation uses the parent’s public key in the HMAC input. An extended public key therefore supplies everything needed to derive a normal child’s public key and chain code. Convert the HMAC output’s left half to a public point and add it to the parent’s public key. The right half supplies the child’s chain code. BIP 32 states that public and private derivation produce corresponding keys for the same child.518

Fig. A02.5 Two routes, one child

Two routes, one childBoth routes start from the same HMAC output for child m/0H/1: I_L = 4eb9d78157bae7a24115001621c4d91e3a3110e11e143c5259eaa4e55c5ec4bf. With the private key of m/0H (edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea): k′ = I_L + k mod n = 3c6cb8d0f6a264c91ea8b5030fadaa8e538b020f0a387421a12de9319dc93368, and its point is the public key. With only the extended public key of m/0H (K = 035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56): K′ = point(I_L) + K. Both give the same public key, 03501e454bf00751f24b1b489aa925215d66af2234e3891c3b21a52bedb3cd711c.ONE HMAC, ONE I_L · m/0H → m/0H/1I_L 4eb9d781… from HMAC-SHA512(c, K ‖ i)CKDpriv · HOLDS kCKDpub · HOLDS ONLY K, c+ k edb2e14f…= k′ 3c6cb8d0…point( )point(I_L)+ K 035a7846…K′ 03501e45…THE SAME PUBLIC KEY BOTH WAYSTHE BUILD CHECKS EVERY NORMAL CHILD IN THE TREE
Exact values
I_L
4eb9d78157bae7a24115001621c4d91e3a3110e11e143c5259eaa4e55c5ec4bf
k of m/0H
edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea
K of m/0H
035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56
k′ of m/0H/1
3c6cb8d0f6a264c91ea8b5030fadaa8e538b020f0a387421a12de9319dc93368
K′ of m/0H/1, by both routes
03501e454bf00751f24b1b489aa925215d66af2234e3891c3b21a52bedb3cd711c
Two ways to the same child public key. Only the left one needs the private key; the build checks that both agree for every normal child in the tree.518

BIP 32 gives a webshop as an example. Its server can use an extended public key to generate a fresh address for each order without holding the spending keys. Disclosure of that xpub reveals incoming payments but does not enable spending existing outputs. There is a separate operational risk: an attacker who controls the server can replace the receiving addresses it displays. That can divert future payments without revealing a private key.41920

BIP 32 lists other kinds of partial sharing too. An auditor can be given every account’s extended public key and see all transactions without a single secret key. A business partner can be given one account’s external chain and use it as a kind of super address, without asking for a new address for each payment.2122

Fig. A02.6 Sharing without spending

Sharing without spendingThe wallet owner keeps the seed and the master private key. Across the line, three parties hold only extended public keys: a webshop server holds the xpub of one account's external chain and makes a fresh address for every order; an auditor holds every account's xpub and sees every transaction; a business partner holds the xpub of one account's external chain and uses it as a kind of super address. None of them holds a private key. If the webshop server is broken into, the attacker can at most see the incoming payments.WALLET OWNERseed, mCAN SPENDSHAREDxpub of one account’sexternal chainWEBSHOP SERVERa fresh addressfor every orderevery account’s xpubAUDITORsees everytransactionxpub of one account’sexternal chainBUSINESS PARTNERpays to a kind ofsuper addressNONE OF THEM HOLDS A KEY THAT CAN SPENDSERVER BROKEN INTO: AT MOST SEES INCOMING PAYMENTS
Sharing without spendingThe wallet owner keeps the seed and the master private key. Across the line, three parties hold only extended public keys: a webshop server holds the xpub of one account's external chain and makes a fresh address for every order; an auditor holds every account's xpub and sees every transaction; a business partner holds the xpub of one account's external chain and uses it as a kind of super address. None of them holds a private key. If the webshop server is broken into, the attacker can at most see the incoming payments.WALLET OWNERseed, mCAN SPENDSHARED: XPUBS ONLYxpub of one account’sexternal chainWEBSHOP SERVERa fresh addressfor every orderevery account’s xpubAUDITORsees everytransactionxpub of one account’sexternal chainBUSINESS PARTNERpays to a kind ofsuper addressNONE OF THEM HOLDS A KEY THAT CAN SPENDSERVER BROKEN INTO: AT MOST SEES INCOMING PAYMENTS
BIP 32’s examples of sharing part of a wallet. Each party holds an extended public key; none of them holds a key that can spend.4192122

Hardened children are different. Their HMAC input contains the parent’s private key, so public derivation is simply not defined for them. There is also no way at all from a public parent to a private child. An extended public key reaches the public keys of descendants that are linked to it by normal steps only, and nothing else.35623

Why hardened keys exist

Normal derivation has a specific risk. An attacker may obtain a parent xpub and a descendant private key connected to it through normal steps only. Together, these let the attacker recover the parent’s extended private key and derive every key below it.24

For a normal child, the parent xpub reveals the HMAC value added during derivation. Anyone who also obtains that child’s private key can subtract the value again to recover the parent’s private key. The example below shows the recovery on BIP 32’s published vector.2425

Fig. A02.7 An xpub plus one leaked key

  1. An xpub plus one leaked child key, step 1 of 4Known: the extended public key of m/0H, public key 035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56 and chain code 47fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141. Leaked: the private key of m/0H/1, 3c6cb8d0f6a264c91ea8b5030fadaa8e538b020f0a387421a12de9319dc93368.XPUB OF m/0HK 035a7846…c 47fdacbd…LEAKED · m/0H/1k₁ 3c6cb8d0…

    Someone holds m/0H’s extended public key, and the private key of its normal child m/0H/1 has leaked.

  2. An xpub plus one leaked child key, step 2 of 4HMAC-SHA512 keyed by the chain code over the public key and index 00000001 gives I_L = 4eb9d78157bae7a24115001621c4d91e3a3110e11e143c5259eaa4e55c5ec4bf. No private key is needed.K 035a…00000001c (HMAC key)HMAC-SHA512I_L 4eb9d…

    The xpub alone is enough to recompute I_L for child 1: the HMAC input is public.

  3. An xpub plus one leaked child key, step 3 of 43c6cb8d0f6a264c91ea8b5030fadaa8e538b020f0a387421a12de9319dc93368 minus 4eb9d78157bae7a24115001621c4d91e3a3110e11e143c5259eaa4e55c5ec4bf, modulo the curve order, is edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea.k₁ 3c6cb8…−I_L 4eb9d7…= (mod n)k edb2e14f…= THE PRIVATE KEY OF m/0H

    Subtract: k = k₁ − I_L (mod n).

  4. An xpub plus one leaked child key, step 4 of 4The recovered key equals the private key of m/0H, so everything below m/0H is exposed. m's key cannot be recovered the same way: m/0H is a hardened child, and its HMAC input contains m's private key.m · NOT RECOVERABLEHARDENED: STOPS HEREm/0H · RECOVEREDAND EVERYTHING BELOW IT

    That is m/0H’s private key, and with c every key below it. The hardened edge above m/0H stops the climb.

Exact values
xpub of m/0H (BIP 32 line 225)
xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw
Leaked private key of m/0H/1
3c6cb8d0f6a264c91ea8b5030fadaa8e538b020f0a387421a12de9319dc93368
I_L, from the xpub alone
4eb9d78157bae7a24115001621c4d91e3a3110e11e143c5259eaa4e55c5ec4bf
Recovered private key of m/0H
edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea
BIP 32’s warning, recomputed on the published vector. A leaked child key and its parent’s xpub give back the parent’s private key; the hardened edge above the parent stops the climb there.242526

BIP 32 uses hardened derivation at the account level to limit this risk. A leaked account private key cannot reveal the master key or keys in other accounts through this recovery method. BIP 32 therefore requires more care with extended public keys than with ordinary public keys. Recovering a parent private key requires both its xpub and a leaked descendant private key connected through normal steps. The xpub alone derives only public keys.32426

Caveat

Sharing an extended public key is also a privacy decision. It lets the holder see every public key reached from it by normal steps, and with them the payments. BIP 32’s auditor use case relies on exactly that.32127

Writing a key down

An extended key travels as 78 bytes: a version, the depth in the tree, the parent’s fingerprint, the child number, the chain code and the key. Base58Check adds four checksum bytes and produces exactly 111 characters, beginning xpub or xprv on mainnet.28

Fig. A02.8 One node, two serializations

One node, two serializationsNode m/0H of BIP 32 test vector 1, serialized as 82 bytes: version 4, depth 1, parent fingerprint 4, child number 4, chain code c 32, key data 33, checksum 4. xpub: version 0488b21e; depth 01; parent fingerprint 3442193e; child number 80000000; chain code c 47fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141; key data 035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56; checksum b8b9c580. xprv: the same except version 0488ade4; key data 00edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea; checksum 0a794dec. Base58Check turns each into 111 characters: xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw and xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4cV1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7.VERSION · 4 BDEPTH · 1 BPARENT FINGERPRINT · 4 BCHILD NUMBER · 4 Bxpubchain code c · 32 B…K · 33 BNODE m/0Hxprvchain code c · 32 B…00 ‖ k · 33 BCHECKSUM · 4 BHEAVY OUTLINE: DIFFERSBASE58CHECK → 111 CHARACTERS EACHxpub68Gmy5Edvg… xprv9uHRZZhk6K…
Exact values, field by field
version · 4 B
xpub 0488b21e
xprv 0488ade4
depth · 1 B · same in both
01
parent fingerprint · 4 B · same in both
3442193e
child number · 4 B · same in both
80000000
chain code c · 32 B · same in both
47fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141
key data · 33 B
xpub 035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56
xprv 00edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea
checksum · 4 B
xpub b8b9c580
xprv 0a794dec
xpub · 111 characters
xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw
xprv · 111 characters
xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4cV1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7
Only the version and the key data differ. Depth, parent fingerprint, child number and chain code are identical: they describe the node’s place in the tree, and the chain code is shared by both forms. The checksum differs only as a consequence.928

The fingerprint is the first four bytes of the Hash160 of a key’s public key. It only helps software spot parents and children quickly. Different keys can share a fingerprint, and BIP 32 says software must be willing to deal with such collisions.2930

Checks when importing an extended public key

Importing an extended public key also requires a check that its X coordinate corresponds to a point on the curve. BIP 32’s fifth test vector is a list of malformed keys of this and other kinds, and the decoder behind this page rejects all sixteen of them, each for its stated reason.831

A tree, not a wallet layout

BIP 32 suggests accounts as hardened children of the master, each with an external chain for receiving and an internal chain for change: m/iH/0/k and m/iH/1/k. It explicitly allows other layouts. Later path conventions build on the same derivation mechanism, so an unfamiliar path does not by itself mean a wallet is broken.32

Back to the seed

BIP 32 asks for a seed of 128 to 512 bits from a random number generator, and advises 256. The 64-byte seed that BIP 39 produces, described in the previous chapter, fits. The test vector file referenced by BIP 39 also lists the master extended key for each of its 24 English seeds. The tests behind this page reproduce all of them.733

Every node can have 2³¹ normal and 2³¹ hardened children. The seed can reproduce every node in the tree, so one seed backup covers all those keys.3714

The wallet-backup problem BIP 32 addressed

When BIP 32 was written, the reference wallet generated each key at random. To avoid needing a new backup after every transaction, it kept a pool of a hundred spare keys. Every key was independent, so every key had to be saved.2

BIP 32, assigned in 2012 and recorded as deployed, takes another route: derive every key from one seed, arranged as a tree. Branches of that tree can be shared with other systems, entirely or in part, with or without the ability to spend.13435

The seed preserves the tree. The branch you share determines which descendants another system can derive, and whether it can derive public keys or private ones.1356

Evidence

Each numbered marker in the text points here, and the ↩ links lead back to the text. Quotes are verbatim from the BIP files at commit 3a10b5b, wiki markup included. Links open the exact lines. Labels say what kind of statement each entry is: a rule, the author’s rationale, history, a test vector, or our own inference.

  1. ↩ a b c Author’s rationale HD wallets can be shared partially or entirely with different systems, each with or without the ability to spend.

    Quoted source text (1)

    wallets which can be shared partially or entirely with different systems, each with or without the ability to spend coins.

    BIP 32, line 22
  2. ↩ a b History When BIP32 was written, the reference client used randomly generated keys and cached 100 reserve keys to avoid a backup after every transaction.

    Quoted source text (1)

    The Bitcoin reference client uses randomly generated keys. In order to avoid the necessity for a backup after every transaction, (by default) 100 keys are cached in a pool of reserve keys.

    BIP 32, line 34
  3. ↩ a b c d e f g h i Rule An extended private key reconstructs all descendant keys; an extended public key reconstructs all descendant non-hardened public keys.

    Quoted source text (2)

    knowing an extended private key allows reconstruction of all descendant private keys and public keys, and knowing an extended public key allows reconstruction of all descendant non-hardened public keys.

    BIP 32, line 120

    N(m/a/b/c) = N(m/a/b)/c = N(m/a)/b/c = N(m)/a/b/c = M/a/b/c.

    BIP 32, lines 116–117
  4. ↩ a b c Author’s rationale Elliptic-curve maths lets a webshop server generate fresh addresses without access to the private keys needed to spend.

    Quoted source text (1)

    This permits for example a webshop business to let its webserver generate fresh addresses (public key hashes) for each order or for each customer, without giving the webserver access to the corresponding private keys (which are required for spending the received funds).

    BIP 32, line 36
  5. ↩ a b c d e f g Rule CKDpub is only defined for non-hardened children; the child public key is point(I_L) + K_par.

    Quoted source text (3)

    It is only defined for non-hardened child keys.

    BIP 32, line 87

    If so (hardened child): return failure

    BIP 32, line 89

    The returned child key K<sub>i</sub> is point(parse<sub>256</sub>(I<sub>L</sub>)) + K<sub>par</sub>.

    BIP 32, line 92
  6. ↩ a b c d e Rule Deriving a private child from a public parent is not possible.

    Quoted source text (1)

    ====Public parent key &rarr; private child key==== This is not possible.

    BIP 32, lines 107–109
  7. ↩ a b c Rule The seed is 128 to 512 bits from a (P)RNG, 256 advised; I = HMAC-SHA512("Bitcoin seed", S); I_L is the master secret key and I_R the master chain code.

    Quoted source text (3)

    Generate a seed byte sequence S of a chosen length (between 128 and 512 bits; 256 bits is advised) from a (P)RNG.

    BIP 32, line 148

    Calculate I = HMAC-SHA512(Key = "Bitcoin seed", Data = S)

    BIP 32, line 149

    Use parse<sub>256</sub>(I<sub>L</sub>) as master secret key, and I<sub>R</sub> as master chain code.

    BIP 32, line 151
  8. ↩ a b c d Test vector BIP32 embeds test vectors, including vectors for leading zeros and a list of invalid extended keys; the tested implementation reproduces all 17 valid chains and rejects all 16 invalid keys.

    Quoted source text (3)

    Seed (hex): 000102030405060708090a0b0c0d0e0f

    BIP 32, line 220

    These vectors test for the retention of leading zeros.

    BIP 32, line 264

    These vectors test that invalid extended keys are recognized as invalid.

    BIP 32, line 291
  9. ↩ a b c d Rule Both private and public keys are extended with a 32-byte chain code, identical for corresponding private and public keys, so children do not depend solely on the key.

    Quoted source text (1)

    In order to prevent these from depending solely on the key itself, we extend both private and public keys first with an extra 256 bits of entropy. This extension, called the chain code, is identical for corresponding private and public keys, and consists of 32 bytes.

    BIP 32, line 62
  10. ↩ a b Rule An extended private key is (k, c); an extended public key is (K, c) with K = point(k).

    Quoted source text (1)

    We represent an extended private key as (k, c), with k the normal private key, and c the chain code. An extended public key is represented as (K, c), with K = point(k) and c the chain code.

    BIP 32, line 64
  11. ↩ a b Rule N() gives the extended public key of an extended private key; it removes the ability to sign transactions.

    Quoted source text (1)

    the "neutered" version, as it removes the ability to sign transactions

    BIP 32, line 98
  12. ↩ Rule I splits into I_L and I_R; the child private key is I_L + k_par (mod n) and the child chain code is I_R.

    Quoted source text (3)

    Split I into two 32-byte sequences, I<sub>L</sub> and I<sub>R</sub>.

    BIP 32, line 78

    The returned child key k<sub>i</sub> is parse<sub>256</sub>(I<sub>L</sub>) + k<sub>par</sub> (mod n).

    BIP 32, line 79

    The returned chain code c<sub>i</sub> is I<sub>R</sub>.

    BIP 32, line 80
  13. ↩ a b c Rule For a normal child, the HMAC data is the parent public key || the index.

    Quoted source text (1)

    If not (normal child): let I = HMAC-SHA512(Key = c<sub>par</sub>, Data = ser<sub>P</sub>(point(k<sub>par</sub>)) || ser<sub>32</sub>(i)).

    BIP 32, line 77
  14. ↩ a b c Rule Each extended key has 2^31 normal children (indices 0 to 2^31−1) and 2^31 hardened children (2^31 to 2^32−1).

    Quoted source text (2)

    Each extended key has 231 normal child keys, and 231 hardened child keys.

    BIP 32, line 66

    The hardened child keys use indices 231 through 232-1.

    BIP 32, line 66
  15. ↩ a b c Rule For a hardened child, the HMAC data is 0x00 || the parent private key || the index.

    Quoted source text (1)

    If so (hardened child): let I = HMAC-SHA512(Key = c<sub>par</sub>, Data = 0x00 || ser<sub>256</sub>(k<sub>par</sub>) || ser<sub>32</sub>(i)).

    BIP 32, line 76
  16. ↩ Rule Paths are written m/3H/2/5 for successive CKDpriv steps, with H marking a hardened index.

    Quoted source text (1)

    we will write CKDpriv(CKDpriv(CKDpriv(m,3<sub>H</sub>),2),5) as m/3<sub>H</sub>/2/5.

    BIP 32, line 115
  17. ↩ Rule A derived key can be invalid, in which case the next index is used; this has probability lower than 1 in 2^127.

    Quoted source text (1)

    In case parse<sub>256</sub>(I<sub>L</sub>) ≥ n or k<sub>i</sub> = 0, the resulting key is invalid, and one should proceed with the next value for i. (Note: this has probability lower than 1 in 2127.)

    BIP 32, line 81
  18. ↩ a b Rule Computing a normal child's public key from the private or the public parent gives the same result; this is what makes non-hardened keys useful.

    Quoted source text (1)

    The fact that they are equivalent is what makes non-hardened keys useful (one can derive child public keys of a given parent key without knowing any private key)

    BIP 32, line 105
  19. ↩ a b Author’s rationale BIP 32 says someone who illegally obtains access to the webserver can at most see incoming payments, not steal them.

    Quoted source text (1)

    This means someone illegally obtaining access to the webserver can at most see all incoming payments but will not be able to steal the money

    BIP 32, line 189
  20. ↩ Editorial inference Our operational inference: control of a server that presents receiving addresses can let an attacker substitute their own addresses and divert future payments without deriving the merchant’s private keys. This is separate from disclosure of the xpub alone.

    Quoted source text (1)

    Deterministic wallets do not require such frequent backups, and elliptic curve mathematics permit schemes where one can calculate the public keys without revealing the private keys. This permits for example a webshop business to let its webserver generate fresh addresses (public key hashes) for each order or for each customer, without giving the webserver access to the corresponding private keys (which are required for spending the received funds).

    BIP 32, line 36
  21. ↩ a b c Author’s rationale Sharing account extended public keys lets an auditor see all transactions but not a single secret key.

    Quoted source text (1)

    This will allow the auditor to see all transactions from and to the wallet, in all accounts, but not a single secret key.

    BIP 32, line 176
  22. ↩ a b Author’s rationale A business partner can receive the extended public key of one account's external chain and use it as a kind of super address.

    Quoted source text (1)

    one can use the extended public key for the external chain of a specific account (M/i h/0) as a sort of "super address", allowing frequent transactions that cannot (easily) be associated, but without needing to request a new address for each payment.

    BIP 32, line 184
  23. ↩ Rule N(m/aH) cannot be rewritten as N(m)/aH, because the latter is not possible.

    Quoted source text (1)

    However, N(m/a<sub>H</sub>) cannot be rewritten as N(m)/a<sub>H</sub>, as the latter is not possible.

    BIP 32, line 118
  24. ↩ a b c d Rule A parent extended public key plus the private key of any descendant reached from it by non-hardened steps is equivalent to the parent extended private key; extended public keys must be treated more carefully than regular public keys.

    Quoted source text (1)

    knowledge of a parent extended public key plus any non-hardened private key descending from it is equivalent to knowing the parent extended private key (and thus every private and public key descending from it). This means that extended public keys must be treated more carefully than regular public keys.

    BIP 32, line 212
  25. ↩ a b Test vector From test vector 1's xpub for m/0H and the private key of m/0H/1, the tested implementation recomputes m/0H's private key exactly.

    Quoted source text (3)

    knowledge of a parent extended public key plus any non-hardened private key descending from it is equivalent to knowing the parent extended private key

    BIP 32, line 212

    ext pub: xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw

    BIP 32, line 225

    ext prv: xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu53Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs

    BIP 32, line 229
  26. ↩ a b Author’s rationale This weakness is why hardened keys exist and are used at the account level, so a leak of account-level or lower private keys never compromises the master or other accounts.

    Quoted source text (1)

    It is also the reason for the existence of hardened keys, and why they are used for the account level in the tree. This way, a leak of account-specific (or below) private keys never risks compromising the master or other accounts.

    BIP 32, line 213
  27. ↩ Rule Leaking a private key means access to coins; leaking a public key can mean loss of privacy.

    Quoted source text (1)

    Leaking a private key means access to coins - leaking a public key can mean loss of privacy.

    BIP 32, line 208
  28. ↩ a b Rule An extended key serializes to 78 bytes (version, depth, parent fingerprint, child number, chain code, key data); Base58Check adds 32 checksum bits for exactly 111 characters starting xpub or xprv on mainnet.

    Quoted source text (3)

    4 bytes: version bytes (mainnet: 0x0488B21E public, 0x0488ADE4 private; testnet: 0x043587CF public, 0x04358394 private)

    BIP 32, line 131

    33 bytes: the public key or private key data (ser<sub>P</sub>(K) for public keys, 0x00 || ser<sub>256</sub>(k) for private keys)

    BIP 32, line 136

    This 78 byte structure can be encoded like other Bitcoin data in Base58, by first adding 32 checksum bits (derived from the double SHA-256 checksum), and then converting to the Base58 representation. This results in a Base58-encoded string of exactly 111 characters.

    BIP 32, line 138
  29. ↩ Rule A key is identified by the Hash160 of its public key; the first 32 bits are its fingerprint.

    Quoted source text (2)

    Extended keys can be identified by the Hash160 (RIPEMD160 after SHA256) of the serialized ECDSA public key K, ignoring the chain code.

    BIP 32, line 124

    The first 32 bits of the identifier are called the key fingerprint.

    BIP 32, line 126
  30. ↩ Rule The parent fingerprint is only a fast way to detect parents and children; software must be willing to deal with collisions.

    Quoted source text (1)

    Note that the fingerprint of the parent only serves as a fast way to detect parent and child nodes in software, and software must be willing to deal with collisions.

    BIP 32, line 140
  31. ↩ Rule When importing an extended public key, implementations must verify that its X coordinate is on the curve.

    Quoted source text (1)

    When importing a serialized extended public key, implementations must verify whether the X coordinate in the public key data corresponds to a point on the curve. If not, the extended public key is invalid.

    BIP 32, line 142
  32. ↩ Author’s rationale BIP32's default layout uses hardened account nodes with an external chain (m/iH/0/k) and an internal chain (m/iH/1/k); it is a default and advisory, and implementations may deviate.

    Quoted source text (4)

    The layout defined in this section is a default only, though clients are encouraged to mimic it for compatibility, even if not all features are supported.

    BIP 32, line 158

    m/i<sub>H</sub>/0/k corresponds to the k'th keypair of the external chain of account number i of the HDW derived from master m.

    BIP 32, line 165

    m/i<sub>H</sub>/1/k corresponds to the k'th keypair of the internal chain of account number i of the HDW derived from master m.

    BIP 32, line 166

    However, implementations may deviate from it for specific needs; more complex applications may call for a more complex tree structure.

    BIP 32, line 193
  33. ↩ Test vector BIP39 seeds feed BIP32. The trezor vector file referenced by BIP39 also lists each seed's master extended key; the tested implementation reproduces all 24 English entries.

    Quoted source text (2)

    This seed can be later used to generate deterministic wallets using BIP-0032 or similar methods.

    BIP 39, lines 99–100

    https://github.com/trezor/python-mnemonic/blob/master/vectors.json

    BIP 39, line 133
  34. ↩ History BIP32 was assigned in 2012; its preamble records the type Informational and the status Deployed.

    Quoted source text (3)

    Assigned: 2012-02-11

    BIP 32, line 16

    Status: Deployed

    BIP 32, line 14

    Type: Informational

    BIP 32, line 15
  35. ↩ Rule BIP32 first specifies deriving a tree of keypairs from a single seed, then a wallet structure on top of the tree.

    Quoted source text (1)

    In the first part, a system for deriving a tree of keypairs from a single seed is presented. The second part demonstrates how to build a wallet structure on top of such a tree.

    BIP 32, line 26