Brute Force Bitcoin

Blog

Could Two People Get The Same Key?

The birthday paradox says coincidences come sooner than you think. Here is how much sooner, and why it still does not reach anyone’s wallet.

Put 23 people in a room and the odds are better than even that two of them share a birthday. It feels wrong because you are not asking whether someone shares your birthday. You are asking whether any pair matches, and the number of pairs grows much faster than the number of people.

The same thing happens with keys, which raises a fair question. Every wallet in the world picks its keys at random. Could two of them ever pick the same one?

The rule of thumb

If k things are picked at random from N possibilities, the chance that any two match is about k² ÷ 2N, as long as that answer is small. For birthdays, 23² ÷ (2 × 365) is about 0.7, which is why the real answer is a little over a half.

For private keys, N is 2256. Suppose every person alive made a million keys: 8.2 × 1015 keys in all. The chance that any two of them are the same is about 3 × 10-46. Nobody will ever share a key by accident.

Addresses are smaller, 2160, so the same million keys each give a chance that any two share an address of about 2 × 10-17. Still nothing. You would need around 280 keys, roughly 1024, before two random keys sharing an address became likely.

And even then

That collision would be between two random keys that nobody was using. The birthday paradox helps when any pair will do. A guesser does not want any pair. They want their key to match an address that already holds money, which is the "your birthday" question, not the "any birthday" one. The birthday shortcut does not apply to it at all.

The every-visitor box

The board keeps a running total of every key tried by everyone who has pressed Start on this site. Each browser reports one number every 15 seconds: how many keys it got through. No key, address or identifier goes with it.

"Chance any of them hit" is that total multiplied by the chance per key. Multiplying is allowed here because the answer is so small; strictly the chance is 1 − (1 − p)n, and for any total this site could ever reach the two agree to more decimal places than anyone will read. It goes up as people run the page. It will stay a number with a very large exponent for the life of the site.

Next: What Actually Breaks Bitcoin Wallets