The one-sentence version
12 English words are actually a "human-readable encoding" consisting of a 128-bit random number plus a 4-bit checksum. It is stretched into a 512-bit seed via PBKDF2, which then derives countless private keys like a tree layer by layer according to BIP-32 rules. Therefore, a single set of recovery phrase can manage all chains and all addresses. Consequently, the recovery phrase is everything: if lost, all addresses are lost; if leaked, all addresses are leaked.
This article has three layers:
- Layer 1: The Intuition: A key tree
- Layer 2: Real-World Use: Why "balance is 0 after import," the role of a passphrase, and the risks of xpub leakage
- Layer 3: Principles and Engineering Key points: BIP-39 encoding and checksum, PBKDF2, BIP-32 derivation, derivation paths, including a standard test vector
Layer 1: The Intuition
1.1 A Key Tree
Early Bitcoin wallets had to back up a new private key every time a new address was generated, which was very cumbersome. HD (Hierarchical Deterministic) wallets introduced a different approach:
- Generate only one root secret (the recovery phrase);
- Use fixed mathematical rules to "grow" branches and leaves from the root, where each leaf is a private key;
- With the same root and the same rules, the same tree is always grown.
Thus, by backing up the recovery phrase just once, the entire tree can be fully recovered in any wallet software.
1.2 Why Words
A 128-bit random number written in hexadecimal is 32 characters long; miscopying a single character ruins everything. BIP-39 splits it into 11-bit segments, where each segment corresponds to a word (a wordlist of words), and includes a checksum so the wallet can detect if a word is miscopied (similar to how the last digit of an ID card works in the Luhn algorithm and checksums).
Layer 2: Real-World Use
- "Balance is 0 after import": With the same recovery phrase, different wallets might use different default derivation paths, resulting in different addresses. The money isn't lost; it has just "grown" on a different leaf. Switching to the correct path will reveal it.
- passphrase (the 25th word): BIP-39 allows adding an extra passphrase outside the recovery phrase; a different passphrase results in a completely different seed. It can prevent "recovery phrase slips being seen" and can be used for "decoy wallets" (different passphrases corresponding to different wallets). The cost is: if you forget the passphrase, the money is truly gone.
- xpub leakage risk: An extended public key (xpub) can derive all child public keys, and is often given to accounting software for read-only viewing. However, it exposes the balances and transaction history of all your addresses (privacy); more dangerously, an xpub combined with any non-hardened child private key can be used to reverse-engineer the parent private key, which in turn allows deriving all sibling private keys.
- Multi-chain compatibility: The same recovery phrase can derive private keys for various chains like Bitcoin, Ethereum, Solana, etc., according to different paths.
Layer 3: Principles and Engineering
3.1 BIP-39: Entropy → Words
| Entropy | Checksum | Total Bits | Number of Words |
|---|---|---|---|
| 128 bits | 4 bits | 132 | 12 |
| 256 bits | 8 bits | 264 | 24 |
The checksum takes the first bits of and is appended to the entropy, then every 11 bits, a word is looked up in the wordlist.
Standard Test Vector: All-zero Entropy
Entropy is 16 zero bytes (128 zeros).
- The beginning of is
374708ff..., the first hex digit3=0011, so the checksum is0011; - 132 bits = the first 121 bits are all 0, and the last 11 bits are
0000000 0011; - The first 11 segments are all 0, corresponding to the 0th word in the wordlist: abandon; the last segment is 3, corresponding to the 3rd word: about (the wordlist starts with abandon, ability, able, about).
Recovery phrase: abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about.
This is the first one in the BIP-39 official test vectors; never use it to store money: everyone knows it. (Checksum verified via Python.)
In a 12-word phrase, only part of the bits in the last word are entropy, while the rest is the checksum. Therefore, if you write 12 words at random, there is only about a probability of passing the checksum.
3.2 Words → Seed: PBKDF2
2048 iterations represent key stretching: making each passphrase guess take a little more time. However, for 128-bit random entropy, stretching is actually not strictly necessary; it primarily protects the user-defined passphrase.
3.3 Seed → Tree: BIP-32
Root node: , where the left 256 bits are the master private key and the right 256 bits are the "chain code."
Each child node is calculated via HMAC-SHA512 using the parent's key, chain code, and child index :
| Type | Input | Feature |
|---|---|---|
| Normal Derivation () | Parent public key + chain code + | Can derive all child public keys using only the xpub (convenient for read-only monitoring) |
| Hardened Derivation (, written as ) | Parent private key + chain code + | Requires the private key to derive; leakage of a child private key does not compromise the parent private key |
In normal derivation, child private key parent private key (modulo curve order ), while the tweak only depends on the public xpub. Therefore, "xpub + one child private key" can subtract out the parent private key. This is why the upper layers of the path must use hardened derivation.
3.4 Derivation Paths
BIP-44 specifies: m / purpose' / coin_type' / account' / change / address_index
| Chain | Common Path |
|---|---|
| Bitcoin (Legacy addresses) | m/44'/0'/0'/0/0 |
| Bitcoin (Native SegWit) | m/84'/0'/0'/0/0 |
| Ethereum | m/44'/60'/0'/0/0 |
3.5 Engineering details
- The recovery phrase must only be generated by a trusted random number generator (see "Wallets with bad randomness"), not "thought up" by oneself;
- Do not take photos, do not store in the cloud, and do not paste into any webpage or chat;
- When distributed storage is needed, use SLIP-39 (Shamir's Secret Sharing, see "Shamir's Secret Sharing"), rather than splitting the 12 words in half (each half would leak half of the entropy);
- When using xpub for read-only monitoring, ensure the counterparty is trusted and understand that it will expose the entire transaction history.
Summary
| Layer | Key points |
|---|---|
| Intuition | One root secret, growing a whole key tree according to fixed rules |
| BIP-39 | Entropy + SHA-256 checksum, one word every 11 bits; PBKDF2 stretching into a seed |
| BIP-32 | Layer-by-layer derivation via HMAC-SHA512; hardened derivation protects the parent private key |
| Risk | The recovery phrase is everything; different paths result in 0 balance; xpub leaks privacy and carries collateral risk |