A Bitcoin private key is a number. Not a metaphor for a number, not a token that stands for one — an actual number, so large that no computer on Earth, nor all of them together, will ever count to it. If that number is chosen properly, guessing it is not hard, not expensive, not impractical: it is not going to happen, the way filling a thimble by waiting for the ocean to jump into it is not going to happen. The arithmetic of that safety is simple enough for a child to check, and this book checks it.
And yet Bitcoin keys get stolen. Not often, not randomly, and never by guessing the number — but stolen all the same, in ways that make the news or quietly empty a wallet at 3 a.m. Every one of those thefts has the same shape when you open it up: the number was fine, and the choosing of the number was not. Somebody's phone had a wounded random number generator. Somebody made a key out of a song lyric. Somebody's signing software rolled the same dice twice. The vault door held; the weakest link snapped somewhere else, and the weakest link is always the randomness.
That is what this book is about. Entropy — the degree to which a choice is genuinely, measurably unguessable — is the one property your Bitcoin security cannot do without and the one almost nobody teaches. Probability is the language entropy is measured in, and counting is where probability comes from. So the road runs: counting, then chance, then entropy, then the key, then the failures, then the defense.
The method of this book is Bitcoin's own: don't trust, verify. Every number printed in these pages is computed, and most can be regenerated with four lines of Python printed right beside them. When the book says there are \(2^{132}\) twelve-word phrases, you can multiply it out yourself. When it says a thief's million tries at a one-in-a-million lock buy about a 63% chance, you can run the experiment — Chapter 3 runs it. The habit this book wants to leave you with is exactly that one: check it, don't take it.
No mathematics beyond arithmetic is assumed. Every symbol is built on the page before it is used, and the one time the book needs a formula from elsewhere, it says so and says where.
Part I, Chance (Chapters 1–3), builds the toolkit from zero: counting outcomes, turning counts into probabilities, and the arithmetic of "how many tries until the thief expects to win." Part II, Entropy (Chapters 4–6), measures surprise itself — Shannon's measure, the attacker's measure, and where real randomness physically comes from. Part III, The Key (Chapters 7–8), meets the 256-bit number and prices the guessing game honestly. Part IV, When Randomness Fails (Chapters 9–10), autopsies the real thefts — brainwallets, broken generators, the nonce catastrophe. Part V, Protecting the Key (Chapters 11–12), turns all of it into practice: seed phrases done right, and the operational checklist.
Read the chapters in order; each leans on the ones before it. Every chapter ends with exercises, graded by difficulty stars (★ to ★★★), followed by solution sketches — enough to check your reasoning against, not model answers to copy. The computational exercises embed their expected outputs, so you always know whether your machine agrees with the book. Boxes marked The Idea in Code hold short, runnable Python; run them. If you take one habit away, let it be this: check it, don't take it.