Foreword: Decentralization characteristics determine the need for consensus in the blockchain. The consensus mechanism of the blockchain has gradually developed new models from the PoW of Bitcoin, such as PoS and BFT. Boca uses a hybrid consensus algorithm. The consensus mechanism has always been a key area for the development of blockchain technology. The author of this article, Edward A Thomson, is translated by the "HQ" of the "Blue Fox Notes" community.
To better understand why we need to introduce consensus algorithms into blockchain technology, we need to understand what issues are solved by Bitcoin's blockchain technology? There are two most critical issues:
- Double payment
- Centralized currency issuance
This article first introduces Bitcoin's approach to solving the above problems. Secondly, it discusses some subtleties of consensus, such as fault tolerance and finality (short for final certainty). Finally, some projects are discussed as examples and the future direction is discussed.
- Comment: Is mining a good business?
- Opinion: Does the whale drive the bitcoin bull market on its own?
- Encrypted investor customers interested in acquiring 25% of total Bitcoin supply
- The Fed plans to launch an interbank real-time payment system, and the encryption community said: Bitcoin to consider
- China and the United States upgrade each other, BTC welcomes golden moments
- 1 BTC = $ 5224, does Bitcoin usage currency make sense?
How does Bitcoin solve the problem of dual payment and currency issuance?
To understand why fault tolerance is so important to blockchain, it is necessary to explain two issues that Bitcoin solves (double flowering and centralized currency issuance).
In other words, in order to prevent arbitrary overshoot, Bitcoin issues money in a predictable, transparent and decentralized manner. The mechanism for managing the money transfer and issuance process is a consensus algorithm that ensures consistency (consensus) throughout the history of the transaction.
Consensus algorithms are not new in the era of blockchain technology. It is important to emphasize why Bitcoin is innovative: because in a public, unlicensed network, Bitcoin can be achieved even if there are potential malicious actors. Consensus .
PoW consensus algorithm
As we all know, the blockchain of PoW like Bitcoin, the node maintains the security of the entire network by obtaining the SGD reward generated by creating a new block. The reward provides an incentive mechanism for miners to be honest at the same time as they create new blocks as quickly as possible.
The key to winning is that creating a new block requires solving a unique and computationally difficult mathematical problem. The difficulty of its mathematics fundamentally limits the speed at which new blocks are generated, and the uniqueness of the answers allows the network to identify the winning nodes (through their addresses). Although malicious behavior is not specifically punished, there is no incentive to do it because of the opportunity cost of dishonest behavior.
One problem that exists is that the communication between nodes is not instantaneous, so nodes in different geographic regions of the network may receive different blocks (network partitions/forks) that claim to have solved the problem. Two different nodes (miners) may happen to solve the problem legally, but because the entire network is not instant communication, different partitions in the network will choose to build blockchain based on different winning blocks ( Temporary). This causes a temporary fork, but since there are always new blocks added to each branch, there will always be a longer branch.
Choosing the longest block branch is actually a rule that Bitcoin sets to achieve consensus. This rule is called the longest chain rule. Blocks on shorter branches are discarded, and all transactions that are not on the primary branch are eventually added to the block in the primary branch. Please note that illegal transactions (for example, those that attempt to make double payments) will not be included in the block that constitutes the longest chain. Blocks containing such transactions will also be discarded, as any "currency" can only be spent once. It should be noted here that most nodes are honest (at least 51%) and these nodes will not attempt to break the protocol.
In theory, a new longest chain can be created by having a stronger mining power. But this is the biggest risk for blocks close to the "head of the chain" (the most recently generated block). The deeper the block is deeper across the chain, the less likely it is to be reversed.
This means that the blocks on the PoW chain will always be reversed, so the transactions in these blocks may not happen. In a maliciously created chain, transactions are not saved in new blocks for the reasons described above.
The Bitcoin White Paper suggests that waiting for six blocks is enough to ensure that transactions are not rejected because the chances of a block being dropped are very small. We can get to know "final certainty" (hereafter referred to as finality) from here: blocks that cannot be reversed can be called "finalized". In bitcoin and other PoW blockchains, the finality is not perfect, because blocks are always reversed.
As explained above, Bitcoin has strong robustness against failures and can be issued in a decentralized manner in both public and unlicensed networks. By exploring ways to ensure finality, a higher level of security can be ensured. This view will be explored in the later part of the fault tolerance section.
It should also be noted that some Proof of Entitlement (PoS) blockchains operate in a similar way to Bitcoin. Most PoS chains use electoral blocks instead of mining. Unlike the PoW chain, which allows the winning miner to create the next block, the new block of the PoS chain is created by randomly selected nodes ("leaders").
The probability of being selected (creating a new block) is determined by the number of equity. The idea is that the more coins you hold, the more you want the blockchain to succeed, so such a node will get a higher probability of creating the next block.
Byzantine agreement and fault tolerance
When a participant violates the protocol, an error occurs. For blockchains, because there may be malicious actors trying to exploit the weaknesses of the protocol, we want the protocol to be secure enough to withstand any failure. Any protocol that can withstand any failure is also safe enough to protect against random failures and malicious actors.
The Byzantine Fault Tolerance (BFT) agreement works fine even if a small percentage of participants behave abnormally. A node that is misbehaving may be an unexpected failure or a malicious act. Of course, it is assumed here that most of the participants are in compliance. This view is mentioned in a research paper entitled "The Question of General Byzantine." The question is how multiple participants agree on a simple message.
When a consensus is reached in the Byzantine agreement, the agreed good results must be correct. In other words, the agreed outcome can be seen as deterministic, not probabilistic. When applied to the blockchain, the Byzantine algorithm guarantees the ultimateity of the transaction. This means that once an agreement is reached in the block, the block is finalized and the transactions cannot be reversed.
Obviously this is different from Bitcoin and other PoW chains. As mentioned above, those chains can only achieve a certain degree of certainty. The type of consensus in Bitcoin is often referred to as the “Zhongbencong Consensus.” It is easy to see why it is confused with Byzantine fault tolerance, because both are fault-tolerant, but only the latter can guarantee final certainty. Deeper confusion comes from the fact that bitcoin block creation is highly overlapping with consensus algorithms. But in fact, this is not necessary .
One of the proposals for Ethereum's future route is to continue to produce blocks by miners as it is now, but it will allow some nodes to act as verifiers to provide final certainty, thus strengthening consensus. The certifier votes on the created block. By voting for a block, they say they think the block is correct. Once two-thirds of the verifiers vote, the block can be considered final. This post-mining Byzantine consensus mechanism is called the “final deterministic component”.
Most new projects being developed separate the block creation from the consensus. Some blockchains in the future will also adopt a hybrid consensus algorithm. This section will introduce some of the future directions being explored.
Cosmos's block creation is also done by leaders who are randomly selected (by weight of equity), but there is no longest chain rule in Cosmos's consensus. Accordingly, it uses a Byzantine algorithm called Tendermint. This means that each block guarantees final certainty. In addition, if the verifier cannot agree on a single block, Cosmos will temporarily stop to prevent forks in accordance with Cosmos's design.
Polkadot uses a hybrid consensus algorithm. The block will be created by a random leader who will add the next block to the longest chain. Polkadot will also adopt the Byzantine agreement, but instead of generating only one block per round of voting, multiple blocks will be finalized in one vote.
One benefit of using a hybrid consensus mechanism is that the blockchain can continuously produce blocks on the longest chain, while ultimately achieving Byzantine final certainty without affecting chain activity (ie, the chain will never be stopped).
Currently in Polkadot's current test network PoC-2 (also known as Krumme Lanke), the consensus is similar to Cosmos. The block is generated by a randomly selected verifier node, and after finalization by the Byzantine protocol, the next block is reproduced.
Simply put, Cardano's consensus algorithm is similar to Bitcoin (the longest chain rule). Block production is done by randomly selected leaders. The Cardano team has gone to great lengths to solve some of the problems that arise when randomly selecting leaders. They have ensured that the randomness of the selection leader is consistent with the current way of bitcoin.
However, Bitcoin has no leader and the block is produced by random miners. The solution to the mining problem will be distributed near the miners who have the largest hashing power.
Ethereum has also tried to strengthen the consensus algorithm by adding a step that guarantees final certainty after the block is released. Blocks are still generated by PoW, but there will be a set of certifier nodes that vote for the correctness of the exited blocks. This is the so-called "final deterministic component." That is, the method combines the longest chain rule with the Byzantine fault tolerance algorithm: a mixture of two consensus algorithms.
There seems to be some recent indication that Ethereum will likely use PoS to replace PoW, keeping Ethereum in line with the new chain being developed. The block will be created by a random leader and then finalized by a finalization component.
The “old age” of the blockchain focuses on using PoW mining and using the longest chain of rules to enhance network consensus. Later, in order to use a more energy-efficient way, I began to try to use PoS instead of mining. The past PoS chain still uses the longest chain rule; however, the trend in recent years has been to incorporate the Byzantine fault-tolerant protocol into a consensus mechanism: instead of using the longest chain rule (Cosmos), or letting both coexist (Ethereum and Polkadot).
In the next article, we'll take a closer look at how Polkadot's consensus algorithm works. They also developed a standard specification, but it has not yet been officially released.
Risk Warning: All articles in Blue Fox Notes do not constitute investment recommendations . Investment is risky . Investment should consider individual risk tolerance . It is recommended to conduct in-depth inspections of the project and carefully make your own investment decisions.