Skip to content

CometBFT

The Consensus Engine that powers Berachain.

CometBFT

What is CometBFT?

CometBFT is a software that facilitates the secure and consistent replication of applications across multiple machines. Security is achieved as long as less than one-third of the machines fail in any arbitrary way, and consistency is maintained by ensuring that all non-faulty machines have access to the same transaction log and compute the same state. This kind of secure and consistent replication is a significant issue in distributed systems, as it plays a critical role in the fault tolerance of a variety of applications ranging from currencies to infrastructure orchestration. The concept of Byzantine fault tolerance (BFT) allows for the ability to handle machine failures in arbitrary ways, even if the machine becomes malicious. Although the theory of BFT has been around for decades, it has only gained popularity recently, primarily due to the success of blockchain technologies like Bitcoin and Ethereum. Blockchain technology is simply a modernization of BFT, with a focus on peer-to-peer networking and cryptographic authentication. The name comes from the way transactions are batched in blocks and are linked together to form a chain. CometBFT consists of two primary technical components: a blockchain consensus engine and an application interface. The consensus engine, based on the Tendermint consensus algorithm, ensures that all machines record the same transactions in the same order. The Application BlockChain Interface (ABCI) delivers transactions to applications for processing. Unlike other blockchain and consensus solutions that come with built-in state machines, CometBFT allows developers to use it for BFT state machine replication of applications written in any programming language and development environment that suits their needs. CometBFT is designed to be user-friendly, easy to understand, highly performant, and useful for a wide variety of distributed applications.

Compared to Other Consensus Algorithms

CometBFT can be compared to two categories of software. The first category is made up of distributed key-value stores like Zookeeper, etcd, and consul, which use non-BFT consensus algorithms. The second category is blockchain technology, which includes cryptocurrencies such as Bitcoin and Ethereum, as well as alternative distributed ledger designs like Hyperledger's Burrow.

Zookeeper, etcd and consul:

Zookeeper, etcd, and consul are all key-value store implementations that utilize classical, non-BFT consensus algorithms. Zookeeper employs Zookeeper Atomic Broadcast, while etcd and consul use the Raft log replication algorithm. A typical cluster comprises 3-5 machines and can withstand crash failures in less than 1/2 of the machines (e.g., 1 out of 3 or 2 out of 5), but a single Byzantine fault can pose a threat to the entire system. While each of these offerings provides a slightly different implementation of a feature-rich key-value store, they are all generally focused on providing fundamental services to distributed systems, such as dynamic configuration, service discovery, locking, leader-election, and so forth. CometBFT is essentially similar software, but it differs in two key ways: Firstly, it is Byzantine Fault Tolerant, which means it can only tolerate less than 1/3 of machine failures, but those failures can include arbitrary behavior such as hacking and malicious attacks. Secondly, it does not specify a particular application, such as a fancy key-value store. Instead, it concentrates on arbitrary state machine replication, enabling developers to create application logic that suits their needs, whether it be a key-value store, a cryptocurrency, an e-voting platform, or something else entirely.

Bitcoin, Ethereum, etc:

The Tendermint consensus algorithm, which is used by CometBFT, was developed in the tradition of cryptocurrencies like Bitcoin and Ethereum. Its primary objective was to provide a more efficient and secure consensus algorithm than Bitcoin's Proof of Work. Initially, Tendermint-based blockchains had a simple currency integrated into them, and users had to "bond" units of the currency to participate in consensus. This is what made Tendermint consensus a Proof-of-Stake algorithm. However, CometBFT has evolved to become a general-purpose blockchain consensus engine that can support arbitrary application states. This means it can be used as a plug-and-play replacement for the consensus engines of other blockchain software. For example, the current Ethereum code base can be run as an ABCI application using CometBFT, regardless of whether it's written in Rust, Go, or Haskell. The same approach can also be used for Bitcoin, ZCash, and other deterministic applications.