Beginner’s Guide: What is Consensus Algorithm?

0

Consensus algorithm has an important place in computer science. It is used by computers to reach agreement on a single point of the data value. It is only used in distributed systems or processes.

You might have heard about consensus algorithm through blockchain or bitcoin. Today, we have the chance to go through the topic in detail and also understand its role in distributed systems.

So, what we will discuss? Let’s list them below.

  1. How does consensus algorithm work?
  2. Application of consensus algorithm.
  3. Types of consensus algorithms

Let’s get started.

How does consensus algorithm works?

For a distributed network, It is not common for all the system nodes to be online every time a consensus is required. Also, there are chances that some information is lost during transmission.

Consensus algorithm solves the biggest problem that a distributed or multi-agent system goes through. It ensures that consensus is achieved with minimal resources, keeping integrity and transparency in the decisions it takes.

To ensure that the whole system is fault-tolerance, consensus algorithm only require a reply from 51% of the resources at a time. Let’s try to understand it using an example of PoW consensus algorithm. A person sends 0.2 BTC from his wallet to another wallet. To ensure that the transaction goes through, the miner mines the block that the transaction needs to be in. Now, the miners start mining the block. After a while, it will get validated when the system does the minimum required for validations. In case of BTC, it takes only six validations to reach consensus.

There are many types of consensus algorithm at the time of writing. This means that the internal workings depend on the type of consensus algorithm used.

Application of Consensus algorithm

There are different applications of consensus algorithm. Even though it is mainly used for the decentralized system, it is equally useful in a centralized system as well. To better understand, let’s list the use cases of consensus algorithm.

  1. The most basic application of the algorithm is to decide whether a transaction in a distributed environment needs to be implemented or not. Most of the blockchain networks use it.
  2. Consensus algorithm is also very useful in assigning a node a leader status.
  3. Last, but not the least, they are also used to synchronize data across the decentralized network and ensure that consistency is achieved.

Types of Consensus algorithms

There are many types of consensus algorithms. In this article, we will cover the most popular ones only. So, without any delay, let’s get started.

(1) Proof of Work(PoW)

Proof of Work is the most popular consensus algorithm out there. Bitcoin, Litecoin, and Ethereum use it. It was first devised by Satoshi Nakamoto when he used in his Bitcoin implementation. However, it is also the most inefficient way to achieve consensus in a blockchain as it requires a considerable amount of computational power. It works by asking miners to solve complex mathematical problems. Once the hash is solved, the block is mined and the transaction is validated at the same time.

By solving, they create blocks which are later added to the blockchain. For this to work, 50% of the work always have to be honest.

(2) Proof of Stake(PoS)

Our next most popular consensus algorithm is Proof of Stake. It is used by Peercoin, Decreed and soon Ethereum. It works by staking coins in a wallet. The nodes that have staked their coins will have their say when a consensus needs to be achieved. The good thing about PoS is that it is not computational power hungry.

The spending resource, in this case, is the tokens itself. If a staking node fails to vote for the correct transaction, they will lose their stake. If it succeeds, it will hold better chances to stake when a next transaction takes place.

Just like another consensus algorithm, PoS also has its weakness. It is “Nothing at Stake.” It works by validation both sides of a fork. We recently wrote about the difference between PoW Vs PoS.

(3) Delegated Proof of Stake(DPoS)

Delegated Proof of Stake may sound similar to PoS but is different in its approach. The first thing that differentiates them is that DPoS is not entirely decentralized. In this system, the stakers doesn’t validate the blocks, but they choose delegates.

These delegates then validate each transaction. Generally, any decentralized system has 20-21 delegates that verify the transactions. This makes DPoS exceptionally efficient and is used by EOS, Steemit, and others.

(4) Proof-of-Authority(PoA) Consensus Algorithm

The last consensus algorithm that we are going to discuss is Proof-of-Authority. It is used for the entirely centralized system. This means that approved accounts (chosen by the system administrators) do the validations across the network. It is mainly used in private networks due to its centralized nature.

Conclusion

By now, you should have a proper understanding of consensus algorithm. If you have any questions, you can always use the comment section below!

Check out our Ultimate guide to Blockchain Technology


About Author

Nitish holds a BSc in computer engineering. He is a blockchain enthusiast and in spare time likes to read about the moon. His articles have published on Dzone, InfoWorld, and Hongkiat.

Leave A Reply