When you go to a bank or log on to your internet banking portal to transfer funds to one of your friends, you place your trust upon the bank employee and the financial system for the funds to reach the right account in a safe manner. This is an example of a centralized system where you trust a third party to facilitate your transactions.
In case of a blockchain, however, a trustless consensus protocol facilitates and controls the approval of these transactions rather than a third party, meaning that it does not require you to trust any central authority. This is exactly what makes a blockchain decentralized.
Note: Consensus protocols in simple terms refers to the “rules to reach an agreement.”
For once, it can be both intriguing and intimidating to think how blockchains can imbibe trust between any two parties sitting at any two arbitrary points across the globe without the help of any central party controlling the transactions. But blockchains were built for this purpose.
With the absence of a central party, blockchains are vulnerable to what we call the Byzantine Generals’ Problem, where the nodes responsible for validating the information to reach consensus and creating blocks on a blockchain may try to tamper with the real data.
Byzantine Fault and Byzantine Fault Tolerance
In a blockchain, there are a number of parties involved who help validate the transactions. These validators distributed across the globe, at all times, need to agree on the correct data history stored on the blockchain while also agreeing on the way forward to creating the new blocks.
With no entity having authority over any of these validators, the chances of some validators going rogue and representing the wrong information on the block are quite high. On the most basic level, this is termed as the Byzantine Fault that arises in a distributed network system.
Byzantine Fault Tolerance is that characteristic of a distributed system that allows it to dodge any failures occurring due to the Byzantine Fault. It is an extreme problem at all places where a number of parties, who aren’t directly in contact with each other, make certain decisions.
This is where consensus protocols kick in. A consensus protocol is a complex solution to this complex problem that minimizes the chances of the failure of a distributed system due to Byzantine Fault.
While all blockchains do the exact same thing, i.e. facilitate, record and store transactions, different blockchains employ different consensus protocols, which makes up for the major variation in their functionality. A consensus protocol mostly performs two tasks: maintaining the one and only version of the truth and preventing ill actors from tampering with the data already stored in the blocks.
There are a number of consensus protocols and they differ from each other depending on how they perform the above-mentioned tasks. To understand that, let’s look into some of the major consensus protocols that are being widely used.
Proof of Work (PoW)
Though not as commonly recognized as the word Bitcoin itself, Proof of Work is what keeps the Bitcoin blockchain running and the bitcoin currency coming to your wallet safely each time.
The trails of the concept behind Proof of Work goes back to 1993, while the term came around in 1999. Almost ten years down the line, the Bitcoin blockchain first utilized the PoW consensus, and the rest was history.
The PoW protocol requires the nodes of the blockchain (often called miners) to use advanced computational hardware in order to compete and be the first to solve a cryptographic problem. While the solution of this puzzle, technically termed as the hash, is hard to find, it’s quite simple for the rest of the network to verify it once it is found. To do that, the miner who finds the solution shares it with the rest of the nodes, who then verify it to reach a consensus. Once done, the first miner receives the mined Bitcoin as the reward.
One of the most decentralized protocols out there is the Proof of Work consensus. However, it has two significant drawbacks: it is time taking as miners have to randomly search for the right solution by scanning through a number of could-be solutions. And it is energy consuming because miners use high-end computational hardware such as a GPU to find the solution as quickly as possible.
Proof of Stake (PoS)
The Proof of Stake protocol is the second most widely used protocol in the blockchain industry.
Unlike the PoW consensus, where miners battle for the mining reward by using more computational power to be the first to mine the hash, the PoS consensus is not about computational power but about money — the stake.
The nodes on a network using the PoS consensus mechanism buy a stake (crypto tokens or coins) in the network that acts as their collateral and imparts them the credibility to validate the transactions. The algorithm chooses validators on a PoS blockchain based on the size of their collateral, hence, allowing stakeholders with a larger amount at stake to validate more transactions.
This process assumes that the higher the stake of the validator, the lesser are the chances that they will try corrupting the blockchain system.
As you might have already noticed, miners are referred to as validators in the case of PoS blockchains. This is because there are no cryptocurrencies being mined, rather they are all already present, and the validators are rewarded from the transaction fees.
Delegated Proof of Stake (dPoS)
Similar to Proof of Stake is the Delegated Proof of Stake, but with decreased decentralization. The number of validators required to process each transaction in a dPoS consensus is comparatively lower than that in PoS.
In a blockchain network using the dPoS consensus protocol, voting is done by stakeholders of the network to elect the validators cum witnesses for validating transactions and maintaining the record on the blockchain. The voters are responsible for voting witnesses to power, and the stake that the voters hold in the network represents the weightage that their votes possess. The witnesses (master nodes) selected for the top tier then validate the transactions and receive their rewards from the transaction fee charged by the network.
To ensure that witnesses elected to power maintain the decorum and legitimacy of the network, each witness is always at the risk of being voted out of power or being replaced by a new witness whom the voters find more trustworthy.
Similar to the PoW consensus, dPoS too is energy efficient and less time-consuming. On top of that, it is also more scalable, meaning it can process more transactions per second. This is due to the fact that a smaller number of validators are responsible for validating the transactions.
Proof of Authority
The creators of Proof of Authority built it as an alternative to Proof of Stake, which they found to be prone to risks from the stakeholders. In PoW consensus, the stake of the validators in the network acts as a measure of their legitimacy. That monetary stake of theirs, however, can be very small as compared to the huge stake they might be holding on other networks.
On the other hand, another stakeholder with a smaller stake might be more serious about maintaining the decorum of the network as that might be a major part of all his stake on all the networks combined. But the PoW consensus will still give more weightage to the first stakeholder, who has a higher chance of trying to corrupt the system as he has a smaller percentage of his holdings at risk.
To tackle this shortcoming, the industry stakeholders developed the PoA consensus mechanism which considers the past reputation of the nodes as their stake. PoA blockchains elect only a countable few validator nodes depending upon the reputation of the entity or the individual.
The PoA consensus protocol is mostly used in private blockchains, such as the ones used to manage supply chains. This is reasonable given that only authorized persons who have maintained a credible reputation can validate the data input rather than any random entity with a larger monetary stake.
That was our simple and succinct explanation to why we need the blockchain consensus protocols and how they tend to perform their jobs.
While providing a perfect solution for the Byzantine Fault is still not ticked on the blockchain industry’s to-do list, there are a number of new consensus protocols being designed in an effort to make distributed systems more reliable and fault tolerant.