A consensus mechanism (aka "consensus algorithm") is the process by which participants on a blockchain agree. A bit like voting in a parliament. (Did you know that the collective noun for a group of owls is a "Parliament"?) Consensus is critical to blockchain because it determines how data is added to the database - that is, how the next block is added to the chain and secured by encryption.
A consensus algorithm ensures there are no manipulations or erroneous/duplicate entries, optimizing the process. It controls how data is added to the blockchain, and it’s what makes possible this decentralized way of storing and exchanging information safely.
Before we keep going: Proof of Work and Proof of Stake are NOT consensus algorithms. They are techniques that guard against sybil attacks (violations in which counterfeit identities aim to obtain a huge influence on the network), but they’re not enough to reach consensus. ⚠️ These rate limiting methods need to be accompanied by consensus mechanisms to be able to make a decision on the network.
Different blockchains use different methods to reach consensus - just as there are different ways to vote in a democracy. For example, a referendum offers everyone a say, while in a representative democracy, voters select representatives who then decide on their behalf. There are three consensus mechanisms: Classical, Nakamoto, and Avalanche.
The Classical consensus algorithm uses an all-to-all voting method, like when ALL Senators must cast their vote on a bill in Congress. All validators need to say “yay” or “nay” to a transaction. However, in the Classical consensus mechanism, the speed varies with the network size. Things can get verrrry slow in bigger networks!
In 2008, the Nakamoto mechanism came into the scene. This mechanism has a constant operating speed no matter how many participants are in the network. But there’s a catch to it: transactions are confirmed in several minutes (not seconds). Just because it has a constant speed doesn’t mean it’s fast! Also, under the Nakamoto algorithm, the devices cannot be turned off, consuming a lot of energy.
Our third consensus algorithm is the Avalanche consensus (introduced in 2018), which gives us the best of both worlds: speed AND decentralization. Instead of requesting a vote from EVERY SINGLE MEMBER, this algorithm picks a handful of participants at random. It needs less hardware and has an exceptionally fast execution. Learn more about the Avalanche consensus here.
Why is all this important to understand? Because the consensus mechanism is an essential component of the more decentralized vision for web3 enabled by blockchain technology. In a decentralized environment, data is not held by one central authority that is subject to attack or corruption. Instead, by enabling varying degrees of decentralized decision-making that users can trust, consensus mechanisms prevent malicious actors from manipulating or corrupting the database, preserving the integrity of the blockchain and the interests of the participants. Just like a well-functioning parliament!