The Byzantine Empire, Turkey in the Middle Ages, had great wealth and was surrounded by 10 neighboring countries that had been around for a long time. However, the Byzantine Empire had high walls and was so impregnable that no single neighboring country could successfully invade. Any invasion by a single neighbor will fail, and it is also possible that it will be invaded by 9 other neighbors. The Byzantine Empire's defensive capabilities were so strong that at least half of its ten neighbors had to attack at the same time to be able to break through.
However, if one or several of the neighbors agree to attack together, but betrayal occurs during the actual process, then the invaders may all be annihilated.
So each party acted cautiously and did not dare to trust its neighbors easily. This is the Byzantine Generals Problem.
In the Byzantine problem, the most important point is: how all generals can reach an agreement to attack Byzantium. Among them, examples of possible situations are as follows:
Use a Explain the model:
Suppose there are only three people, A, B, and C. If one of the three is a traitor. When A issues an attack order, if B is a traitor, he may tell C that he received an order to "retreat." At this time, C received an "attack" and a "retreat", so C was confused by the information and was at a loss as to what to do.
If A is a traitor. He tells B to "attack" and C to "retreat." When C told B that he had received a "retreat" order, B was unable to align with C because he had received an "attack" order from the commander.
For the above reasons, in a system with only three roles, as long as one is a traitor, that is, the number of traitors is equal to 1/3, the Byzantine problem will be unsolvable.
It can be seen that as long as the number of traitors is greater than or equal to 1/3, the Byzantine problem is unsolvable
Technically understood, the Byzantine Generals Problem is a distributed system fault tolerance problem. Cryptocurrency is built on the P2P network and is a typical distributed system. By analogy, the general is the node in the P2P network, the messenger is the communication between nodes, and the decision to attack or retreat is the consensus that needs to be achieved. If an independent node computer expands, goes offline, or attacks the network to cause damage, the entire system will stop running. Such a system will be very fragile, so it is necessary to allow some nodes to fail or cause damage without affecting the operation of the entire system. , This requires the theoretical support of the algorithm to ensure that the distributed system still maintains consistency and availability even if a certain amount of error nodes exist.
Moreover, the problem of Byzantine generals is different from the problem of two armies. The former assumes that there is no problem with the messenger, but that the general has rebelled. The latter studies the communication problem of the messenger.
The ultimate solution has arrived——
If several of the 10 generals initiate messages at the same time, it will inevitably cause chaos in the system, causing everyone to have their own attack time plan, making it difficult to take action. consistent.
Anyone can initiate an offensive message, but who will send it? Satoshi Nakamoto cleverly added the cost of sending information to the system, that is:
The cost it adds is the "workload" - the node must complete a calculation to spread the message to each city-state. Of course, Whoever gets the job done first gets to spread the word. (This is also the meaning of the proof-of-work mechanism: proving how much work you have done in the past by testing the results)
This encryption technology, asymmetric encryption, can completely solve the difficult-to-solve signatures of ancient times. Question:
When Satoshi Nakamoto designed Bitcoin, it used a proof-of-work mechanism called Hash Cash. To find a random number in a transaction block, the computer could only use the exhaustive method. To find this random number, it can be said that whether it can be found depends entirely on luck, so for each node, only randomness is truly fair in this world. The best way to achieve randomness is to use mathematics. All generals are looking for The process of knowledge relies on mathematical logic that is recognized by everyone.
Of course, why should we be obligated to perform calculation work, then there must be an incentive mechanism: Bitcoin’s reward mechanism is to reward 25 Bitcoins for each block packaged, and the Byzantine Generals Problem The reward mechanism can be to divide the benefits obtained by Byzantium.
In this distributed network:
Each general has a message ledger that is synchronized with other generals in real time.
The signature of each general in the ledger can be used to verify the identity. If any messages are inconsistent, you can know which generals the messages are inconsistent with.
Although there is inconsistent information, as long as more than half agree to attack and the minority obeys the majority, political consciousness is achieved (as long as the majority are good people, then political consciousness can be achieved).
The consensus mechanism on the blockchain mainly solves the problem of who will construct the block and how to maintain the unity of the blockchain.
The Byzantine fault tolerance problem also needs to solve the problem of who initiates information and how to achieve unified synchronization of information.
Note: If you are new to blockchain learning, please point it out if there is anything incorrect.