What is a consensus algorithm in blockchain?

What are concensus algorithms?

Consensus algorithms are procedures through which all nodes in a network reach a common agreement about the current state of the distributed ledger.

Blockchain is a decentralized network maintained by a network of nodes (miners or validators). Every node has its own copy of the blockchain and to maintain the same state of the blockchain across the network we need a consensus mechanism. The general working of a consensus algorithm is shown below.

Consensus algorithms
1 of 7

Purpose of consensus algorithms

  • Security: Every node verifies all the transactions in a block before adding them to their journal. It prevents malicious nodes from adding malicious transactions to the network.
  • Accountability: The stake of a node is slashed if they attempt to add a malicious transaction to the network if the blockchain is using a proof of stake algorithm. On the other hand, if blockchain uses a proof of work algorithm, it will lose a lot of energy as other nodes will eventually reject its block. The transaction will never become part of the blockchain.

Types of consensus algorithms

  • Proof of work: Every miner has to solve a complex mathematical puzzle that requires a lot of computational power to be able to mine the next block. Upon successful mining of the block, the miner gets a reward in the blockchain's local currency, for example, Ether in the case of the Ethereum blockchain.
  • Proof of stake: Validators lock some of their coins in the network as stake, and if a validator's block is added to the blockchain, they will get a reward, and their stake will increase.
  • Proof of elapsed time: Every node has to wait for a random amount of time and include their proof wait in their block to be able to mine a block.
  • Proof of burn: Validators burn coins to be able to mine the next block. The more coins they burn, the greater the chances of being selected to mine the next block.

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved