Analysis of Facebook LibraBFT and the consensus of the original chain Bystack BBFT

If what is the soul of the blockchain, it must be a consensus mechanism.

It is the root of the blockchain. Regardless of the public chain or the alliance chain, the consensus mechanism has limited the transaction processing capability and scalability of the blockchain.

On June 18, 2019, Facebook published a white paper on its Libra project, which attracted widespread attention. As an important project for Facebook to create an international digital currency, the Libra blockchain uses the LibraBFT consensus mechanism, a robust and efficient state replication system designed for Libra. It is based on a new BFT consensus algorithm, HotStuff.

Shortly before the release of the Facebook Libra project white paper, May 17th, the BaaS platform Bystack was released than the original chain. This is a commercial blockchain system with a main multi-sidechain architecture. The main chain uses PoW consensus to ensure diversified asset security and decentralization. The sidechain provides pluggable consensus to meet different business needs. At the same time, Bystack itself has created a DPoS+BBFT consensus algorithm for the sidechain.

The same is the BFT-like consensus mechanism. What is the difference between LibraBFT and BBFT?

Bystack-main chain multi-side chain architecture (Source: Bystack White Paper)

The significance and current status of the blockchain consensus mechanism

Consensus is the agreement that a node in a distributed system reaches for the final state of data or network. Due to the uncontrollable network environment and node status, the consensus mechanism needs to consider performance, reliability, security and other aspects.

From a broad perspective, the consensus mechanism can be divided into two categories: the CDC and other local consensus mechanisms, and the Byzantine Fault Tolerance (BFT) consensus mechanism. The BFT consensus mechanism is widely used in various alliance chains.

The PoW consensus is widely used in the Permissionless chain, but its probabilistic model sacrifices efficiency and wastes a lot of computing resources while providing higher reliability. In a specific business application environment, the Permissioned mechanism has guaranteed a certain degree of node trust (Semi-Trust). Under this premise, users are more concerned with execution efficiency (TPS) and finality (Finality). This is why the BFT consensus is popular in the alliance chain.

Comparison of mainstream consensus mechanisms

BFT consensus mechanism

BFT (Byzantine Fault Tolerance) is Byzantine fault tolerance. It is a distributed computing fault tolerance technology.

Computers and networks may experience unpredictable behavior due to hardware errors, network congestion or outages, and malicious attacks. Byzantine fault-tolerant technology was designed to deal with these anomalies and reach consensus on the basis of fault tolerance.

Unlike the Nakamoto consensus derived from Bitcoin, in the BFT agreement, once a consensus is reached, a deterministic result is formed directly, rather than the ultimate agreement on the probability of the Nakamoto consensus.

BFT-like consensus is widely used in financial scenarios and alliance chain scenarios. At the same time, with the advancement of technology, the BFT consensus on the application of public chain scenarios is also emerging.

PBFT consensus mechanism

The Practical Byzantine Fault Tolerance Algorithm (PBFT) is the first practical consensus algorithm for implementing Byzantine fault tolerance in asynchronous distributed networks.

The PBFT algorithm can work in an asynchronous environment and optimizes the problem of the inefficiency of the original Byzantine fault-tolerant algorithm. The algorithm complexity is reduced from exponential to polynomial, making the Byzantine fault-tolerant algorithm feasible in practical system applications. It has been widely verified. The PBFT algorithm can guarantee both safety and delivery (liveness) without failing more than 1/3 of the total number of failed nodes.

Regardless of Facebook Libra's LibraBFT consensus protocol, or the original BBFT consensus mechanism of Bystack, it fully absorbs the advantages of PBFT on the bottom layer, adopts the existing time-proven processing method, and has some shortcomings and shortcomings in PBFT. They have made innovations in different directions.

Facebook Libra's LibraBFT Consensus Agreement

As mentioned earlier, Libra uses the LibraBFT consensus based on HotStuff.

HotStuff is a three-stage BFT algorithm. It combines the view switching process with the normal process, and no longer has a separate view switching process, which reduces the complexity of view switching.

When switching views in HotStuff, a node in the system does not need to confirm the message "Sufficient nodes want to switch views" and then notify the new master node. Instead, it can directly switch to the new view and notify the new master node. HotStuff puts the behavior of confirming that "sufficient nodes want to switch views" into the normal process. This expands the two-stage validation of PBFT into a three-stage validation.

Another important change in HotStuff is the transformation of PBFT's mesh communication network topology into a star communication network topology. In HotStuff, each communication relies on the primary node. The node no longer broadcasts the message to other nodes through the p2p network, but sends the message to the master node, which is processed by the master node and sent to other nodes. Thanks to the star communication network topology, the communication complexity of the system is greatly reduced. Similar to PBFT, the primary node proposes a state transition, and other nodes check their legitimacy after receiving the state migration request.

LibraBFT collects votes between 3f+1 verification nodes, which may be honest nodes or may be Byzantine nodes. Under the premise of 2f+1 honest nodes in the network, Libra can defend against double-attack and bifurcation attacks of f-authenticated nodes.

LibraBFT is effective in a partially synchronized network with global unified time (GST) and network maximum delay (ΔT) controllable. Also, LibraBFT guarantees network consistency when all authentication nodes are restarted.

BBFT consensus mechanism than the original chain Bystack

Blockchain application layering and impossible triangles (Source: Bystack White Paper)

According to the Bystack white paper, BBFT is a derivative consensus based on practical Byzantine fault-tolerant PBFT, a hierarchical Byzantine fault-tolerant consensus algorithm. In the case of guaranteeing Byzantine fault tolerance, that is, allowing a small number of nodes (f ≤ N / 3) to do evil, it has the following characteristics:

(1) Configurable

Modular pluggable design, on-demand configuration, and to some extent compatibility with new technologies (Future-Proof).

This is a core competitive point for Bystack. The concept of cross-chain has been widely concerned in recent years and is also an important direction for the development of blockchain. Supporting modular plug-ins, Bystack has the imaginary space of cross-chain direction, and has the ability to form a blockchain system that is truly scalable and compatible with other mainstream consensus mechanisms.

This compatibility allows BBFT to make other affiliate chain public chains a side chain, making it more than just a blockchain operating system, and forming a blockchain operating system ecosystem. In this way, the imagination space will be big.

But of course, to achieve this level, there may be a long way to go in technology implementation. Compatibility is a direction that consumes a lot of R&D costs. It is not difficult but cumbersome. It's hard for BBFT to do its best from the very beginning, and it's only one step at a time.

(2) Adaptability (Adaptive)

That is, it provides stable execution efficiency for different network environments.

BFT requires nodes to exchange verification results to achieve a majority consensus. In general, each node needs to get enough (≥(2/3)*N) replies from other nodes to make a valid judgment. Network delay directly affects the efficiency of information interaction. Especially in cross-regional cross-border applications, delay will become the bottleneck of network operation.

In BBFT, the consensus node maintains the current network topology, and nodes that are similar in terms of the shortest path principle take priority communication. The aggregation of communications can further reduce latency. At the same time, similar to PBFT, the role of the leader in BBFT is weakened, and the consensus node can make more than 2/3 votes to make a decision, so that the leadership network communication is blocked, and the entire network decision is not generated. huge impact.

(3) Scalable

Ensure that consensus complexity increases linearly or sub-linearly with network capacity.

On the one hand, the more consensus nodes, the higher the reliability of the network; on the other hand, the complexity O(N^2) of the node communication in the traditional PBFT increases exponentially with the network capacity, which greatly limits the number of nodes. The effective aggregation of messages in BBFT can effectively reduce the number of times a message is sent, thus ensuring the complexity requirement of O(N). Combined with the network topology, the network can be divided into multiple layers, message data can be effectively shared in the same layer, and spread across layers in the form of multi-signal aggregation. Multi-sign verification can use existing mature

Solutions such as the Shnorr signature-based MuSig algorithm can protect against Rogue Key Attack attacks while ensuring multi-signal verification efficiency.

(4) Heterogeneous

Separate consensus verification and communication.

Consensus agreement requires verification and communication, but there is no strong correlation between the two. A low-coupling consensus framework can further improve network reliability and efficiency.

The verification module often depends on the specific user logic and has certain requirements for computing power and security. The communication module and user logic are relatively independent, primarily handling network connections and requests. The calculation and selection of the network topology and the shortest path can be done here. Since it is independent of user logic, the communication module can be docked in the form of an abstraction layer (AbstractionLayer) or middleware (Middleware).

The advantages of heterogeneity are also reflected in the best things to do with the best tools. Verification and communication allow for operation on different systems and in different operating environments, maximizing performance against the power of different hardware and security guarantees (TrustZone).

The two main features of BBFT are:

Multi-layer structure. Layered according to the network. The traditional BFT is a single-layer structure with only one leader node and several consensus nodes in the same position. The innovation of BBFT lies in the fact that there are small leaders under the big leaders. If the leaders have problems, they will not have a big impact on the network, which is equivalent to weakening the role of leadership. Moreover, due to the multi-layer structure, network communication can be split and recombined to optimize the delay and quantity of network communication.

The communication complexity of traditional PBFT is exponential and difficult to expand. As the number of nodes in the network skyrockets, the overall network delay may be severe. By combining tiered and cryptographic signatures, BBFT effectively combines the entire network structure to ensure linear growth in communication complexity rather than exponential growth.

Configurability. The sidechain project on Bystack is actually divided into three modules, one is the underlying consensus algorithm, the other is network partitioning, and the third is signature aggregation. Among them, network partitioning and signature aggregation are relatively independent modules, and different network layering algorithms, signature aggregation algorithms, and consensus layer algorithms can be used. Different reasonable solutions can be flexibly selected according to specific user scenarios.

LibraBFT vs BBFT: Common and Difference

LibraBFT and BBFT

LibraBFT transforms PBFT's mesh communication network topology into a star communication network topology to reduce system communication complexity; BBFT uses a multi-layer structure to split network traffic and recombine to optimize the latency and number of network communications.

LibraBFT merges the view switching process with the normal flow, and extends the two-stage acknowledgment of PBFT into a three-stage acknowledgment; BBFT modifies the three states of the classic BFT algorithm, the pre-final state and the final state to only one final acknowledgment state. .

Both can be seen as an upgrade of the PBFT consensus, absorbing the results and advantages of the existing BFT-like consensus, and on this basis to expand in different directions. The LibraBFT consensus mechanism is more of an innovation based on PBFT. More attention is paid to the algorithm itself. There are many modifications and optimizations for PBFT. BBFT is more hierarchical control at the level, and more is a system-wide thinking. . What BBFT hopes to achieve is not only an efficient consensus mechanism, but also a consensus mechanism that can integrate other consensus mechanisms. Dimensions, BBFT allows LibraBFT to access directly, taking advantage of all the advantages of the other side in the side chain. LibraBFT is the first order change and BBFT is the second order change.

It is obvious that Bystack is more concerned with making good use of existing consensus mechanisms, integrating different consensus mechanisms, and complementing each other's strengths. This is very prominent in the overall architecture of Bystack. For example, the main side chain adopts different consensus and organic combination, and the side chain uses DPoS+BBFT. The hybrid consensus algorithm is configurable… Bystack doesn't just want to do the blockchain operating system, it actually has the operating system operating system meaning.

The research on the blockchain consensus mechanism has been going on for a long time, but it has not been said that the progress of the paradigm breakthrough has been made from the PoW consensus.

Perhaps the blockchain is compatible with the consensus mechanism of other chains to achieve a smooth cross-chain, so that any chain can be entered as a side link, which can become a paradigm breakthrough in the direction of the blockchain, bringing a new imagination. Perhaps this is why the cross-chain concept is more popular now.

Perhaps like the head of the Bystack consensus algorithm, Wang Wei said, the "single public chain single algorithm" model is no longer feasible, because the user scene is too much, a public chain can not solve all problems.

Author: Beep