The logic embodied in all the nodes of a blockchain that ensures the chain's integrity. Because there is no central authority in a blockchain, the consensus mechanism ensures that at least 50% of the active nodes in the network "plus 1 more" agree (see 51% consensus
Also called a "consensus method" and "consensus engine," the consensus mechanism is the very heart of public (permissionless) blockchain operations. There are many approaches (see list below), each of which is extremely complex software because participants (nodes) in a blockchain come online and go offline at any given moment, and the total number of nodes can range from a few dozen to tens of thousands depending on the blockchain. See blockchain
Consensus Is Necessary and Complicated
For example, in the proof-of-work (PoW) method used in Bitcoin and Ethereum 1.0, the first miner to find the number that solves a mathematical puzzle adds its transactions to the blockchain as long as the majority of nodes agree that the puzzle was solved correctly and the block is valid. In addition, the network must also reach consensus as to which miner adds the block when two or more solve the puzzle at the same time.
The two primary consensus methods for public blockchains are proof-of-work (PoW) and proof-of-stake (PoS). Proof-of-work consumes enormous amounts of electricity solving a mathematical puzzle, whereas proof-of-stake is based on randomness and how much crypto the miner has staked. See proof-of-work algorithm
and proof-of-stake algorithm
Public vs. Private Blockchains
The consensus mechanism in public blockchains has to be a lot more robust than in private blockchains. Because anyone can participate in a public blockchain, the consensus architecture has to be secure enough to prevent an erroneous transaction, malicious miner or external hacker from abusing the system.
In contrast, private blockchains require permission to participate, and a vetting process allowing participants to come on board is in place in varying degrees. The consensus mechanism in a private chain can be more streamlined and less complicated.
Summary of Consensus Mechanisms
Following are popular consensus algorithms. There are many more, and while some fade away, new methods are coming online routinely.
Proof-of-Work and Proof-of-Stake
These are the primary methods. Bitcoin uses proof-of-work, while Ethereum changed from proof-of-work to proof-of-stake in 2022 (see proof-of-work algorithm
and Ethereum 2.0
Proof-of-Authority and Proof-of-Burn
Proof-of-authority relies on reputation, while proof-of-burn is based on how much crypto is destroyed. See proof-of-authority algorithm
and proof-of-burn algorithm
Proof-of-Capacity and Proof-of-Contribution
Proof-of-capacity is based on cryptographic solutions, whereas proof-of-contribution is based on confidence levels. See proof-of-capacity algorithm
and proof-of-contribution algorithm
Proof-of-History and Proof-of-Importance
Proof-of-history is a time stamp method, while proof-of-importance is based on activity. See proof-of-history algorithm
and proof-of-importance algorithm
Proof-of-Storage and Proof-of-Assignment
For decentralized storage networks, proof-of-storage is based on replication and storage. Sensors and other IoT devices can be used to mine crypto using proof-of-assignment. See proof-of-storage algorithm
and proof-of-assignment algorithm
Used in the Arweave decentralized storage network, proof-of-access incentivizes miners to maintain older blocks for long-term storage. See Arweave