Understanding Bitcoin: the childhood game that rules the network

Its a childhood classic, “guess what number I’m thinking of”. Its funny to think, but Bitcoin is basically a computerised version of that game.

In the childhood game, you may play with a friend and state that the number is between 1 and 10: in this case each round of the game won’t last long. How could you make the game longer? Easy, by increasing the difficulty to make them guess a number between 1 and 500.

Let’s say ideally you want a game to last for 10 minutes, and you have 5 players. If each player can make 60 guesses per minute, in 10 minutes each person will make 600 guesses, that’s 3000 between the group. Double this number and you know that for the game to last around 10 minutes, your target difficulty is a number between 1 and 6000.

This simple game has advantages, as long as nobody can know what number you might be thinking of, it is impossible to cheat. The only advantage that can be gained is through guessing more quickly than the other players. The more guesses you can make, the more likely you are to win.

In Bitcoin this game is played is to decide who processes the last 10 minutes worth of transactions. The winner creates a block of transactions, adds it to the blockchain, and is rewarded with (currently) 25 Bitcoins.

By playing a game that is impossible to cheat, it prevents attacks against the network, as anybody who wants to maliciously attack the network would need to be able to make over 50% of the guesses.

In Bitcoin terminology, the number being guessed is called a nonce, and guessing is called hashing. A hash rate is basically a guess rate.

Hashing sounds complicated, but it really isn’t, its just a way to turn any information into an unpredictable sequence of letters and numbers.

As an example, I’ll invent a simple hash method that converts any number into a completely different but unpredictable number.

For my method, you prefix the chosen number with 98765 and then divide the number by 4321. You then multiply the 1st-5th by the 6th-10th digits after the decimal point to get a hash.

This is completely made up, so don’t worry if you don’t follow, but it would produce the following demonstration hashes:
45 = 6660386432
(Method: 9876545/4321 = .7081694052 = 70816 * 94052)
100 = 2955753
(Method: 98765100/4321 = .0006942837 = 00069 * 42837)

This would be a disastrous, collision-ridden hash for Bitcoin, which uses a far superior method called SHA-256 – but it demonstrates the principle that you can turn anything into an unpredictable hash that everyone can independently verify for themselves.

With my hash, as with Bitcoin, I can set a difficulty level. Let’s say I require the first 5 digits of the hash to be ‘11111’ (Bitcoin uses zeroes).

With my method the number 74340 would produce a hash of the target difficulty:
74340 = 111110100
(Method: 9876574340/4321 = .9595001158 = 95950 * 01158)

This cannot be cheated, you can’t predict a number which will produce a hash beginning ‘11111’. You (your machine) simply has to keep guessing until finding one that successfully matches. This is where ‘proof of work’ comes from – finding a matching number proves you have done work and once you’ve guessed correctly you can tell everybody your number and they can check it for themselves.

Back to our kids ‘guess the number’ game there is one common problem: cheating. If your friend guesses correctly but you don’t want to relinquish control you can say ‘wrong’. If you pick a number and tell your friend what to guess – they can secure victory on their first guess. This would have disastrous implications for Bitcoin where the reward is the currency itself.

Hashing solves the problem of who is in charge of deciding the number because there is no number, just a difficulty level – everybody just keeps guessing until they find a hash that satisfies it and they get to broadcast their proof and claim their reward.

The Bitcoin network constantly adjusts its own difficulty level so that on average one correct guess is made (hash is found) every 10 minutes.

The processing power that goes into generating these hashes is mind boggling. A group of researchers tried to estimate the number of grains of sand in the world – every grain of every desert and beach. Their estimate was 7.5 x 1018 grains of sand – seven quintillion, five hundred quadrillion.

Currently the Bitcoin network takes just 6 seconds to make as many guesses as their are grains of sand on earth and only one of those guesses is correct every 10 minutes. That’s one hell of a game.

John Hardy
Follow me

John Hardy

Software developer living in UK.
Longtime Bitcoin advocate.
Email [email protected]
Donations welcome: 1H2zNWjxkaVeeE3yX6uVqng5Qoi6gGvYTE
John Hardy
Follow me

Author: John Hardy

Software developer living in UK. Longtime Bitcoin advocate. Email [email protected] Donations welcome: 1H2zNWjxkaVeeE3yX6uVqng5Qoi6gGvYTE