--:--:-- UTCF&G--QUIET-
A cascade of dice falling through darkness, each face lit like a bit being decided.

THE CIPHER SCHOOL · MODULE 03 OF 08FIRST PRINCIPLES

Entropy

256 coin flips between you and ruin.

At half past one in the morning, UTC, on 30 July 2026, bitcoin began leaving wallets whose owners had done everything right. The coins sat behind Coldcards — air-gapped hardware, the paranoid's choice — on devices powered down in safes and drawers. In twenty-five minutes, inside a window of just three blocks, roughly 594 BTC drained from some 500 single-signature wallets: about $38 million, moved by an attacker who never touched a single device, planted no malware, and phished no one. The keys had simply been computed. Five years earlier, one line of firmware had checked whether a build flag was defined instead of whether it was switched on — and every seed those devices generated had been quietly born guessable. The cryptography never broke. The randomness beneath it did.

§ § §

Entropy is the honest measure of a secret: how many fair coin flips of unpredictability actually went into it. A key with n bits of entropy forces an attacker's best strategy to around 2ⁿ guesses, and the numbers Bitcoin aims for sit beyond physical intuition. A 12-word seed carries 128 bits: 2¹²⁸ is 3.4 × 10³⁸, and if the entire Bitcoin mining network — around 10²¹ guesses per second in 2026 — were turned to key-guessing, exhausting that space would take roughly 10.8 billion years, most of the age of the universe, for one key. A 256-bit key lives in the same neighbourhood as the count of atoms in the observable universe. Guessing is not the threat. The threat is that far fewer coin flips went in than the format advertised.

Here is the trap: entropy is a property of the process, never of the output. Every 24-word seed phrase looks identical — same wordlist, same format, same confident 256-bit costume — whether it came from genuine hardware randomness or from a 32-bit timestamp. A seed generated from 32 bits of clock has 32 bits of entropy dressed as 256, and nothing about it will ever look wrong. The wallet derives valid addresses, signs valid transactions, and works perfectly for years. Weak entropy has no symptom. There is no error message, no odd behaviour, no warning — just a keyspace small enough to enumerate, waiting. The failure announces itself exactly once, in the only way it can: everyone's funds move at the same time, to addresses nobody recognises.

The Coldcard bug is a masterclass in how this happens to careful people. The firmware wraps the STM32 chip's hardware random-number generator, and the board configuration defines the flag MICROPY_HW_ENABLE_RNG as 0 — deliberately disabled, because the wrapper supplies its own path. But the guard in Coinkite's library checked whether that flag was defined, not whether it was enabled. Defined it was — as zero — so the check passed and the code silently bound to the fallback: Yasmarang, MicroPython's deterministic software PRNG, seeded from values that are not secrets at all — the low 32 bits of the chip's unique ID, a ticking SysTick down-counter, and the real-time clock's registers. The swap shipped in firmware 4.0.0 in March 2021 and sat in the wild, on the industry's most security-obsessed device, for over five years.

How weak were the seeds? Honesty requires reporting a dispute. Coinkite's advisory says Mk4, Mk5 and Q devices produced seeds with about 72 bits of entropy instead of the intended 128, because boot-time reseeding mixed in secure-element randomness. Block's engineers, who traced the root cause, read the same code less kindly: the reseed hashes that randomness and retains only four bytes, so at most 2³² distinct output streams exist — a ceiling near 32 bits. For the older Mk2 and Mk3, both agree it is worse: with the device's UID and timer state known, generation is close to fully deterministic. At the time of writing, roughly 1,367 BTC — about $89 million — has been swept across three attack waves. Every confirmed victim ran single-sig with device-generated entropy; seeds made from dice rolls, and wallets behind strong passphrases, were untouched.

If this were a one-off, it would be an anecdote. It is a genre, and its recurring number is 32. In 2023, Libbitcoin Explorer's seed command — the "Milk Sad" flaw, named for the first words of its timestamp-zero mnemonic — seeded a Mersenne Twister with 32 bits of clock; about $900,000 was swept. Trust Wallet's browser extension: same generator, same 32-bit seed, roughly $170,000 gone. Profanity, an Ethereum vanity-address tool, expanded 32-bit seeds into 256-bit keys and cost the market-maker Wintermute around $160 million. Cake Wallet: Dart's PRNG, 32 bits again. Further back, Debian's 2008 OpenSSL patch left about 15 bits, and Android's 2013 SecureRandom failures let thieves lift keys straight off the chain. Different products, different years, one anatomy: a 256-bit format fed by a guessable process.

So where can honest randomness come from? Not from your head: humans asked to "be random" manage one or two bits of entropy per character, and every brainwallet — a key derived from a human-chosen phrase — has fed a cracking industry that sweeps them in minutes. Not from inspection, either: a deterministic stream stretched from a hidden 32-bit seed passes every statistical test, so no test suite can certify a CSPRNG, and a backdoored generator — NIST withdrew one, Dual_EC_DRBG, in 2014 — hides in plain sight. Machines must be caught lying, and mostly they cannot be. The one escape hatch is dice entropy: a fair die yields log₂ 6 ≈ 2.585 bits per roll, so 50 rolls exceed 128 bits and 99 approach 256 — randomness you witnessed with your own eyes. Coldcard owners who seeded from dice were the ones the attack could not touch.

INTERACTIVE · THE ENTROPY LAB

Try to be random. You will lose.

Mash the pad or type the most random string you can manage, then compare your haul of unpredictability against a single call to the machine’s hardware random number generator.

YOUR RANDOMNESS
0 characters typed
raw Shannon estimate: 0 bits
after pattern & keyboard penalties: 0 bits
THE MACHINE’S
generating…
one call to crypto.getRandomValues
effective entropy: 256 bits, by construction
TIME TO CRACK · AT 10¹² GUESSES PER SECOND
YOURS · ~0 bitsinstant
THE MACHINE’S · 256 bits3.7 × 10^57 years
20 bits · a human "random" wordinstant — under a millisecond
32 bits · the 32-bit club4 milliseconds
40 bits · a strong human passphrase1.1 seconds
64 bits214 days
128 bits · a 12-word seed1.1 × 10^19 years
256 bits · a 24-word seed3.7 × 10^57 years

This is the Coldcard lesson: the finished key always looks like 256 bits — a full-length string of perfectly plausible hex. What matters is how many honest coin flips actually went in. A 256-bit format wrapped around 32 bits of input is a 32-bit key in fancy dress.

LESSON · TRUE ENTROPY OF HUMAN INPUT IS UNMEASURABLE — THESE ESTIMATES ARE GENEROUS UPPER BOUNDS, AND YOU STILL LOST

Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin.

John von Neumann, Various Techniques Used in Connection with Random Digits · 1951

The generation of random numbers is too important to be left to chance.

Robert R. Coveyou, Studies in Applied Mathematics · 1969

INTERACTIVE · THE RNG GRAVEYARD

10funerals for “random” numbers.

Every headstone below promised 256 bits of randomness. Every one delivered something a laptop, or a lunch break, could enumerate.

2008
Debian OpenSSL PRNG
A patch silenced a compiler warning by removing the entropy-mixing lines; only the process ID still varied the seed.
~15 BITS (32,767 POSSIBLE KEYS PER ARCHITECTURE)
Pre-Bitcoin — a systemic compromise of SSH and SSL keys worldwide, still being found in the wild years later.
One well-meaning line of code can silently void a whole cryptosystem, and nothing looks wrong from outside.
SOURCE ↗
2010
PS3 ECDSA static nonce
Sony signed every firmware with the same ECDSA nonce k. Two signatures sharing a nonce algebraically reveal the private key.
0 — THE NONCE WAS A CONSTANT
The console's master code-signing key, extracted on stage by fail0verflow.
Randomness matters at signing time too: a perfect key is forfeit the moment its nonces repeat.
SOURCE ↗
2011–2015
Brainwallets
Keys derived by hashing human-chosen passphrases — song lyrics, quotations, "secret" sentences.
WHATEVER A HUMAN MIND PRODUCES — OFTEN UNDER 40 BITS
250+ BTC demonstrated cracked by Brainflayer alone; sweeping bots still drain funded brainwallets within seconds.
Human memory is not an entropy source. Nothing a mind would choose survives an adversary with a GPU.
SOURCE ↗
2013
Android SecureRandom
Android's SHA1PRNG could initialise unseeded, so wallet apps generated colliding keys and reused ECDSA nonces.
INTERMITTENTLY ~0
55+ BTC confirmed swept before wallets patched and rotated keys.
Every wallet on a platform inherits that platform's randomness — and its failures.
SOURCE ↗
2014
blockchain.info web wallet
A botched update broke the client-side RNG fallback, producing repeated ECDSA nonces in the browser.
INTERMITTENTLY ~0
~267 BTC — swept by a white-hat who returned the coins.
The window between a bug shipping and a thief noticing is measured in hours. This time the fast one was friendly.
SOURCE ↗
2020–2021THE 32-BIT CLUB
Cake Wallet
Seeds generated from Dart's PRNG seeded with a 32-bit value.
~32 BITS
Not consolidated publicly; affected seeds required rotation.
A friendly app UI says nothing about where its randomness comes from.
SOURCE ↗
2022THE 32-BIT CLUB
Profanity → Wintermute
The Ethereum vanity-address tool expanded a 32-bit seed into "random" 256-bit keys; GPUs re-enumerated the space.
~32 BITS
~$160M from Wintermute's vanity hot wallet, plus ~$1M from others.
A pretty address bought with weak entropy is a bounty poster. Vanity generators concentrate exactly the risk they hide.
SOURCE ↗
2022–2023THE 32-BIT CLUB
Trust Wallet extension
The browser extension's WASM build drew keys from MT19937 seeded with a single 32-bit value.
~32 BITS
~$170,000 across affected users; every address from the flawed build had to be abandoned.
Mersenne Twister is a statistics tool, not a cryptographic one — and 2³² is a lunch break for modern hardware.
SOURCE ↗
2023THE 32-BIT CLUB
Milk Sad (bx seed)
Libbitcoin Explorer's `bx seed` seeded MT19937 with 32 bits of wall-clock time. Researchers enumerated every possible wallet.
~32 BITS
~$900,000 across multiple coins from ~2,600 confirmed wallets.
The tool even warned it was for "demonstration" — nobody reads the manual after the coins arrive safely the first time.
SOURCE ↗
2026
Coldcard
A macro-check bug in libngu silently bypassed the hardware RNG, seeding keys from a weak PRNG fed by chip UID and timers.
MK3 ≤16 BITS; MK4/MK5/Q DISPUTED, ~32–72 BITS
~$38M swept in the first 25 minutes; ~1,367 BTC (~$89M) across three waves within days.
Five years in the field, from a security-first vendor, on an air-gapped device. Verification, not reputation, is the safeguard.
SOURCE ↗

Note the recurring badge: four independent teams — Cake Wallet, Profanity, Trust Wallet, Libbitcoin — collapsed 256-bit keyspaces to the same 2³² with the same class of mistake, seeding a general-purpose PRNG with a single 32-bit value.

LESSON · EVERY ONE OF THESE KEYS LOOKED PERFECTLY RANDOM FROM OUTSIDE. THE FORMAT NEVER TELLS YOU WHERE THE BITS CAME FROM.

READING LADDER

Climb at your own pace.

SIGN IN TO CHECK OFF READS
Beginner
Inventing Bitcoin
Yan Pritzker · 2019
The gentlest complete tour of why keys, seeds and randomness fit together.
Intermediate
Mastering Bitcoin (3rd ed.)
Antonopoulos, Osuntokun & Pickhardt · 2023
Chapters 4–5 cover exactly how keys and seeds are generated from entropy.
Grokking Bitcoin
Kalle Rosenbaum · 2019
Illustrated derivations that make the entropy-to-key pipeline visible.
Deep
Serious Cryptography (2nd ed.)
Jean-Philippe Aumasson · 2024
Chapter 2, "Randomness", is the definitive practitioner treatment of RNGs and their failures.

FIELD TEST · SIGN-IN REQUIRED

Take the quiz. Track the curriculum.

The module text is open to everyone: no account required to read. The 3-question field test and the curriculum-wide graduation stamp need a free account so we can record your progress.

SIGN IN TO TAKE THE QUIZ

FREE · NEW ACCOUNT TAKES 30 SECONDS