Sub topic 6
Seed Phrases and How to Back Them Up
This chapter assumes you know that a wallet holds private keys and that those keys sign transactions. It also assumes you have restored or created a wallet in some app before. Earlier chapters covered keys, custody and the hot/cold split. Here the question is narrower: how does one short list of words stand in for every key in a wallet, and how do you store it so you can neither lose it nor leak it?
What a seed phrase is
A seed phrase (also called a recovery phrase or mnemonic) is a list of 12 to 24 words from a fixed dictionary. Most wallets follow the BIP39 standard. The words encode a random number. That number feeds a deterministic process that generates every private key the wallet will ever use, so the same phrase always produces the same keys.
This is why one backup covers an entire wallet, including addresses you have not created yet. It is also why the phrase is the wallet. Anyone who reads it can recreate the keys and spend the funds from any device, with no password and no second factor.
The coins never sit on your device. They are entries on the blockchain, locked to keys. The device and the app are replaceable. The phrase is not.
How the phrase is built
BIP39 works in these steps:
- The wallet generates random entropy of 128, 160, 192, 224 or 256 bits.
- It appends a short checksum, taken from a SHA-256 hash of the entropy. The checksum is entropy length divided by 32 bits.
- It splits the result into 11-bit groups. Each group is an index into a 2048-word list.
- To get the seed, it runs the words through PBKDF2-HMAC-SHA512 with 2048 iterations. The salt is the text "mnemonic" plus an optional passphrase.
- The 64-byte seed becomes the root of a hierarchical deterministic (HD) tree, defined by BIP32. Child keys come from it along derivation paths.
The code below reproduces the size arithmetic and the seed derivation using only the Python standard library. It uses the well-known public test phrase "abandon ... about". Never use that phrase for real funds, because bots watch its addresses.
import hashlib
import unicodedata
def bip39_sizes(entropy_bits):
"""Return (checksum_bits, word_count) for a BIP39 entropy size."""
if entropy_bits not in (128, 160, 192, 224, 256):
raise ValueError("entropy must be 128, 160, 192, 224 or 256 bits")
checksum_bits = entropy_bits // 32
word_count = (entropy_bits + checksum_bits) // 11
return checksum_bits, word_count
def mnemonic_to_seed(mnemonic, passphrase=""):
"""Derive the 64-byte BIP39 seed from a phrase and optional passphrase."""
phrase = unicodedata.normalize("NFKD", mnemonic).encode("utf-8")
salt = unicodedata.normalize("NFKD", "mnemonic" + passphrase).encode("utf-8")
return hashlib.pbkdf2_hmac("sha512", phrase, salt, 2048, dklen=64)
print(bip39_sizes(128)) # (4, 12)
print(bip39_sizes(256)) # (8, 24)
test_phrase = " ".join(["abandon"] * 11 + ["about"])
seed_plain = mnemonic_to_seed(test_phrase)
seed_again = mnemonic_to_seed(test_phrase)
seed_with_pass = mnemonic_to_seed(test_phrase, passphrase="extra")
print(len(seed_plain)) # 64
print(seed_plain == seed_again) # True: same phrase, same keys
print(seed_plain == seed_with_pass) # False: a passphrase gives a different walletNote that the seed derivation never checks the checksum. The checksum only lets a wallet warn you about a mistyped phrase when you enter it. Without a passphrase, a wrong phrase that happens to pass the checksum, or a wallet that skips the check, simply opens a different, empty wallet. No error appears.
Twelve words or twenty-four
A 12-word phrase carries 128 bits of entropy and a 24-word phrase carries 256. Brute-forcing 128 bits is not feasible with any known or foreseeable hardware. Both lengths are acceptable for a single-key wallet. Twenty-four words add margin and are the common default on hardware wallets, but they are longer to write down and check. The larger risks are how the phrase is generated and stored, so choose a length your backup routine can handle without errors.
Generate the phrase only on the device or wallet that will use it, with a trustworthy random source. Never accept a phrase that someone else chose or that came pre-printed in a package. Do not invent your own words either. Human choices are far less random than they feel.
The passphrase option
Many wallets support an optional passphrase, sometimes called the "25th word". It is mixed into the salt in the derivation step, as the code above shows. Each passphrase leads to a different, valid wallet.
This has two effects:
- An attacker who finds your 24 words but not the passphrase gets an empty or decoy wallet.
- If you forget the passphrase, or mistype it by one character, the funds are unreachable, and the wallet will still open without any error.
A passphrase is a separate secret and needs its own backup, stored apart from the words. Use one only if you can reliably manage two backups.
What a backup must survive
A good backup balances two opposing failures: someone else getting the phrase (theft) and you being unable to read it (loss). Threats on both sides include fire, flood, burglary, a curious relative, forgetting where it is, and fading ink.
| Medium | Fire and water | Theft risk | Common problems |
|---|---|---|---|
| Paper | Weak | Anyone who finds it can spend | Fades, burns, tears, gets thrown away |
| Stamped or engraved metal | Strong | Same as paper | Cost, and stamping errors you must check |
| Photo, cloud note or email | Not applicable | High, because it sits on networked services | Malware, account takeover, sync leaks |
| Memory only | Not applicable | Low | Forgetting, death, injury |
| Password manager entry | Not applicable | Depends on the vault | Puts the keys behind an online account |
Any digital copy on an internet-connected device puts the seed within reach of malware and account compromise. The point of cold storage is that the keys never touch a networked machine, and a photo defeats that. The same applies to typing the phrase into a website, a chat window or a support form. Legitimate wallet software never asks for your phrase outside a restore screen on the device you are setting up. A request for it from anyone else is a scam.
A practical backup procedure
- Set up the wallet in private, with no cameras, no screen sharing, and no remote-access software running.
- Write the words by hand, in order, numbered 1 to N. Use a pen with permanent ink, or a metal kit for a longer-lasting copy. Write clearly, because ambiguous letters are a common reason a restore fails.
- Verify the backup by reading it back against the screen, word by word. Do this before you send any funds.
- Record the details that restore needs besides the words: the wallet software or standard, whether a passphrase is used, the script type (for example native SegWit or Taproot), and the derivation path if it is non-default. Store these notes without the phrase. They are not secret, but without them a restore may show an empty wallet because the software looks at the wrong addresses.
- Make at least two copies and keep them in separate places, so that one fire or one burglary cannot take both. A home safe and a safe-deposit box, or the home of a trusted person, are typical choices.
- Test the recovery (see below).
Testing the recovery
A backup you have never restored from is a guess. Before you move meaningful funds, run this drill:
- Fund the wallet with a small amount and note one receiving address.
- Wipe the device or use a second device of the same type, or recovery software.
- Restore from the written backup only. Do not use a screenshot, a copied file, or your memory.
- Confirm that the same receiving address appears and the balance matches.
- If you use a passphrase, include it in the test.
Repeat the drill after you change any part of the setup. For larger holdings, check the stored copies once a year. Make sure they are still legible and still where you think they are.
Common errors
- Photographing or cloud-saving the phrase "just for now". Temporary copies are still copies, and they tend to stay.
- Storing the phrase next to the device. A thief who takes both holds everything.
- Buying a wallet that arrives with a pre-filled card or a phrase already generated.
- Skipping the read-back check and discovering a transcription error years later.
- Leaving out the passphrase or the derivation notes, then failing to find the funds on restore.
- Telling no one where the backup is. This leaves the funds lost if you die or are incapacitated, a problem the recovery-planning chapter covers.
- Entering the phrase into a "validator" or "sync" website that claims to fix a wallet problem.
Exercise
You restore a wallet from your 24-word backup on a new device. The restore completes without any error, but the balance is zero and the addresses look unfamiliar. Name two likely causes that do not involve the funds being gone, and say how you would check each.
Show answer
First, a passphrase was used on the original wallet and was not entered, or was entered with a typo. A wrong passphrase opens a different, valid wallet with no warning. Check by re-entering the passphrase carefully, including capitalization and spacing, from its own backup. Second, the new software uses a different script type or derivation path from the original (for example legacy versus native SegWit addresses). Check your stored notes for the original standard, then select the matching account type or path in the restore settings. A third possibility is a word transcribed wrongly that still passes the checksum, but the checksum usually catches that.
Exercise
For a 12-word BIP39 phrase, how many bits of checksum are included, and why does the seed derivation step not use the checksum?
Show answer
A 128-bit entropy value gets 128 / 32 = 4 checksum bits, giving 132 bits, which is 12 groups of 11 bits. The checksum only helps a wallet detect a mistyped phrase when you enter it. The derivation (PBKDF2 over the words and passphrase) runs on whatever words it is given, so a wrong phrase produces a different valid seed instead of an error.