Inside the blockchain developer’s mind: Blockchain consensus, Part 1
Cointelegraph is following the development of an entirely new blockchain from inception to mainnet and beyond through its series, Inside the Blockchain Developer’s Mind. In previous parts, Andrew Levine of Koinos Group discussed some of the challenges the team has faced since identifying the key issues they intend to solve and outlined three of the “crises” that are holding back blockchain adoption: upgradeability, scalability, and governance. This series is focused on the consensus algorithm: part one is about proof-of-work, part two is about proof-of-stake and part three is about proof-of-burn.
In this article, I want to leverage my unique perspective to help the reader gain a deeper understanding of a popular concept in blockchain technology, but also one that is woefully misunderstood: the consensus algorithm.
In order to gain a deep understanding of this component of a blockchain, one of the things I always like to do in these articles is begun by taking a step back and looking at the big picture because the consensus algorithm is just one small part of a much larger system.
Blockchains are a game in which players compete to validate transactions by grouping them into blocks that match the blocks of transactions being created by other players. Cryptography is used to hide the data that would allow these people to cheat. A random process is used to distribute digital tokens to people who play by the rules and produce blocks that match the blocks submitted by other people. These blocks are then chained together to create a verifiable record of all the transactions that were ever performed on the network.
When people produce new blocks with different transactions in them, we call this a “fork” because the chain is now forking off into two different directions. This is the exact opposite of what we want to happen. The whole value of a blockchain stems from the fact that everyone agrees — has come to a consensus — on what transactions happened when. Consensus algorithms are therefore intended to resolve forks.
Satoshi’s real innovation
At the end of the day, what ensures that everyone updates their database to match one another boils down to how they are punished when they do not. The protocols contain rules for the proper ordering of transactions, but if there is no repercussion for violating those rules, they will be ineffective. The real innovation that Satoshi Nakamoto delivered in the Bitcoin (BTC) white paper was his elegant use of economic incentives.
Satoshi Nakamoto did not invent the idea of the “electronic coin.” He created an elegant system for combining cryptography with economics to leverage electronic coins, now called cryptocurrencies, to use incentives to solve problems that algorithms alone cannot solve. His design forced people to sacrifice money in order to mine blocks of transactions. People would have to sacrifice this money over and over and over by playing by the system’s rules and trying to organize transactions into blocks that would be accepted by everyone else in the network. If they did this long enough, they would receive a reward in the currency of the platform.
Of course, there’s no way for the blockchain to know that money was spent in the form of USD, yen, or euro, which is why he used a proxy in the form of meaningless work. He made the mining of blocks unnecessarily hard so that anyone who successfully mined a block necessarily must have spent money on hardware and the energy to run that hardware. So every block successfully mined is backed by money that had been sacrificed not just on the hardware, but on the energy required to run that hardware and produce that block. Whenever there are forks, proof-of-work (PoW) consensus algorithms are an automated system whereby the fork backed by the most work is the “right” fork.
Related: Proof-of-stake vs. proof-of-work: Differences explained
This means that everyone who continues producing blocks on that fork will continue to earn rewards and that everyone who continues producing blocks on the other fork will not earn rewards. Since these people have already spent their money to acquire hardware and run it to produce blocks, the punishment is easy because they’ve already been punished monetarily. They spent their money so if they want to continue producing blocks on the wrong chain, that’s fine. They won’t earn any rewards and they won’t make their money back. They will have sacrificed that money for nothing. Their blocks won’t get accepted by the network and they won’t earn any tokens.
This proof-of-work system ensures that the only way someone who does not want to play by the rules, a malicious actor, is to acquire and run more hardware than everyone else combined, such as by mounting a 51% attack.
This is the elegance behind proof-of-work. The system cannot work without sacrificing ever-increasing amounts of capital. Satoshi combined cryptography and economics to create a ledger of transactions that is so trustworthy, it is trustless.
There are, however, different consensus algorithms that operate in slightly different ways. The most well-known of which is proof-of-stake (PoS), which I’ll be discussing in the next article in this series. After that, I’ll be discussing the algorithm we’ll be using in Koinos which is a first-of-its-kind in a general purpose blockchain.
The views, thoughts and opinions expressed here are the author’s alone and do not necessarily reflect or represent the views and opinions of Cointelegraph.