What Is a Consensus Algorithm?
Blockchain technology and cryptocurrencies have introduced a revolutionary way to exchange and store monetary value. A consensus algorithm, also known as the consensus mechanism, lies at the heart of this technology.
The word “consensus” means “general agreement.”
A blockchain is a distributed ledger that records transactions and account balances. There needs to be agreement on the state of the ledger among all participants. This is where the consensus algorithm comes into play.
The consensus algorithm is the process where blockchain nodes (computers validating and recording transactions) reach an agreement on the state of the ledger.
The consensus algorithm is crucial to a blockchain because it prevents bad actors from cheating the system. The mechanism prevents malicious activities like “double-spending” of cryptocurrencies and Sybil attacks by incentivizing honest actors.
Therefore, the definition of consensus mechanism includes rules and incentives that allow the network to agree on the state of a blockchain.
How Does the Consensus Algorithm Work?
Suppose Max is a bad actor who has a balance of 10 crypto tokens. Max wants to “double-spend” his crypto by sending 10 tokens to Nina and then transferring the same 10 tokens to Ozy.
To successfully cheat Nina and Ozy, Max would need all the nodes on the blockchain to agree with his false history of transactions.
However, as a public blockchain is decentralized and open, the system counts on good and incentivized actors to reject false transactions. So long as the good actors outnumber the bad ones, Max will not be able to double-spend as there won’t be a “general agreement” on the falsified transactions.
Types of Consensus Algorithms
Let’s explore different types of consensus algorithms used in blockchain systems. Here is a list of the most popular ones:
- Proof-of-work (PoW)
- Proof-of-stake (PoS)
- Delegated proof-of-stake (dPoS)
- Proof-of-authority (PoA)
- Hybrid PoW/PoS consensus
- Proof-of-burn (PoB)
- Delayed proof-of-work (dPoW)
In the PoW consensus mechanism, network participants called “miners” expend computational power and electricity to validate transactions and add new blocks to the blockchain ledger. In return, miners are rewarded with new tokens (BTC in the case of Bitcoin) for their honest work.
A PoW blockchain remains secure as long as 51% of the computational power of the network is held by honest nodes. As honest miners control the majority of the computational power, the honest chain (honest version of the blockchain) will outpace any competing chains.
To make changes to a past block, an attacker will have to expend computational power and electricity to modify that particular block and all the blocks after it and then surpass the work of the honest chain. For an attacker expending such a large amount of computing power and electricity may outweigh the economic gains made in the attack.
Mature PoW blockchains like Bitcoin have sufficient hashing power to make it incredibly expensive to attempt a 51% attack.
However, the same cannot be said for smaller PoW blockchains with less hashing power securing the network.
Here PoW miners are replaced by PoS stakers. Unlike miners, stakers do not need to expend energy to validate transactions. Instead, participants have to stake capital (in the form of cryptocurrencies) as collateral to become validators.
Validators are selected at random to create new blocks. After a new block is created, the validator is rewarded with new crypto tokens.
The collateral and block rewards ensure that validators remain honest and fulfill their duties of validating transactions, creating new blocks, and keeping the network running.
A validator risks the destruction of their staked collateral in case they behave maliciously. While the failure to participate in network activity when called upon will result in validators missing out on block rewards.
At the time of writing, you will have to stake 32 ETH in order to become a validator on Ethereum.
Key Differences Between PoW and PoS
|Miners expend computational power and electricity to validate transactions and create new blocks
|Validators stake cryptos as collateral to validate transactions and create new blocks
|Tried and tested consensus mechanism
|Younger and less battle-tested compared to PoW
|Requires extensive amount of electricity, therefore not considered environmental-friendly
|Consumes significantly less energy compared to PoW
|Miners invest in expensive hardware
|Validators can run PoS software from laptops
|Miners compete to solve cryptographic puzzles to gain the chance to create a block
|A validator is selected at random to create the latest block
|Dishonest validators risk losing their staked collateral in an event called slashing
Delegated Proof-Of-Stake (dPoS)
Delegated proof-of-stake is a variation of the PoS consensus mechanism. Here network users vote and elect delegates to validate blocks.
dPoS is a reputation-based consensus mechanism model. Delegates are elected based on their reputation of reliability. dPoS networks have less number of validators compared to PoS blockchains, which allows the network to reach faster consensus.
However, dPoS systems can be vulnerable to 51% attacks as there is less number of validators in the network. There is also the risk of centralization of power as validators are few in number, and voting is reputation biased.
Proof-of-authority is a consensus mechanism where only authorities entities are allowed to become block validators.
Here potential validators undergo a vetting process where they are selected based on their trustworthiness, moral standards, criminal records, investable capital, reliability, and reputation. PoA is considered a highly efficient consensus mechanism as the network depends on a small number of top validators.
Like DPoS, the PoA consensus mechanism is also vulnerable to centralization and 51% attacks.
Hybrid PoW/PoS Consensus
As the name suggests, hybrid PoW/PoS consensus is a mixture of proof-of-work and proof-of-stake consensus algorithms. This approach brings together PoW security and PoS governance.
An example of a blockchain that uses a hybrid PoW/PoS consensus is Decred. PoW miners on Decred play a similar role as they do on the Bitcoin blockchain i.e. verification of transactions and creating of new blocks.
PoS on Decred is designed for governance. DCR token holders can stake their coins to obtain voting tickets. Ticket holders are selected at random to approve PoW miners and vote on change proposals.
Before we start, we need to know what ‘burning’ means. Burning is the process of permanently removing coins from circulation by sending them to an unretrievable address.
Proof-of-burn is a consensus mechanism that requires miners to burn coins. The burning of coins is the cost required to take part in mining activity i.e. verifying transactions, creating new blocks, and receiving block rewards.
According to Iain Stewart, the creator of PoB consensus, the more coins a miner burns, the higher their mining capacity.
As PoB miners burn coins instead of spending electricity as PoW miners do, PoB is significantly less energy intensive compared to PoW.
Delayed Proof-Of-Work (dPoW)
Delayed proof-of-work is a consensus mechanism where a blockchain leverages the security of a secondary PoW network (e.g. Bitcoin). This consensus mechanism was pioneered by the Komodo Foundation.
According to Komodo, dPoW networks use the secondary PoW blockchain to store backups of its blockchain history. A single copy of the original dPoW chain will allow the entire network to rejuvenate in case there is an attack on the dPoW chain.
Through the dPoW consensus mechanism, blockchains will low hash rates can rely on mature PoW networks like Bitcoin for security.
Consensus algorithms are the backbone of blockchain technology.
Each consensus algorithm has its own advantages and limitations. While some chose to champion security and decentralization, others may see speed and efficiency as their priority.