Blog

Explanation of Consensus Mechanisms in Blockchain

Blockchain

Explanation of Consensus Mechanisms in Blockchain

consensus_mechanism_blockchain

Have you ever got a question, without any central authority, how does Blockchain work, and how is a decision made in Blockchain? Generally, the central authority will have an elected leader to decide.

But in the Blockchain, it is not possible to have a leader. For the Blockchain to make decisions, they need to come to a consensus called a “consensus mechanism.”

Let’s see how decisions are made in Blockchain,

What is Consensus?

In simple terms, Consensus is a dynamic way of reaching an agreement in a group. While voting just settles for a majority rule without any thought to the feelings and well-being of the minority, a consensus, on the other hand, ensures that an agreement is reached which could benefit the entire group.

“From a more idealistic point-of-view, Consensus can be used by a group of people scattered around the world to create a more equal and fair society.”

A method by which consensus decision-making is achieved is called the “consensus mechanism.”

How does the Consensus work?

A Consensus is a group of people coming to an agreement. 

Let’s take an example: A node suggests one agreement, and another node suggests another agreement, and now the majority of people will choose the better Consensus which could benefit the entire group. 

To clarify, a group of people creates fair and equal rights for all nodes.

Characteristics of consensus decision-making include (Wikipedia):

Collaborative: Participants contribute to a shared proposal and shape it into a decision that meets the concerns of all group members as much as possible.

Cooperative: Participants in an effective consensus process should strive to reach the best possible decision for the group and all of its members rather than competing for personal preferences.

Egalitarian: As much as possible, all members of a consensus decision-making body should be afforded equal input into the process. All members have the opportunity to present and amend proposals.

Inclusive: As many stakeholders as possible should be involved in the consensus decision-making process.

Participatory: The consensus process should actively solicit the input and participation of all decision-makers.

Now that we know about the Consensus mechanism let’s see the most used consensus mechanism.

Proof of Work

Before going to that, I want to tell you a small story. When I was in 1st grade, my teacher used to ask us to solve a maths problem, and the reward for that would be a bar of chocolate:

For, e.g., 10 + ? = 12, who solves the first, the reward is given to them.

10 + 1 = 11

10 + 2 = 12

After getting the answer, I used to rush to my teacher and show my answer, but unfortunately, some other kid solved it before me, and he walked away with that chocolate bar.

The teacher also realized that the problem was too easy for the kids. For the next chocolate, she increased the difficulty level. This time the class is asked to solve:

345+?=379

Now taking the same scenario in the Blockchain:

Miners are like Students, competing with each other to solve the puzzle to earn rewards. Here “2” is the nonce – a number that can be used only once to solve the puzzle. “12” is the difficulty level, which ensures the teacher controls the number of chocolates distributed.

Blockchain uses the difficulty level to control the generation of 1 block/~ 10 minutes. The person who solves the cryptographic puzzle will win the rewards and places the Block on the Blockchain.

The main drawback of POW is that it is a highly inefficient process because of the sheer amount of power and energy that it eats up.

You can see all the details of the Block here:

Proof of Stake

This is one of the best Consensus mechanisms, and Ethereum is soon planning to move from Proof of Work to Proof of Stake.

To keep it simple, there will be no miners in the Proof of Stake. Yes, you heard it right. There will be only Validators who will validate the transaction in the Blocks.

To Validate the transaction, the validator has to place a certain amount of bet,

The size of the Stake determines the chances of a validator being chosen to validate the next Block. Now, you may have a question, a person with more Stake will always choose to validate, but in reality, it’s much fairer. 

For example, a Node has been chosen to validate the next Block; he’ll check all its transactions and add them to the Blockchain. After the Block is on the Blockchain, the node receives a fee for each transaction. After some time, the validator will receive his deposited money.

What if Validators approve the fraudulent transaction?

Validators will lose a part of their Stake if they approve fraudulent transactions. The amount stake is much more than the fee they receive from the transactions. So we can trust the validators to do their job correctly. If not, they will lose more money than they gain.

The person with more Stake will validate that transaction and receive the transaction fee; after that, he will receive the deposit money.

Proof of Work Proof of Stake
Miners are used for creating a new block Validators are used for creating a new block
Due to Mining Pools POW is less decentralizedMore Decentralised than POW
More expensiveLess expensive
Due to cost, there are fewer nodes in the POWHelps more nodes to join and makes the network more decentralized

Other Consensus Mechanisms

Delegated Proof Of Stake (DPOS)

DPOS is implemented in EOS and its works on a Stake-weighting voting system. Where the Stake of the person determines the weight of their vote.

Delegated Proof of Stake is like an election, where people must vote for the delegates. Delegates are people or organizations used to produce the blocks on the network, and the delegates will receive the reward for creating the Block.

The reward will be like Proof of Stake, a transaction fee, or a fixed amount of Coins. 

How are delegates chosen to produce the Block?

For Eg: Nodes will vote for the delegates with their Stake, and the person with the highest votes will get a chance to produce the Block on the network. It is the same as an election where we need to choose the delegate of our choice and need to do our voting. The weight of their vote depends on their Stake. 

For example, if “A” stakes 50 coins for the delegate and “B” stakes 10 coins for a delegate, then A’s vote is 5 times more weight than B’s. 

Since delegates want to receive as many votes as possible, they are constantly incentivized to create things valuable to the community, as they are likely to receive extra votes.

Proof Of Capacity (POC)

Proof of Capacity is a consensus mechanism that uses a process called Plotting; in Proof of Work, miners use a lot of computational to solve the puzzle to create a block. However, in Proof of Capacity, all the solutions are pre-stored in Storage like Hard Disks.

After storage has been filled with solutions, he can participate in the block creation. This process is called Plotting.

The person who solves the puzzle fast will get to create a new block. This mechanism is like Storage capacity is directionally proportional to the higher chances of creating the new Block.

“All consensus mechanisms’ approaches might differ, but the intentions and goals are the same for all. Still, a perfect consensus mechanism doesn’t exist.