Entropy (Cryptographic Randomness)
Entropy in cryptocurrency refers to the quality of randomness used to generate private keys and seed phrases that secure digital assets.
Key Takeaways
- Entropy measures the unpredictability of the random numbers used to generate private keys and seed phrases. Higher entropy means stronger security: 128 bits of entropy makes brute-force attacks computationally impossible.
- BIP-39 seed phrases encode either 128 bits of entropy (12 words) or 256 bits (24 words). The quality of the entropy source at generation time permanently determines the security of every key derived from that seed.
- Real-world entropy failures have caused catastrophic losses: the 2013 Android wallet bug, the 2023 Milk Sad vulnerability, and brainwallet attacks all demonstrate that weak randomness can make wallets trivially breakable regardless of the cryptographic algorithms used.
What Is Entropy?
Entropy, in the context of cryptocurrency, is the measure of randomness and unpredictability in the data used to generate cryptographic keys. When you create a new Bitcoin wallet, the software must produce a random number that serves as the foundation for your private key. The quality of that randomness: the entropy: determines whether your wallet is secure or vulnerable to attack.
Think of entropy like rolling dice. A fair die has high entropy because each roll is genuinely unpredictable. A loaded die has low entropy because outcomes are biased and partially predictable. In cryptography, even slight predictability in key generation can reduce security from "unbreakable" to "trivially compromised." A Bitcoin private key requires 256 bits of entropy, meaning the random number must be selected from a space of roughly 1077 possible values.
The critical insight is that entropy is a one-time property: it matters only at the moment of key generation. Once a key is created from weak entropy, no amount of subsequent security measures can fix it. The vulnerability is baked in permanently.
How It Works
Generating a cryptographically secure key involves collecting raw randomness from physical sources, processing it through algorithms that ensure uniform distribution, and then using the result to derive keys.
Entropy Sources
Computers are deterministic machines, so they need external input to produce true randomness. Modern systems collect entropy from multiple physical sources:
- Hardware random number generators (TRNGs): dedicated circuits that measure physical phenomena like thermal noise, electrical shot noise, or clock jitter in silicon
- Operating system entropy pools: Linux collects environmental noise from keyboard timing, mouse movements, disk I/O patterns, and network interrupt timing into a kernel entropy pool accessed via
/dev/urandom - CPU instructions: Intel and AMD processors provide the
RDRANDinstruction, which generates random numbers from on-chip noise sources (Linux uses this to supplement, not replace, other entropy sources) - Physical dice rolling: some security-conscious users generate entropy by rolling physical dice and converting the results to binary, removing any dependence on software or hardware that could be compromised
From Entropy to Seed Phrase
The BIP-39 standard defines how raw entropy becomes a human-readable seed phrase. The process works as follows:
- Generate a random sequence of 128 to 256 bits from a secure entropy source
- Compute a checksum by taking the first ENT/32 bits of the SHA-256 hash of the entropy (4 bits for 128-bit entropy, 8 bits for 256-bit entropy)
- Append the checksum bits to the original entropy
- Split the combined bits into groups of 11 bits, each mapping to one of 2,048 words in the BIP-39 wordlist
Entropy bits → Checksum bits → Total bits → Words
128 → 4 → 132 → 12
160 → 5 → 165 → 15
192 → 6 → 198 → 18
224 → 7 → 231 → 21
256 → 8 → 264 → 24The resulting seed phrase is then used with a key derivation function (PBKDF2) to produce a 512-bit seed, from which an HD wallet derives all private keys and addresses using the BIP-32 hierarchical deterministic standard.
Entropy in Private Key Generation
A Bitcoin private key is a random 256-bit integer that must fall within the range [1, n-1], where n is the order of the secp256k1 elliptic curve:
n = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
This is approximately 1.158 × 10^77 possible values.For perspective, 256 bits of entropy means there are more possible Bitcoin private keys than there are atoms in the observable universe (estimated at roughly 1080). Brute-forcing a properly generated key is not just impractical: it is physically impossible with any conceivable technology.
Real-World Entropy Failures
The theory of cryptographic entropy is straightforward: use enough random bits and keys are unbreakable. In practice, implementation bugs and design shortcuts have repeatedly undermined this guarantee, resulting in significant financial losses.
Android Bitcoin Wallet Bug (2013)
In August 2013, a critical flaw was discovered in Android's Java Cryptography Architecture. The SecureRandom class did not properly initialize its pseudorandom number generator, causing the ECDSA signing algorithm to reuse nonce values when generating digital signatures.
When two signatures share the same nonce but use the same private key, an attacker can algebraically recover the private key from the two signatures. Multiple Bitcoin wallets were affected, including Bitcoin Wallet for Android, Blockchain.info, BitcoinSpinner, and Mycelium. The vulnerability was patched by explicitly seeding the PRNG with entropy from /dev/urandom.
Milk Sad Vulnerability (2023)
The Milk Sad vulnerability (CVE-2023-39910), disclosed in August 2023, affected the Libbitcoin Explorer (bx) tool versions 3.0.0 through 3.6.0. The bx seed command used the Mersenne Twister PRNG seeded with only 32 bits derived from the system clock.
Even when users requested 256 bits of entropy, the tool could only produce 232 (approximately 4.3 billion) unique seeds. This is a brute-forceable space: an attacker with a standard gaming PC could enumerate all possible seeds in a matter of days. Over 2,600 wallets were identified as vulnerable, with estimated losses exceeding $900,000 across Bitcoin, Ethereum, and other blockchains.
Brainwallet Attacks
Brainwallets derive private keys by hashing a user-chosen passphrase. The fundamental problem is that human-memorable phrases contain far less entropy than the 256 bits required for secure key generation. A four-word English phrase chosen from a 200,000-word dictionary provides roughly 70 bits of entropy: strong by password standards but catastrophically weak for a cryptocurrency private key.
Attackers build rainbow tables from dictionaries, leaked password databases, famous quotes, song lyrics, and other predictable sources. Modern GPUs can test billions of candidate passphrases per second. Funds sent to brainwallet addresses derived from common phrases are typically stolen within minutes by automated scanning bots.
Use Cases
Entropy is not a feature users interact with directly, but it underpins every security-critical operation in cryptocurrency:
- Wallet creation: generating the initial seed or private key that secures all funds, whether for a cold storage setup or a mobile hot wallet
- Transaction signing: ECDSA signatures require a fresh random nonce for each signature to prevent private key recovery (the root cause of the Android bug)
- Key derivation: HD wallets use the initial entropy to derive an entire tree of keys, so entropy quality at the root propagates to every derived address
- Hardware security modules: signing devices and secure elements contain dedicated TRNGs to generate entropy in tamper-resistant environments
- Protocol-level randomness: Lightning Network HTLCs use random preimages, and cryptographic protocols like FROST require random nonces during the signing process
Risks and Considerations
Silent Failure Mode
Entropy failures are uniquely dangerous because they are invisible at the time they occur. A wallet generated with weak entropy looks and functions identically to one generated with strong entropy. There is no error message, no warning, and no way to detect the weakness by examining the key itself. The vulnerability only becomes apparent when an attacker exploits it.
Supply Chain Risks
Users must trust that their wallet software or hardware uses a proper entropy source. A compromised random number generator in a wallet application, operating system, or hardware device could systematically generate weak keys across all users. This is why cold storage devices use dedicated, auditable TRNGs and why open-source wallet implementations allow independent verification of entropy handling. For a deeper look at how wallet infrastructure handles key generation, see the Bitcoin wallet SDK comparison.
Quantum Computing Considerations
While quantum computers threaten some cryptographic algorithms (like ECDSA via Shor's algorithm), they do not reduce the entropy of a properly generated random number. Grover's algorithm could theoretically halve the effective entropy (256 bits becomes 128 bits of equivalent security), but 128 bits remains far beyond any practical attack. The real quantum threat to Bitcoin is in the signature scheme, not the entropy of key generation. For more on this topic, see the research on post-quantum cryptography and Bitcoin.
Best Practices
To ensure adequate entropy when generating cryptocurrency keys:
- Use well-audited, open-source wallet software that sources entropy from the operating system's CSPRNG (
/dev/urandomon Linux,CryptGenRandomon Windows) - Prefer hardware wallets with dedicated TRNGs for key generation, especially for high-value storage
- Never generate keys from memorized passphrases, dictionary words, or any human-predictable source
- Verify that wallet software uses 128 bits of entropy at minimum (12-word seed phrase) or 256 bits (24-word seed phrase) for maximum security
- Consider physical entropy methods (dice rolling) for generating seeds used in long-term cold storage, following guides from trusted sources
This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.