How seed phrases and wallet backups work
On this page
Key points
- One root seed can create every key in an HD wallet, so the seed is the backup.
- BIP 39 turns random data into 12 to 24 words. 12 words encode 128 bits.
- A passphrase, if you set one, must be backed up too. The words alone will not restore that wallet.
- bitcoin.org: back up the whole wallet, encrypt online backups, use more than one secure place.
Most modern wallets ask you to write down a list of words when you set them up. This article explains what that list is and what the Bitcoin documentation says about backing it up.
One seed, many keys
The Bitcoin developer guide describes hierarchical deterministic (HD) wallets. A single root seed is used to create a whole tree of child keys in a predictable way, so the relationship between the keys is invisible to anyone without the seed. The guide says this greatly simplifies backups: the root seed is the only data a user needs to back up to derive every key the wallet program creates with particular settings.
bitcoin.org's wallet security page makes the same point: most modern wallets are deterministic, so a single backup of the recovery phrase is enough to restore all past and future addresses, though you should check how your own wallet handles backups.
What the words are
A root seed is random data that must be backed up precisely. To make hand-copying easier, BIP 39 defines a mnemonic: a sentence of common words that encodes the random data. According to BIP 39:
- The initial randomness is 128 to 256 bits, in multiples of 32 bits.
- A checksum, taken from a SHA-256 hash of that randomness, is added, and the result is split into 11-bit groups. Each group picks one word from a list of 2048 words.
- That gives 12 words for 128 bits, 21 words for 224 bits and 24 words for 256 bits.
The BIP says the sentence is meant to carry computer-generated randomness in a human-readable form. It is not a way to turn a sentence you invent into a wallet.
The optional passphrase
BIP 39 lets a user protect the mnemonic with a passphrase. If none is given, an empty string is used. The words and passphrase are put through PBKDF2 (2048 rounds of HMAC-SHA512) to produce a 512-bit seed. Because every passphrase produces a valid seed, only the correct one opens the wallet you want. The practical meaning: if you use a passphrase, you must back it up too, or the words alone will not restore your wallet.
Compatibility warnings from the sources
- The Bitcoin developer guide warns that HD wallet programs are not expected to be fully compatible, so use the same wallet program with the same HD settings for a given root seed. Check this before relying on a seed to move between programs.
- BIP 39 notes the seed depends on the wordlist used. Translating a mnemonic to another wordlist gives a completely different seed.
Backup advice from bitcoin.org
- Back up the entire wallet. Some wallets manage many private keys behind the scenes, and a backup that covers only the visible keys may not recover all funds.
- Encrypt online backups. Any backup stored online is highly vulnerable to theft.
- Use many secure locations. Avoid a single point of failure; keep copies in more than one physical place on durable media.
- Never forget your password. Password recovery options are very limited, and a forgotten password can mean permanently lost funds.
A short checklist
- Write the words down by hand, in order, and check them twice.
- Record whether you set a passphrase, and store it separately from the words.
- Keep at least two copies in different places.
- Never type the words into a website, chat or email. Anyone who has them can restore your wallet.
- Test recovery with a small amount before you rely on the backup.
Sources
- Bitcoin Developer Guide: Wallets
- BIP 39: Mnemonic code for generating deterministic keys
- bitcoin.org: Securing your wallet