MASTERING-BITCOIN
| Formula | Name | Description |
|---|---|---|
| Master derivation | (master priv key), (master chain code) | |
| Master public key | Scalar-multiply by generator point | |
| Normal child derivation | Uses parent public key as HMAC data | |
| Hardened child derivation | Uses parent private key (requires ) | |
| Child private key | Sum modulo curve order |
Explore how a single master seed branches into an entire tree of keys. Toggle which nodes are hardened (red, lock icon) vs normal (blue). Notice which subtrees can be regenerated from an xpub alone.
β interactive visualization β coming to this page format soon
Reflect: If every top-level node is hardened (the default BIP-44 layout) and you export an xpub at the account level, the server can derive every public address below β but cannot walk back up to compromise other accounts or the master key. What happens if the account level were set to normal instead?
The index that selects a child is a 32-bit integer. The top bit flips the derivation mode: indices below are normal, indices at or above are hardened. Drag the slider to see where your index lands.
β interactive visualization β coming to this page format soon
Notice: The apostrophe notation 0' is just a shorthand for 0x80000000 (i.e., hardened index 0). Some tools use 0h instead because shells mangle apostrophes. The raw integer is the same.
This is why hardened derivation matters. Toggle whether the derivation step is hardened and whether a child private key has leaked, then watch which nodes become compromised.
β interactive visualization β coming to this page format soon
Reflect: The xpub alone leaks nothing beyond public keys. One child private key alone leaks only that child. But xpub + one child private key + normal derivation reverses the CKD math: the attacker subtracts the known HMAC left-half from the leaked child private key (mod ) to recover the parent private key. Hardened derivation breaks this because the HMAC input uses the parent private key, which the attacker does not have.
Question 1
Your 12-word seed is fed into HMAC-SHA512 with the key string "Bitcoin seed". The 512-bit output is split in half. What do those two halves become?
β Correct! and .
β Not quite. HMAC-SHA512 produces m and c directly; the public key M is derived afterwards as .
Solution:
The chain code is the extra entropy that lets the tree be deterministic yet compartmentalized.
Question 2
An e-commerce server is loaded with an xpub derived from the account level. An attacker compromises the server and also obtains the private key for receive address index 7 through a separate leak. All derivation below the account level is normal (non-hardened).
What is the worst-case impact?
β Correct! Catastrophic reversal: xpub + one child private key propagates upward and sideways within the normal-derivation region.
β Not quite. Under normal derivation, the chain code lets an attacker invert CKD once a single child private key leaks.
Solution:
With normal derivation the CKD math is reversible given both halves:
The attacker recomputes from the xpub (they know the chain code and the parent public key), subtracts it from the leaked child private key modulo , and recovers the parent private key. Once they hold the parent private key and the chain code, they can derive every sibling private key in that subtree.
However, the compromise stops at the first hardened boundary above. Since BIP-44 hardens the purpose, coin-type, and account levels, the master seed and other accounts remain safe.
Question 3
True or False: At a hardened derivation step, you can still export the parent xpub and use it to derive all child public keys on a web server β just like with normal derivation.
β Correct! Hardened steps block xpub-based derivation by design β that is how they protect against reversal.
β Not quite. Hardened derivation uses the parent private key as HMAC input, which the xpub does not contain.
Solution:
False. That is precisely the tradeoff of hardened derivation.
The tradeoff: you lose xpub-based public-key derivation, but you gain isolation against the chain-code-leak attack. That is why BIP-44 uses hardened steps at the top (purpose, coin, account) and normal steps at the leaves (change, address index).
Question 4
Consider the BIP-44 path:
Which statement correctly describes what the apostrophes and their absence mean for this path?
β Correct! Hardened at the top (isolation), normal at the bottom (xpub-derivable leaves) β that is the BIP-44 security architecture.
β Not quite. The apostrophe marks hardened derivation on individual levels. In this path, only the top three have apostrophes.
Solution:
The apostrophe (also written as h) marks a hardened index, meaning the raw index has its top bit set (i.e., the index is ).
Breaking down :
| Segment | Meaning | Mode |
|---|---|---|
m |
master key | β |
44' |
purpose = BIP-44 | hardened |
0' |
coin type = Bitcoin | hardened |
0' |
account 0 | hardened |
0 |
change (external chain) | normal |
5 |
address index 5 | normal |
Because the account level is hardened, the master key stays isolated from any account-level leak. Because the change and address-index levels are normal, you can export an account-level xpub to a web server and generate unlimited receive addresses at the leaves without exposing any private key β the classic watch-only / e-commerce deployment.
Solved: 0 / 4