Why does everyone spend resources doing the calculation when they know that someone else will calculate and announce it to them? Why not sit idle and wait for the announcement?
Great question. This is where the incentives come in the picture. Everyone who is the part of the Blockchain is eligible for rewards. The first one to calculate the sealing number gets rewarded with free money for his efforts (i.e. expended CPU power and electricity).
Simply imagine, if
#5 calculates the sealing number of a page, he gets rewarded with some free money, say $1, that gets minted out of thin air. In other words, the account balance of `#5` gets incremented with$1 without decreasing anyone else’s account balance.
That’s how Bitcoin came into existence. It was the first currency to be transacted on a Blockchain (i.e. distributed registers). And in return for keeping the efforts going on in the network, people were awarded Bitcoins.
When enough people possess Bitcoins, they grow in value, making other people want Bitcoins; making Bitcoins grow in value even further; making even more people wanting Bitcoins; making them grow in value even further; and so on.
The rewards make everyone keep working in the network.
And once everyone tucks away the page in their folders, they bring out a new blank page and repeat the whole process all over again — doing it forever.
[Jargon Box] Think of a single page as a Block of transactions and the folder as the Chain of pages (Blocks), therefore, turning it into a Blockchain.
There is one final piece to blockchains.
Imagine there are five pages in the folder already — all sealed with a sealing number. What if I go back to the second page and modify a transaction to favor myself? The sealing number will let anyone detect the inconsistency in the transactions, right? What if I go ahead and calculate a new sealing number too for the modified transactions and label the page with that instead?
To prevent this problem of someone going back and modifying a page (Block) as well as the sealing number, there’s a little twist to how a sealing number is calculated.
Remember that there were two boxes — one containing the number 20893 and another empty for you to calculate? In reality, to calculate the sealing number in a Blockchain, instead of two boxes, there are three — two pre-filled and one to be calculated.
And when the contents of all those three boxes are added and fed to the machine, the answer that comes out from the right side must satisfy the required conditions.
We already know that one box contains the list of transactions and one box will contain the sealing number. The third box contains the output of the magic machine for the previous page.
With this neat little trick, we have made sure that every page depends on its previous page. Therefore, if someone has to modify a historical page, he would also have to change the contents and the sealing number of all the pages after that, to keep the chain consistent.
If one individual, out of the ten we imagined in the beginning, tries to cheat and modify the contents of the Blockchain (the folder containing the pages with the list of transactions), he would have to adjust several pages and also calculate the new sealing numbers for all those pages. We know how difficult it is to calculate the sealing numbers. Therefore, one dishonest guy in the network cannot beat the nine honest guys.
What will happen is, from the page the dishonest guy tries to cheat, he would be creating another chain in the network, but that chain would never be able to catch up with the honest chain — simply because one guy’s efforts and speed cannot beat cumulative efforts and speed of nine. Hence, guaranteeing that the longest chain in a network is the honest chain.
Longest chain is the honest chain (red one in the above image).
The double spending problem results when a user can spend some money more than once, but as we saw above, it is computationally infeasible to modify a previous transaction. This irreversible property of the blockchain solves the double spending problem.
In that case, the protocol will fall flat on its face. And it is known as 51% Attack. If the majority of the individuals in the network decides to turn dishonest and cheat the rest of the network, the protocol will fail its purpose.
And that’s the only reason why Blockchains might collapse if they ever will. Even though it is unlikely to happen, it is still important to acknowledge the vulnerable points of the system. It is built on the assumption that the majority of a crowd is always honest.