The master seed is a randomly generated value that is used to deterministically generate a tree of private keys.
The Role of Master Seed
In bitcoin and other cryptocurrencies, each address starts with a private key, a randomly generated number.
For privacy reasons, it’s recommended to use a new address for each transaction. This way, it becomes harder for outside observers to link transactions to the same owner, enhancing user privacy.
When you generate a new private key (and therefore a new address) for each transaction, you face the practical issue of needing to back up each private key. If you lose access to a private key, you lose access to the Bitcoin associated with the corresponding address.
Ensuring the security of numerous private keys becomes a significant operational burden, as each key must be individually backed up and securely stored.
Hierarchical Deterministic (HD) wallets, as introduced by BIP 32, offer a solution to this problem. With HD wallets, you only need to back up a single piece of information: the master seed. This master seed is used to deterministically generate a tree of private keys (and therefore public keys and addresses) in a structured manner.
This means you can still use a new address for every transaction to maintain privacy, but the backup process is greatly simplified. You only need to securely store the initial master seed, which can regenerate all associated keys and addresses.
HD wallets thus resolve the challenge of managing multiple backups for privacy by allowing users to easily regenerate any private key and its corresponding address in the wallet structure from a single, securely stored master seed. This advancement significantly enhances both the security and usability of managing Bitcoin and other cryptocurrencies.
Creating a master seed
Generating a master seed is actually fairly simple, you just have to generate a random number of a specified size (128, 192, or 256 bits), with the primary concern being the quality of randomness.
True randomness ensures the security and unpredictability of the cryptographic keys derived from the master seed.
The emphasis on true randomness over pseudo-randomness is crucial because true randomness cannot be reproduced if the process is repeated under the same conditions, making it more secure against attacks that exploit predictability.
What is a Mnemonic Phrase
A mnemonic phrase is a series of words generated from a specific list, used to represent and easily recover a master seed.
This method, standardised by Bitcoin Improvement Proposal 39 (BIP 39), converts complex binary or hexadecimal seed information into a human-readable format.
This method has multiple predefined lists of 2048 words that are used.
With BIP 39 and similar standards have specific guidelines to ensure security, memorability, and ease of use.
Distinctiveness: Words are chosen to be distinct from each other to minimise the risk of confusion or errors during transcription. This distinctiveness means that words are unlikely to be similar in spelling or pronunciation, reducing the chance of mistakes when writing down or recalling the mnemonic.
Length and Simplicity: Words are typically short and simple to make them easier to write down and remember. This also helps in reducing errors during transcription.
Checksum Integration: A checksum is included as part of the mnemonic phrase to verify its accuracy when it’s entered to restore access to a wallet. This checksum is derived from the initial entropy used to generate the mnemonic, adding an extra layer of error-checking.
Fixed Length: The length of the mnemonic phrase is determined by the amount of entropy used. Common lengths are 12, 18, or 24 words, corresponding to the size of the master seed (128, 192, or 256 bits, respectively). The length is fixed for a given amount of entropy to ensure consistency and security.
Language Support: Mnemonic phrases can be generated in multiple languages, as supported by BIP 39, which includes predefined wordlists for languages like English, Spanish, Japanese, and more. Each language has its own list, tailored to be understandable and usable by speakers of that language.
Why the need for using a Mnemonic Phrase
Transcribing a master seed can indeed be problematic due to the absence of built-in error-checking mechanisms like checksums in the raw binary or hexadecimal representations of the seed itself.
The master seed is often represented in a hexadecimal format, which poses significant challenges and risks. Hexadecimal strings are not only prone to transcription errors due to their length and complexity, but also because humans generally find it difficult to accurately handle sequences of numbers and letters (0-9, A-F) over long stretches.
Any mistake made during transcription such as miswriting a digit or letter—can lead to a completely different set of derived keys, rendering the original wallet and its contents inaccessible if the error is not identified and corrected. Since the master seed is the root from which all cryptographic keys and addresses are deterministically generated, accuracy in recording and storing it is paramount.
This challenge is one reason why the mnemonic phrase, introduced in Bitcoin Improvement Proposal 39 (BIP 39), has become a standard method for backing up cryptocurrency wallets. A mnemonic phrase converts the binary seed into a sequence of words from a predefined list, making it easier to transcribe, record, and remember. Additionally, BIP 39 incorporates a checksum into the mnemonic, which helps to validate the integrity of the seed phrase upon restoration, reducing the risk of errors during transcription.
This is why it is often recommended to use a mnemonic phrase, most wallets will just show you the mnemonic phrase and not the actual master seed. Which makes it good for backup purposes because it is both human readable and includes error detection capabilities.
Converting a Master Seed into a mnemonic phrase
The steps to convert a master Seed into a mnemonic phrase are as follows:
1) Generate or Use Your Master Seed: This is your starting point, where you either generate or use a pre-existing master seed. The size of this seed (128, 160, 192, 224, or 256 bits) directly influences the length of the mnemonic phrase generated (12, 15, 18, 21, or 24 words, respectively).
2) Generate a SHA-256 Hash of the Master Seed:* Compute a SHA-256 hash from the master seed (Result of step 1).
3) Extract the Checksum from the Hash: Use the first few bits of the SHA-256 hash (Result of step 2) as the checksum. The specific number of bits used is determined by the length of your master seed (Result of Step 1) divided by 32. For instance, a 128-bit master seed requires a 4-bit checksum (since 128 divided by 32 equals 4).
4) Append the Checksum to the Master Seed: Add the checksum (result of 3) to the end of the master Seed (result of 1). This increases the robustness of the mnemonic against transcription errors. For example if you have a 128-bit master seed and a 4-bit checksum, you end up with 132 bits in total.
5) Divide Into 11-bit Sections: Split the result from 4 (combined Master Seed and checksum) into sections of 11 bits. Each 11-bit section corresponds to a number between 0 and 2047.
6) Map to Words: Using the BIP 39 word list for the language of your choice, map each 11-bit section to a specific word. The number derived from the 11-bit section directly maps to the word’s index in the list (starting from index 0).
7) Form the Mnemonic Phrase: Combine the words in the order they were mapped (from step 6) to form the mnemonic phrase. This phrase can then be used to regenerate the master seed and, by extension, all associated cryptographic keys.
The Role of the Passphrase
The passphrase, often dubbed the “25th word,” is a customizable extension to the mnemonic seed, capable of transforming the same mnemonic phrase into entirely unique sets of wallet addresses and keys.
Security Enhancement: Acting as a form of second-factor authentication, the passphrase significantly boosts the wallet’s security. Without the correct passphrase, even if someone has your mnemonic phrase, they cannot access your funds.
Multiple Wallets Generation: Utilising different passphrases with the same mnemonic phrase enables the creation of distinct wallets. This versatility serves privacy enhancement, hidden wallet creation, and the management of separate financial accounts under a single mnemonic umbrella.
Memorability and Security: The passphrase’s effectiveness hinges on its confidentiality and remembrance. If lost or forgotten, without the passphrase, the mnemonic phrase alone cannot regain access to the wallet. It underscores the importance of choosing a passphrase that is both memorable and robust against guesswork, striking a balance between ease of recall and cryptographic security.
Voluntary Use with Integral Impact: While implementing a passphrase is optional, its adoption integrates deeply into the user’s security strategy, safeguarding against unauthorised access and offering an added layer of protection for the cryptographic assets.
Security Considerations
When dealing with cryptographic assets, the security of your master seed, mnemonic phrase, and passphrase is critically important.
The master seed and mnemonic phrase grant complete control over your assets. Anyone who gains access to these can transfer your assets to another account. Given the irreversible nature of blockchain transactions, there is no possibility of reverting or cancelling a transaction once it’s been executed.
Therefore, ensuring the confidentiality and integrity of these elements is paramount to safeguarding your digital assets against unauthorised access and potential loss.
Physical Security for Mnemonic Phrases: Write down your mnemonic phrase on a material that is resistant to water, fire, and general wear and tear, such as metal. Store it in a secure location, like a safe or safety deposit box, to prevent physical theft or damage.
Digital Security Practices: Refrain from storing your mnemonic phrase or passphrase in digital form on computers, smartphones, or online storage services that are vulnerable to hacking. If digital storage is unavoidable, use heavily encrypted files and keep them on offline storage mediums.
Passphrase Management: Treat the passphrase as an extra layer of security. It’s best memorised, but if you must write it down, store it separately from your mnemonic phrase to avoid simultaneous compromise.
Regular Backups: Make regular backups of your wallet, particularly after generating new addresses or executing transactions. Securely store backups in multiple physical locations to mitigate the risk of total loss from a single incident.
Education and Vigilance: Remain vigilant against phishing scams and malware targeting cryptocurrency users. Avoid unsolicited messages or suspicious links and stay updated with best security practices.
Use of Hardware Wallets: For significant cryptocurrency holdings, a hardware wallet is recommended. These devices store private keys offline, safeguarding them against online threats. Nonetheless, the principles of protecting your mnemonic phrase and passphrase remain crucial.