# Consensus Engine
The consensus engine is a mechanism used to validate and agree on the state of the distributed ledger. In essence, it enables different nodes within a distributed network to agree on a single source of truth, despite the presence of faulty nodes.
# Consensus Mechanisms
Consensus mechanisms come in various forms, but they generally follow a similar process:
- A transaction is initiated and broadcast to the network.
- Nodes within the network independently validate the transaction based on pre-agreed rules.
- Once validated, the transaction is included in a block.
- Nodes in the network then agree (reach consensus) on the correct state of this block and its place in the blockchain.
The specific rules and procedures used to reach this agreement vary depending on the type of consensus mechanism used
# Nibiru's Consensus Engine is based on CometBFT
Nibiru relies on a set of validator node operators that are responsible for committing new blocks to the chain. Each validator does so by broadcasting votes that contain cryptographic signatures corresponding to the validator's private key.
# Byzantine Fault Tolerance
How does the consensus engine handle network partition or node failures?
In a Byzantine Fault Tolerant system like Tendermint, the network can tolerate up to one-third of nodes being faulty (either failing or acting maliciously).
If a network partition occurs and neither section has more than two-thirds of the nodes, the network will halt to prevent any forks or double spends. This is because Tendermint prioritizes safety (consistency) over liveness (availability).
If a node failure occurs, as long as there are more than two-thirds of the remaining nodes functioning properly, the network continues to operate. If a failed node comes back online, it can sync up with the rest of the network and resume its operations.
# Key Aspects of Tendermint Core
Key features include:
Instant finality: Once a block is proposed and validated, it is committed to the blockchain and immediately considered final. Users can be confident their transactions are finalized as soon as a block is created, without the need for multiple confirmations or waiting periods (unlike blockchains such as Bitcoin and Ethereum). This increases security for users.
State machine replication: Tendermint can be used to build arbitrary applications through the Application Blockchain Interface (ABCI). This means it's not just for cryptocurrencies, but any distributed applications.
Byzantine Fault Tolerance: Tendermint employs a Byzantine Fault Tolerance (BFT) consensus protocol, specifically the Practical Byzantine Fault Tolerance (PBFT) approach. This ensures all nodes in the network agree on the order of transactions in the blockchain, even when up to one-third of the nodes are Byzantine (i.e., malicious or faulty).
PBFT uses a two-phase commit process to achieve consensus, where nodes first propose a block and then validate it through a series of voting rounds. This process ensures all nodes in the network agree on the order of transactions and prevents malicious nodes from compromising the network's integrity.Rotating proposers: To improve fairness, the right to propose the next block is rotated among validators based on their stake and the number of times they've already proposed a block.
Further reference documentation can be found in Tendermint Core Docs. A good starting point is the "What is Tendermint" (opens new window) page.