In the last few years, blockchain technology has gained a lot of popularity. What was once introduced in 2008 by Satoshi Nakamoto as a technology to govern the cryptocurrency 'Bitcoin' is now finding applications in fields as diverse as fashion today. It is essential to know what blockchain is if you want to understand consensus mechanisms.
In its most straightforward form, blockchain can be defined as a shared distributed ledger on which transactions are digitally recorded and linked together to provide the entire history or provenance of an asset. A transaction is added only after it has been validated using a consensus mechanism, which ensures it is the only version of the truth. Each record is also encrypted to provide an additional layer of security. Blockchain is said to be "immutable" because the recorded transactions cannot be changed and transparent because all participants to the trade have access to the same version of the truth.
Blockchain is a decentralized ledger technology. The very meaning of a decentralized system is it will not have a central governing authority or a core managing team. It is an ecosystem 'by the people, for the people, of the people.' All the recorded transactions represent the same value for all the participants of the chain.
The independent, immutable nature makes it attractive for implementation in various fields ranging from Banking to Supply Chain. Blockchain's integral features like a single version of truth, immutability, and transparency are all thanks to the consensus mechanism system embedded in the various chains.
The consensus mechanism is a fault-tolerance mechanism used to achieve agreement on a single data value or a single state of the network among distributed ledgers or a multi-participant system such as cryptocurrencies. The consensus mechanism is useful in record keeping, amongst other things.
In any centralized database, like the database that holds the information about the voters in the country, a central administrator has the authority to maintain and update the database. They are the ones who can add or delete the voters or make changes and corrections to existing voters in the database. A central authority will perform all these functions.
As opposed to this, public blockchains on a global scale operate as decentralized, self-regulating systems without a central authority. These chains involve contributions from hundreds of thousands of participants across the globe. The contributors work on verification and authentication of transactions occurring on the chain and the block mining activities. In a nutshell, consensus mechanisms are protocols that make sure nodes (devices on the blockchain that maintain the chain and sometimes store the data) are in sync with each other and agree on which transactions are legitimate and thus can be added to the chain. The consensus mechanism performs the all-important task of consensus agreement.
There are different kinds of consensus mechanism algorithms used by the various blockchains. Each consensus mechanism applies its own set of principles. Let's have a look at some of the most popular consensus mechanisms.
Proof of Work (POW) is the first consensus mechanism used by the first chain ever developed, which is the Bitcoin blockchain. Many cryptocurrencies and other chains have since followed suit and have adopted POW. Early PoW versions are Hashcash by Adam Back (1997) and Reusable Proof of Works (2004) by Hal Finney who was also the recipient of the first Bitcoin transaction. Bitcoin's PoW is described in the whitepaper by Satoshi Nakamoto (2008).
The Proof of Work process is known as mining, and nodes are known as miners. Miners solve complex mathematical puzzles that require a lot of computational power. The first miner to solve the problem gets to create the next block and receives a reward for creating that block.
POW uses a 'hash function' to create conditions under which a single participant is permitted to announce their conclusions about the transmitted information to the chain. All the members of the system can independently verify these conclusions. False conclusions are prevented by the hash function's parameters, which ensures that incorrect information will fail to compute acceptably.
While calculating the hash, it should be noted that problems are asymmetric, meaning it will take a lot of time to calculate the correct answer. Once found, the answer is easy to verify. Secondly, the only way to solve these puzzles is trial and error. That means that miners with higher computational power will be able to solve the problem faster. Lastly, the level of difficulty of the puzzles depends on how quickly the blocks are being mined. Blocks have to be created at regular intervals to maintain a consistent supply of currency. If new blocks are being created too fast, the puzzle will get harder and vice versa.
While the Proof of Work mechanism ticks a lot of consensus requirements, it isn't without its faults. First and foremost, the POW system is extremely inefficient because of the sheer amount of power and energy it eats up. Using POW is highly environmentally unfriendly. In addition to this, POW is partial to individuals and organizations with higher computational power. Computational power is extremely costly, and as POW is partial towards it, blockchains that work on POW like Bitcoin aren't as decentralized as desired. Computational power is bundled in so-called mining pools. Today, approximately 70% of the hash rate concentrates amongst six major mining pools.
Proof of Stake (POS) is the environmentally friendly brother of Proof of Work. POS consensus mechanism was introduced in 2011 to solve the problems of the most widely used Proof of Work Mechanism. While they share the same purpose of reaching consensus, the method of reaching consensus is different.
Proof of Stake algorithm uses a pseudo-random election process to select a node to be the validator of the next block. The selection is based on a combination of factors, including the staking age, randomization, and the node's wealth. POS is based on the premise that those who own most coins on the blockchain have a vested interest in maintaining the network and keeping the prices of their coins high.
It should be noted that unlike POW in the POS system, blocks are said to be forged rather than mined. Cryptocurrencies using POS often start by reselling pre-mined coins, or they launch with Proof of Work algorithm and then shift to the Proof of Stake algorithm.
Users who want to participate in the forging process must lock a certain number of coins into the network as a stake. The size of the stake determines the chances of a node being selected as a validator to forge the next block. The bigger the stake, the higher the chances. To not prefer the wealthiest nodes, unique methods are added to the system over time. The most common ones are the Randomized Block Selection and Coin Age Selection.
The main advantage of the POS algorithm is energy efficiency and security. A higher number of users are encouraged to process nodes as it is easy and affordable. This, along with randomized processes, makes the network more decentralized since mining pools are no longer needed to mine the blocks. Since there is less need to release new coins as rewards, the prices of coins using POS as a consensus mechanism stay relatively stable.
While POS has its advantages, the system isn't fault-free. One disadvantage of POS is the only way to acquire coins is from someone who already has them. This may create problems around distribution. Another critic is that currencies kept as stake cannot be traded, and thus these cannot be used as a form of payment.
Ethereum 2.0 is all set to implement the Proof of Stake mechanism to replace their current Proof of Work mechanism to make their blockchain more environmentally friendly and decentralized.
The hybrid Proof of Work/Proof of Stake consensus mechanism utilizes elements of both POW and POS systems when determining transaction validation rights. By doing this, they aim at mitigating the weaknesses of both systems while reaping the benefits of their advantages. The exact mechanism may vary from chain to chain. The following explanation is based on Decred, perhaps the most notable project employing a hybrid POW/POS mechanism.
The hybrid consensus mechanism begins by having POW miners creating new blocks containing the transactions to be added to the blockchain. Once the blocks have been created, POS miners must vote on whether to confirm the block or not.
POS miners purchase votes by staking a portion of their tokens on the network. Larger stakeholders have greater voting rights. However, rather than examining the total vote count, the hybrid consensus mechanism randomly chooses 5 votes to determine the newly mined block's validity. If 3 out of 5 chosen votes are affirmative, the said block is confirmed and added to the chain.
POW miners receive 60% of the block reward, POS miners receive 30%, and the remaining 10% is awarded to development efforts in exchange for their service.
This mechanism is gaining popularity fast. It proposes a stable structure by overcoming the drawbacks of the classic Nakamoto proposed Proof of Work structure and its energy-efficient counterpart Proof of Stake structure.
Federated Byzantine Agreement (FBA) is a form of Byzantine fault tolerance, where each byzantine general is responsible for its blockchain. A Federated Byzantine Agreement is used for its high throughput, network scalability, and low transaction costs. Notable cryptocurrencies using FBA are Ripple and Stellar.
FBA is designed in a way that the system can still find consensus even if nodes join or leave. The problem of arbitrary nodes joining the network will arise if the consensus protocol is majority based. This is when malicious parties can use a lot of nodes to influence consensus.
To avoid this problem, FBA uses Quorum Slices. The idea is any node has the freedom to choose the other nodes that they trust. Let's understand this through an example. You, Alex, Rob, and Karen are participating. You define your Quorum slices by saying: I am convinced that two of them are also convinced. Here the Quorum slices would look like {You, Alex, Rob}, {You, Rob, Karen} and {You, Alex, Karen}. Do note that your node will always be included in slices created by you. If Alex, Rob, and Karen define their slices in the same way as you, you will start to vote on a topic and a fifth person. Kevin, the fifth person here, wants to influence your consensus maliciously. He would use any number of nodes to join the protocol. If he isn't included in your or any of your friends' Quorum slices, he will not be able to influence the blockchain.
Of course, it is not this simple in application. But this forms an excellent base for understanding FBA.
The advantages of Federated Byzantine Agreement lie in its ability to provide a system that promotes open membership and is decentralized. Moreover, this structure has fewer barriers to entry and is robust in case of a failure. But on the other hand, all parties have to agree on the exact list of participants, which is its downside as this is easier said than achieved.
Blockchain has been in vogue for the past few years. The consensus mechanisms we talked about are concentrated in its application in cryptocurrencies. The chains of tomorrow are no longer going to be restricted to cryptos. Thus, the consensus mechanism suited for non-public blockchains will become another focus area.
Consensus Mechanism systems are in their infancy or maybe their toddler stages and have a lot of space for innovation and improvement. Ten years down the line, the consensus mechanism used today may have gone through a 180-degree change, and what we are writing today may not even be relevant. But what is important is that today's consensus mechanisms will form the base for future improvements and innovations.
"I really, really like the article. It's very clear and well written."