Skip to content

DiemBFT

DiemBFT

Overview

DiemBFT is the consensus protocol of the Diem blockchain (formerly Libra), a production-grade implementation and optimization of the HotStuff BFT consensus algorithm. As one of the core technical components of the Diem project, DiemBFT was designed specifically for a global-scale payment network, providing high throughput, low latency, and deterministic finality while guaranteeing Byzantine fault tolerance.

DiemBFT inherits HotStuff's advantages of linear communication complexity and simplicity, with multiple optimizations and extensions tailored to Diem's practical needs. These improvements include a more efficient view change mechanism, optimized network transmission protocols, enhanced liveness guarantees, and more, enabling high-performance operation in networks of hundreds of validator nodes.

As a consensus scheme for permissioned blockchains, DiemBFT achieves a good balance between security, performance, and decentralization. The protocol has undergone rigorous formal verification and security auditing, providing a reliable consensus foundation for financial-grade applications. Although the Diem project has ceased operations, DiemBFT's technical innovations have been inherited and developed by subsequent projects such as Aptos and Sui.

Core Features

Byzantine Fault Tolerance

DiemBFT can tolerate up to ⅓ of validator nodes experiencing Byzantine failures (including malicious behavior, crashes, network partitions, etc.) while still guaranteeing system safety and liveness. This fault tolerance is achieved through a three-phase commit mechanism and ⅔+ supermajority voting.

Deterministic Finality

Once a transaction is confirmed by DiemBFT, it has deterministic finality and will not be rolled back or reversed. This differs from the probabilistic finality of PoW blockchains, providing stronger security guarantees for financial applications. In typical scenarios, transactions achieve finality confirmation within seconds.

Epoch Management

DiemBFT uses an epoch mechanism to manage validator set changes. Each epoch lasts for a certain number of blocks, and at the end of an epoch, validators can be safely added or removed, and stake weights can be updated. This design allows dynamic adjustment of the validator set while maintaining stable operation.

Stake-Weighted Voting

Validators' voting weight is proportional to the amount of Diem tokens they have staked. This design incentivizes validators to stake more tokens for greater influence, while economic incentives ensure honest behavior (malicious behavior results in stake slashing).

Pipelined Consensus

DiemBFT employs pipelining techniques, allowing the next block to be prepared in parallel while processing consensus for the current block. This overlapping processing significantly increases throughput, enabling the protocol to achieve performance of thousands of TPS.

Fast View Change

When a leader fails or underperforms, DiemBFT's view change mechanism can quickly switch to a new leader, typically completing within seconds. The optimized view change protocol reduces communication overhead during the transition, ensuring system liveness.

Core Advantages

High Performance

DiemBFT can achieve throughput of thousands of TPS and sub-second transaction confirmation latency in networks of hundreds of validator nodes. This far exceeds the performance of traditional BFT protocols (such as PBFT), meeting the needs of a global payment network.

Scalability

The linear communication complexity of O(n) enables DiemBFT to support hundreds of validator nodes, a significant advantage over traditional BFT protocols' O(n^2). This enables the construction of large-scale decentralized networks.

Security Assurance

DiemBFT has undergone rigorous formal verification, proving its safety and liveness properties. The protocol has also been through multiple rounds of security auditing, reviewed by top security firms such as Trail of Bits and NCC Group, ensuring implementation correctness.

Responsiveness

The protocol features responsiveness, adapting confirmation times based on actual network latency rather than preset timeout parameters. This allows the protocol to maximize performance when network conditions are favorable.

Modular Design

DiemBFT's design is highly modular, clearly separating consensus logic, network transmission, persistent storage, and other components. This design facilitates testing, maintenance, and upgrades, and also makes it easier for other projects to learn from and improve upon.

Working Mechanism

Block Proposal

Each view has a leader responsible for proposing new blocks. The leader selects transactions from the mempool, packages them into a block, and broadcasts it to all validators. The block contains transaction data, a reference to the previous block, the leader's signature, and other information.

Three-Phase Voting

After receiving a block proposal, validators go through three phases of voting: 1. Prepare: Validators check block validity and cast Prepare votes 2. Pre-commit: After collecting ⅔+ Prepare votes, validators cast Pre-commit votes 3. Commit: After collecting ⅔+ Pre-commit votes, validators cast Commit votes

After completing all three phases, the block achieves finality confirmation.

Signature Aggregation

After the leader collects validator signatures, threshold signature technology is used to aggregate multiple signatures into a compact proof. This dramatically reduces the amount of data that needs to be propagated, improving network efficiency.

State Synchronization

Lagging nodes can rapidly catch up to the latest state through the state synchronization mechanism without needing to re-execute all historical transactions. This is especially important for newly joining validators or nodes that have been offline for extended periods.

Comparison with Other Consensus Mechanisms

vs PBFT

Compared to PBFT (Practical Byzantine Fault Tolerance), DiemBFT reduces communication complexity from O(n^2) to O(n), supporting larger validator networks. Additionally, DiemBFT's design is more concise and easier to understand and implement.

vs Tendermint

Tendermint is another popular BFT consensus algorithm adopted by projects like Cosmos. DiemBFT and Tendermint share similar design philosophies, both being improvements on PBFT. However, DiemBFT inherits a more elegant pipeline design and view change mechanism from HotStuff.

vs PoW/PoS

Compared to Proof of Work (PoW) or Proof of Stake (PoS), DiemBFT provides deterministic finality and faster confirmation speeds, making it more suitable for financial payment scenarios. However, DiemBFT requires a known validator set and is not suitable for fully open public chain environments.

Applications and Legacy

Diem Blockchain

DiemBFT served as the core consensus layer of the Diem blockchain, providing financial-grade performance and security guarantees for the project. Although the Diem project ultimately stopped due to regulatory reasons, DiemBFT's technical achievements have been preserved.

Aptos and Sui

Former Diem team members founded the Aptos and Sui projects, both built on improved versions of DiemBFT: - Aptos uses AptosBFT, adding features such as a validator reputation system and parallel execution optimization - Sui adopted the innovative Narwhal-Bullshark consensus, decoupling consensus from execution

Academic Impact

DiemBFT's design and implementation experience has provided valuable case studies for BFT consensus algorithm research, with multiple academic papers analyzing its performance, security, and engineering practices.