In our crowded Blockchain Bar, not everyone can hear and record all orders. Very often, there are different versions of the order records.
Oscar insists: “My list is 100% correct.”
Bob replies: “Everybody knows you’re bad at arithmetics! We should take MY list.”
Alice calms everybody down: “No problem! From the next round on, we will just use the list of the person who finishes the fingerprint calculation first. If the transactions and fingerprint on that list are correct, we all make a copy, accept it as the correct version and discard our own version of the last page.”
In the Bitcoin system, all computers compete in building the very next block of transactions. The winner in doing many complex computations correctly has the right to create the new block. All other computers in the network will accept it as the correct version of the truth. This is called ‘consensus mechanism’.
Consensus mechanisms help to agree on a shared truth
If everyone orders beer all the time in a crowded bar, the guests could miss some orders when keeping their lists. And of course, they might hear the orders from other guests in a different order. Both, missing orders and writing them down in a different order lead to differing versions of the drinking list. Differing lists are to be avoided, because the purpose of the drinking list (and of blockchains) is that everyone has the same view on reality. Everyone should have the same version of the ‘truth’.
An easy solution to that problem is to declare one version of the last page of the drinking list as the collective ‘truth’ from time to time. Every time they reach the end of a page, the guests select one of them as a ‘winner’ and declare his version of the last page as the ‘definitive’ drinking list. The winner copies his list and gives it to everyone else. They all check whether the winner has noted all orders correctly and if the winner’s ‘chaining’ calculation is right. If everything is fine, they add the winner’s version of the last page to the end of the writing pad and discard their own versions of the last page.
Then all orders on that winning last page are fulfilled and everyone gets the drinks listed on that definitive version of the latest orders. Before the guests begin with a new last page, everyone has the same version of the truth now.
But how to select the winner? The guests agree that the one who can finish a whole page of orders AND the resulting calculation of the chaining calculation first should be the winner of a round. Doing all the calculations is real work. So you have to invest work if you want to become the winner. You have to prove that you have done your work by coming up with the right ‘fingerprint’ of the data. This is the reason why that kind of consensus mechanism is called ‘proof-of-work (PoW)’ consensus.
Real blockchain versions have the same problems and very similar solutions. The computers in decentralised systems receive transactions in a different order. And sometimes, transactions are ‘lost’ because computers or network connections fail or are too slow to keep up with the rest of the system.
Imagine two Bitcoin users, one in London, England, the other one in Sydney, Australia. They both send a new transaction (payment) to the network at the same time. Now imagine two Bitcoin server computers, called ‘miners’ – one in Singapore, the other one in Reykjavik, Iceland.
Although the messages on the Internet travel at the speed of light, they still take at least some time to reach their destination on a planet as big as the Earth. The message from Sydney to Singapore will travel at least 21 milliseconds. From London to Singapore it will take roughly twice as long. And of course, the message from London will arrive much earlier in Reykjavik than the one from Sydney.
So the two miners in Reykjavik and Singapore will receive the transactions in a different order and will therefore record different versions of the ‘truth’.
Bitcoin also has a mechanism to define the winner of the last page or last block. Because computers are so good at doing calculations, Bitcoin’s calculations to determine the winner have to be much more complex than the ones in our Blockchain Bar. If the calculations were easy, all miners would come up with the right answer at practically the same time. Therefore, Bitcoin requires the miners to do very complex calculations that require on average 10 minutes for each new block.