| 231 | The number that splits the tree |
|---|
2,147,483,648. That is 2³¹, and it is the single most consequential number in wallet design. It is not a key length, not a block height, not a difficulty target. It is the line down the middle of the derivation tree: every index below it behaves one way, every index at or above it behaves another, and the difference between the two is the difference between “an auditor can watch my balances” and “an auditor can take my money.”
You write down twelve words once. Your wallet then produces an effectively unlimited number of keys, in a reproducible order, forever. The interesting question is not how it does that — HMAC and some modular arithmetic, thirty lines of code. The interesting question is which parts of that tree you can hand to somebody else without handing them the tree.

Peeling: A Wallet Is Not a Container
Start by throwing the word away. A wallet does not hold coins — nothing holds coins. What it holds is a recipe for generating keys, and the coins live on the chain, locked to those keys. Your wallet never stored a coin either; that was the point of that piece.
Once you see the wallet as a key generator rather than a box, the design requirements become obvious:
- Backup must be one-time. If every new address required a new backup, the scheme would fail on human nature within a month.
- Order must be deterministic. Two devices with the same seed must produce the same address #47, or recovery is a lottery.
- Some parts must be delegable. A shop server needs to generate fresh receiving addresses all day. It must be able to do that without the ability to spend anything.
Requirement 3 is where 2³¹ shows up, and it is the only one of the three that is genuinely hard.
From Twelve Words to 512 Bits
- 128 or 256 bits
Entropy is generated; 128 → 12 words, 256 → 24 words
- + checksum
The mnemonic gets its own checksum; a bad word fails locally
- PBKDF2 × 2048
HMAC-SHA512, salt = “mnemonic” + optional passphrase → 512-bit seed
- “Bitcoin seed”
I = HMAC-SHA512(key = “Bitcoin seed”, data = seed)
- split I
Left 256 bits = master private key · right 256 bits = master chain code
Two things worth noticing there. The 2048 PBKDF2 rounds are not there to slow you down — they are there to make guessing passphrases expensive, because a wallet with a passphrase and a wallet without one are indistinguishable to anyone holding the twelve words.
And the chain code is the part people forget. Every node in the tree carries two 256-bit values: a key and a chain code. The key is what you spend with. The chain code is what makes the child derivation unpredictable to anyone who only has the key. Without it, derivation would be a function of the parent key alone, and everyone who ever saw one of your addresses could compute the rest of your branch.
The Fork in the Road
Here is the entire child derivation, in the two cases that matter:
def ckd(parent_key, parent_chaincode, index, is_private):
if index >= 2**31: # hardened
data = b"\x00" + ser256(parent_priv) + ser32(index)
else: # normal
data = serP(pubkey_from(parent_priv)) + ser32(index)
IL, IR = HMAC_SHA512(parent_chaincode, data)[:32], [32:]
child_priv = (parse256(IL) + parent_priv) % n
return child_priv, IR
Read those two data lines again, because everything follows from them.
Non-hardened uses the parent public key as input. Which means: if you have the parent’s extended public key — its public key plus its chain code — you can compute every child’s IL, and therefore every child public key and address, without knowing any private key at all. That is the feature. It is the whole reason “watch-only” works.
Hardened uses the parent private key as input, prefixed with a zero byte. No amount of public information will get you there. That is the wall.
The price of the first one is arithmetic, and it is brutal:
k_child = (IL + k_parent) mod n · IL is computable from the xpub alone → k_parent = k_child − IL
That is the attack. Hand me your account-level extended public key, and let me obtain any single non-hardened child private key — from one leaked key, one bad export, one device that logged it — and I subtract. Out falls the parent private key. From the parent private key I recompute every sibling, because every sibling’s IL was computable from the xpub I already had.
One child key is not one key compromised. It is the whole account.
What a Path Actually Says
m/84'/0'/0/0/0 is not an opaque string. It reads left to right as a set of five decisions:
| Segment | Value | Means |
|---|---|---|
m | — | Master node, derived from the seed |
| purpose | 84' | Use native SegWit (bech32) addresses |
| coin type | 0' | Bitcoin (not testnet, not another chain) |
| account | 0' | Account zero; your first independent bucket |
| change | 0 | External chain — addresses you show people |
| index | 0 | The first address in that chain |
The three apostrophes are the hardened levels. The last two are not, and that is deliberate: exporting the account-level xpub (m/84'/0'/0') gives a server everything it needs to generate receiving addresses for the rest of time, while the hardened wall at account level means a leaked address key stops at the account boundary instead of climbing the tree.
Change the 84' and you get a different address family from the same seed: 44' for legacy 1..., 49' for 3..., 86' for Taproot bc1p. Same twelve words, four wallets that do not see each other. That is the most common way people conclude their recovery “didn’t work” — the seed was fine, the path was different.

The 78 Bytes You Are Actually Exporting
An extended key is a fixed structure, and it is worth knowing what is in it:
4 bytes version xprv 0x0488ADE4 · xpub 0x0488B21E
1 byte depth 0x00 for master, +1 per level
4 bytes parent fingerprint first 4 bytes of the parent's Hash160
4 bytes child number the index, hardened flag included in the high bit
32 bytes chain code the entropy that makes derivation one-way
33 bytes key data 0x00 + privkey, or the compressed pubkey
= 78 bytes → Base58Check → 111 characters starting with "xprv" or "xpub"
The fingerprint is the detail I would underline. It is four bytes — a heuristic, not a proof. The spec says so explicitly: implementations must tolerate collisions. Software that treats a matching fingerprint as cryptographic evidence of parentage is doing something the standard never promised.

Diagnosis
The mental model to walk away with: a seed is a tree, an xpub is a branch, and the branch is only safe to hand out because somebody put a wall at the account level. The wall is 2³¹. Everything below it is visible and derivable from public data; everything at or above it requires the private key that produced it.
Ruled out: that hardening hides anything (it does not, the chain is public); that a leaked child key costs one key (it costs the account, if that child was below the wall); that a wrong-path recovery means a wrong seed (usually the path, not the seed).
What would change my mind: a wallet that exports non-hardened keys above the account level, or one that treats a parent fingerprint as proof. Both are bugs, and neither is exotic.
(The End)


