Definition of Consensus:
Consensus is the backbone of a blockchain system. It is a process of achieving agreement between distrusting nodes in a distributed network on the final state of data.
In other words, consensus ensures that all participating nodes in a blockchain agree on a single data value or block to be added to the chain, even in the presence of failures or malicious actors.
Consensus Mechanism:
A consensus mechanism is a set of rules and steps followed by nodes in a blockchain network to reach agreement on the state of the blockchain.
Requirements of a Consensus Mechanism:
- Agreement
- All honest nodes should agree on the same value.
- Integrity
- No node should decide on more than one value in a single consensus cycle.
- Validity
- The agreed value must be proposed by at least one honest node.
- Fault Tolerance
- It should tolerate failures or malicious behavior by some nodes (Byzantine faults).
- Termination
- All honest nodes must terminate and reach a decision eventually.
Types of Consensus Mechanisms:
Consensus mechanisms are broadly classified into two categories:
1. Proof-based Consensus Mechanisms:
- Involves leader election based on proof of work, authority, or stake.
- Example:
- Proof of Work (PoW): Used in Bitcoin where miners solve a puzzle.
- Proof of Stake (PoS), Proof of Authority (PoA), etc.
2. Traditional Fault-Tolerance Based Mechanisms:
- Based on message passing and verification among nodes.
- Used in permissioned or private blockchains.
- Examples:
- Paxos: Proposer, Acceptor, Learner roles.
- RAFT: Nodes are Followers, Candidates, or Leaders.
- PBFT (Practical Byzantine Fault Tolerance): Handles malicious or inconsistent behavior.
Types of Faults Handled:
- Fail-stop Faults:
- Node crashes or stops functioning.
- Easier to handle using Paxos or RAFT.
- Byzantine Faults:
- Node behaves maliciously or inconsistently.
- Handled using PBFT and other Byzantine fault-tolerant protocols.