BIP-39 is a protocol used to generate a secure, human-readable backup of private keys for cryptocurrency wallets.
Instead of long, complex strings of numbers and letters that form a private key, BIP-39 generates a list of 12 to 24 simple English words called a mnemonic seed phrase.
This phrase can then be used to regenerate the wallet’s private keys, providing a secure and convenient way to recover a wallet if it’s lost or damaged.
Features
- Mnemonic Phrases: BIP-39 replaces cryptographic complexity with a list of simple words, making it easier for users to back up and restore their wallets.
- Human-Readability: The use of words makes BIP-39 both accessible to users and resilient to transcription errors. Seed phrases can be generated in any language such as English, Mandarin, Spanish, Hindi, German and Japanese.
- Deterministic Key Generation: A single seed phrase can regenerate multiple private keys, simplifying wallet management for users and developers. This is how multi-token wallets like Trust Wallet work.
Working
To understand BIP-39’s functionality, let’s break down the process into technical steps:
Step 1: Entropy Generation
When creating a new wallet, BIP-39 starts by generating a random number, called entropy, which typically contains 128, 160, 192, 224, or 256 bits of randomness. This entropy is the foundation for the security of the generated seed phrase.
Step 2: Adding a Checksum
The entropy is then hashed with SHA-256 to generate a checksum, which is a short binary sequence added to the entropy. This checksum verifies the integrity of the mnemonic phrase, protecting it against transcription errors. For example, a 128-bit entropy will yield a checksum of 4 bits, while a 256-bit entropy yields an 8-bit checksum.
Step 3: Converting Entropy to Words
Next, the entropy plus checksum is split into 11-bit sections, each representing a word in the standardized BIP-39 wordlist. This results in 12, 18, or 24 words for the mnemonic seed phrase.
Step 4: Converting the Mnemonic Phrase to a Seed
The mnemonic phrase can then be converted into a 512-bit seed using the PBKDF2 (Password-Based Key Derivation Function 2) algorithm with HMAC-SHA512. This seed can be used to generate a master private key for a hierarchical deterministic (HD) wallet, which can then create multiple private and public key pairs.
Step 5: Hierarchical Deterministic (HD) Wallets
The 512-bit seed is compatible with HD wallets, allowing the seed phrase to generate many keys and addresses from one mnemonic. This makes it easy to organize funds under a single phrase, where each new private key or address can be derived from the master key without creating new backups.
Importance
- Backup and Recovery: BIP-39 seed phrases simplify wallet recovery, providing a backup method that even new crypto users can understand.
- Cross-Wallet Compatibility: The BIP-39 standard ensures compatibility across multiple wallet providers, allowing users to restore wallets on any BIP-39-compliant application.
- Security: By using entropy and cryptographic checksums, BIP-39 creates a high level of randomness and security, making it highly resistant to hacking attempts.
Drawbacks and Concerns
While BIP-39 is widely adopted, there are some considerations users should keep in mind:
- Mnemonic Vulnerability: If a seed phrase is discovered or compromised, anyone can recreate the wallet and access its funds.
- Physical and Digital Security: Users need to ensure that seed phrases are stored securely, away from prying eyes or insecure devices, ideally offline and in multiple physical locations.
- Non-Unique Recovery Phrases: Not all wallets handle BIP-39 compatibility in the same way, so a mnemonic phrase in one wallet may not work perfectly in another without specific parameters.
Best Practices for Storing and Using Seed Phrases
To maximize the security of BIP-39 seed phrases, follow these best practices:
- Store Offline: Never store a seed phrase in digital form or on any connected device. Write it down and keep it in a secure, fireproof, and waterproof location.
- Consider Redundancy: For additional security, consider creating multiple copies of the seed phrase, stored in separate locations.
- Beware of Phishing and Fake Wallets: Only enter seed phrases into trusted, BIP-39-compliant wallets to avoid phishing attacks.