Understanding consensus algorithms

In today’s modern world, an algorithm is defined as step-by-step instructions processed by a computer that solves a particular problem. Computer algorithms have permeated our lives in ways we cannot imagine because they have evolved extensively. We use them on a daily basis whether when we shop, travel, or even when we try to find a partner. Now, imagine a system running in a decentralized form of governance powered by consensus algorithms. Blockchain has made this possible for us.

Consensus means a general agreement between a group of people. In order to understand consensus algorithm in blockchain, we have to trace it all the way back to the ancient history of the Byzantine Empire, specifically the Byzantine Generals Problem.

This article will provide an overview of the most common consensus algorithms used in blockchain systems. But to do that, we need to tackle the Byzantine Generals’ Problem first.

The Byzantine Generals’ Problem and Byzantine Fault Tolerance
The Byzantine Generals’ problem is an agreement problem where all the actors (generals and their messengers) involved must agree on a specific strategy to avoid failure. It is a coordinated attack to achieve victory. Relaying the strategy to all generals in order for them to agree to it is very important.

To successfully attack a city, the actions of different Byzantine army must be coordinated. These may refer to the strategy, the formation or the date of the attack. They must all agree first before the attack may be concerted. To execute the plan properly, the messengers will play an important role in relaying the exact message to all the generals involved. The plan gets messed up when you have traitors or corrupt messengers who could alter the message.

The above scenario is similar to a decentralized network where all computers should come to a decision and agree on it without trusting the parties involved. This is called Byzantine Fault Tolerance. This is the essence of consensus algorithms in the blockchain.

Proof-of-work consensus algorithm (PoW)
In the Proof-of-Work algorithm, a consensus is achieved by going through the process of mining. Incentives are given to those who mine for it. In bitcoin, a transaction that has been propagated to the network is not automatically included in the blockchain until it is verified and becomes part of a block. The process of mining starts when miners collect transactions from the memory pool and create an empty block for these transactions.

An empty block is not yet a valid block, and it only becomes valid when the miner is able to solve for the computational problem. A valid block is added into the blockchain every 10 minutes. It must contain a valid block header with a nonce (random number) appended to it. The nonce is the number that miners will try to guess based on the condition that it should be lower than the target. The target is the difficulty threshold. Think of the nonce as a mystery number that miners will repeatedly guess until it meets the condition. The lower the target is, the higher the difficulty of computing for the nonce will be; because as the target goes lower, the probability of guessing the nonce gets slimmer.

This is why miners would need to spend an enormous amount of computational power to solve it. Miners spend on electricity and equipment, and the more hashing power they have, the higher the chance is for guessing the correct nonce. The first miner who is able to compute for the nonce will be the winner for that round, the block that was produced will now be included in the blockchain as a valid block and this is his (or their) proof of work. As a reward, miners will get 12.5 bitcoins for every successful block that they produce. On top of that miners also get transaction fees. Some of the coins that are using PoW are bitcoin, monero, litecoin, and Ethereum, which will soon switch to PoS.

To understand more about bitcoin, you can check our simplified guide here.

Proof-of-Stake consensus algorithm (PoS)
In the Proof of Stake algorithm, there is no computational puzzle being solved, instead the blockchain has a group of validators. Each of them has to lock up his (or their) own money in the system as their stake to be able to validate transactions and produce new blocks. A validator is chosen based on probability, the higher the stake that a validator has, the higher the chance of being chosen to produce a new block. However, the money will be forfeited if the validator will act maliciously. Proof of Stake algorithm has several variants. Generally speaking, when a validator acts honestly, he (or they) will get the transaction fees from the new block as a reward, plus his (or their) money will not get forfeited.

Some of the coins that are using PoS are Cardano and soon Ethereum. To know more about proof of stake, you can check Proof-of-Stake-FAQ.

Delegated Proof-of-Stake consensus algorithm (DPoS)
Delegated DPoS is obviously a variant of Proof of Stake, the difference is that validators are chosen by voting, whereas in PoS validators are chosen by probability. The elected validator will be given the chance to produce the new block. If a validator misbehaves, the group can remove the malicious node from the network.

Proof-of-Importance consensus algorithm
Proof of Importance is a consensus method that weighs how important a node is in the network. The more important it is, the more influence it will have on the network. Importance is the skin in this game. Now, how do you build importance? There are several factors that can be considered as a measure of importance. One is the tenure of the node in the network. Another is the usage level of the node in the network. Another is the rating from other nodes. NEM, in particular, gives importance to how much a node spends on the network. In general, this can be compared to a social media influencer, the more followers he/she has, the more important he/she is in that space.

These are the most commonly used consensus methods in blockchains out there. You may see variants of it but these are the fundamentals. While we will never know which of these will be popular in the future, one thing we do know is that the Proof of Work is the first consensus algorithm.

Disclaimer: BitChikka makes no representations or warranties as to the accuracy or timeliness and completeness of the information contained herein.

What do you think?

0 points
Upvote Downvote


Leave a Reply

Your email address will not be published. Required fields are marked *





A promising outlook to the blockchain industry in the Philippines

Four things to consider for long-term crypto investments