January 09, 2025

The blockchain distributed system faces the consistency problem and the theoretical knowledge analysis of the consensus algorithm

The consensus mechanism has become a key bottleneck in the performance improvement of the current blockchain system.

A single consensus algorithm has various problems. For example, the PoW algorithm consumes a lot of computing resources and has low performance problems, PoS or DPoS has the problem of "rich rule", and the idea of ​​merging the advantages of multiple consensus algorithms is receiving more and more attention. .

Challenges faced by distributed systems

Blockchain is a distributed system, and the first problem that a distributed system encounters is consistency.

In a distributed system, consistency refers to: for multiple service nodes in the system, given a series of operations, under the guarantee of an agreement (often through a certain consensus algorithm), they try to achieve a certain degree of processing results. Unanimous.

If a distributed system cannot guarantee consistent processing results, any business system built on it will not work properly.

The main challenges faced by distributed systems include:

1) Resource constraints: The communication between nodes needs to pass through the network, and the network has bandwidth limitations and delays, and the nodes cannot achieve instant response and high throughput.

2) Independence of failure: Any module of the system may fail. For example, the network communication between nodes is unreliable, and network failure or arbitrary delay may occur at any time; the processing of the node may be wrong, or even the node itself at any time It may be down.

3) Opacity: The location, performance, status, and failure of any component in a distributed system are invisible and unpredictable to other components.

4) Concurrency: The purpose of a distributed system is to better share resources. Synchronous calls will block the system, so communication between nodes is usually designed to be asynchronous.

5) Lack of a global clock: When programs need to cooperate, they coordinate their actions by exchanging messages. Tight coordination often relies on a consensus on the time when the program action occurs. However, in fact, the accuracy of the synchronized clock of the computer on the network is greatly restricted, that is, there is no consistent concept of global time. This is a direct result of the fact that sending messages over the network is the only means of communication.

Due to the above-mentioned challenges, the consistency guarantee mechanism in distributed systems is the most critical and difficult area in the design of distributed systems. The theoretical basis for consistency in distributed systems has been relatively complete. Under the guidance of theory, academic Both the industry and the industry have proposed a lot of consensus algorithms to try to solve the consistency problem in distributed systems.

Next, let's first understand the theoretical basis of consistency in distributed systems, and then analyze several consensus algorithms that are widely used by blockchain projects based on theory.

The theoretical basis of consensus algorithm

FLP Impossibility Theorem

Because the consistency in synchronous communication has been proven to be achievable, there have been attempts to solve the consistency problem of asynchronous environments by various algorithms. However, the three authors of Fischer, Lynch and Patterson published a paper in 1985 in which they proposed and proved a theorem, the "FLP Impossibility Theorem":

In a minimized asynchronous model system where the network is reliable and there is node failure (even if there is only one), there is no deterministic algorithm that can solve the consistency problem.

FLP is impossible to theoretically prove that the worst case is that there is no lower limit, and it is impossible to achieve a perfectly fault-tolerant asynchronous consistent system.

CAP theorem

The FLP Impossibility Theorem only states that it is impossible to guarantee 100% consistency, which does not affect our exploration of distribution consistency.

For example, it is completely possible to achieve consistency of more than 99%; another example is to relax the time limit, that is, to require the system to eventually reach consistency after a period of time (if the consistency is not reached, the system is unusable), which can also be achieved; , Change part of the communication to be synchronous, sacrifice a certain amount of availability and throughput, you can get a more consistent agreement.

The CAP theorem describes the relationship between consistency and availability in a distributed system:

A distributed system can only meet at most two of the three elements of (strong) consistency (Consistency), availability (Availability) and partition tolerance (PartiTIon tolerance) at the same time.

The CAP theorem originated from a conjecture proposed by computer scientist Eric Brewer at the Symposium on Principles of Distributed CompuTIng (PODC) in 2000. In 2002, Nancy Lynch of the Massachusetts Institute of Technology (MIT) (the same Lynch who proved the FLP theorem) and Seth Gilbert published a proof of Brewer’s conjecture, making it a theorem.

For distributed data systems, partition fault tolerance is a basic requirement, because the existence of faults is inevitable. Therefore, to design a distributed data system is to strike a balance between consistency and availability.

Byzantine Generals Question

The Byzantine Generals Problem (Byzantine Generals Problem) is a distributed peer-to-peer network communication fault tolerance problem proposed by Leslie Lamport in his paper of the same name, which models the existence of malicious nodes in the network. Due to the existence of malicious nodes, the Byzantine Generals problem is considered to be one of the most difficult types of fault tolerance problems.

Leslie Lampert described the following issues in his paper:

A group of Byzantine generals each led an army to besiege a city together. In order to simplify the problem, the action strategy of each army is limited to two types: offense or evacuation. Because some troops attack and some troops leave may cause disastrous consequences, so generals must vote to reach a consensus strategy, that is, all troops attack together or all troops leave together. Because the generals are located in different directions in the city, they can only communicate with each other through messengers. During the voting process, each general informs all other generals about his vote for attack or retreat through messenger, so that each general can know the common voting result based on his vote and the information sent by all other generals. And decide the action strategy.

But the problem is that there may be traitors among generals. They may not only vote for worse strategies, but they may also selectively send voting information. Assuming that those loyal (or error-free) generals can still decide their strategy through a majority decision, they are said to have reached Byzantine fault tolerance. Here, the votes will have a default value. If the message (ticket) is not received, the default value will be used to vote.

The above story is mapped to a computer system, the general becomes a computer, and the messenger is a communication system. Although the above-mentioned problems involve electronic decision support and information security, there is no way to solve them solely with cryptography and digital signatures. Because abnormal voltage may still affect the entire encryption process, this is not a problem that cryptography and digital signature algorithms are solving. Therefore, the computer may submit wrong results, which may also lead to wrong decisions.

In a distributed peer-to-peer network, member computers that need to cooperate in accordance with a common and consistent strategy are the generals in question, and the network link on which each member computer communicates is the messenger. The Byzantine General’s Problem describes a situation where certain member computers or network links have errors, or are even controlled by saboteurs.

DSS conjecture

Different from centralized distributed systems, decentralization is a core feature of blockchain systems. In a decentralized system, in order to ensure the credibility of data, all nodes need to participate in consensus, avoid being attacked (such as 51% attacks), any node must have the ability to verify the legitimacy of transactions, and all transactions must be executed and verified in order. All nodes must save all transaction data and so on.

In a distributed system, scalability means that the overall performance of the system improves as the number of nodes increases. In the design of a centralized distributed system, scalability is one of the most basic requirements. For a centralized system, it is relatively simple to ensure scalability.

The requirement of decentralized full consensus and storage is difficult to expand. Because if scalability is required, nodes cannot be required to perform full and full storage, but to decentralize calculation and storage. Each node only saves part of the data, that is, each transaction data is only stored in a few nodes, but in this way, Security cannot be guaranteed, because an attacker can control block data as long as they attack a few nodes. For example, if the data is divided into 100 pieces and stored on different nodes, the attacker can control 1 piece of block data as long as he implements a 1% attack, and the difficulty of the attack is greatly reduced.

Due to the requirements of decentralization, the distributed system of the blockchain also has its own unique theories. One of them describes the contradiction between decentralization and scalability. It has not been rigorously proven and can only be called a conjecture, but In the actual system design process, you can feel the challenge from time to time:

DSS conjecture: for the three attributes of Decentralization, Security and Scalability, the blockchain system can only choose two of the three at most.

The blockchain distributed system faces the consistency problem and the theoretical knowledge analysis of the consensus algorithm

The figure above demonstrates how the blockchain chooses between these three factors and the corresponding strategies:

To meet security and decentralization, all nodes need to participate in consensus, calculation, and full storage, but the problem that this brings is the loss of scalability, that is, the overall performance of the system cannot be improved with the increase of nodes;

To meet scalability and security, centralized management is required, and the nodes participating in the consensus need to be trusted;

To meet scalability and decentralization, the strategy of decentralized storage and calculation is adopted. Without full consensus, the difficulty of attacking the network will be reduced, and the security will be difficult to guarantee.

Conditions that the consensus algorithm should meet

Although there are many kinds of algorithms and various strategies can be adopted as needed, the conditions that are generally recognized as ideal consensus algorithms should include:

1) Termination: consistent results can be completed within a limited time;

2) Consensus: The final decision-making results of different nodes should be the same;

3) Validity: The result of a decision must be a proposal made by another process.

Mono LCD

Mono LCD is a cutting-edge technology that delivers crystal-clear images with high contrast and sharpness. Our Mono LCD displays feature advanced technology that enhances the visual experience, making it ideal for gaming, designing, and professional use. With our Mono LCD screens, you can expect accurate color reproduction, excellent viewing angles, and fast response times. Our displays are designed to provide the best possible visual experience, making them the ultimate choice for anyone who demands the best. Whether you're a gamer, designer, or professional, Mono LCD displays are the perfect choice for enhancing your visual experience.

Mono LCD Displays,Mono LCD Screens,Mono LCD Monitors,Mono LCD Modules,Mono LCD Panels

ESEN Optoelectronics Technology Co., Ltd, , https://www.esenoptoelectronics.com