🎉 Gate.io Growth Points Lucky Draw Round 🔟 is Officially Live!
Draw Now 👉 https://www.gate.io/activities/creditprize?now_period=10
🌟 How to Earn Growth Points for the Draw?
1️⃣ Enter 'Post', and tap the points icon next to your avatar to enter 'Community Center'.
2️⃣ Complete tasks like post, comment, and like to earn Growth Points.
🎁 Every 300 Growth Points to draw 1 chance, win MacBook Air, Gate x Inter Milan Football, Futures Voucher, Points, and more amazing prizes!
⏰ Ends on May 4, 16:00 PM (UTC)
Details: https://www.gate.io/announcements/article/44619
#GrowthPoints#
Understand the consensus mechanism and 11 mainstream consensus algorithms in one article
Speaker: Uchiha Madara
EDIT: Puffs
Source:Deschool
This article is the study notes of the third lesson of DeSchool's web3 university course, and the lecturer is Uchiha Madara. The content is too dry and not mixed with water. It is recommended that you collect it and digest it slowly. In addition, in order to facilitate understanding, this article has some modifications and supplements based on the course content.
The main contents of the article include:
Introduction to Consensus Algorithms
Classification of consensus algorithms
Detailed explanation of consensus algorithms (PoW, PoS, PoH, PoA, PBFT, etc.)
01 Introduction to Consensus Mechanism
In the communication and learning of the blockchain, "consensus algorithm" is a very frequently mentioned vocabulary. It is precisely because of the existence of the consensus algorithm that the credibility of the blockchain can be guaranteed.
**1. Why do we need a consensus mechanism? **
The so-called consensus means that multiple people reach an agreement. Our life is full of consensus mechanisms. For example, a company needs shareholders to discuss collectively to make a decision, and Party A and Party B need to sit down and negotiate to sign a contract. This process is the process of reaching a consensus.
In the blockchain system, what each node must do is to make its ledger agree with the ledgers of other nodes. If it is in a traditional centralized scenario, this is hardly a problem, because there is a central server, which is the so-called master library, and other slave libraries can be aligned with the master library.
But in decentralized management, there is no boss, so how should decisions be made? At this time, a set of algorithms is needed to ensure consensus. This is what this article is going to talk about - the consensus mechanism.
**2. What is the consensus mechanism? **
The consensus mechanism (Consensus Mechanism) completes the verification and confirmation of transactions in a very short period of time through the voting of special nodes; for a transaction, if several nodes with irrelevant interests can reach a consensus, we can consider that the entire network There is also consensus on this.
Although consensus (Consensus) and consistency (Consistency) are considered to be approximately equivalent in many application scenarios, there are subtle differences in their meanings: Consensus research focuses on the process and algorithm of distributed nodes reaching consensus, while Consistency research focuses on the final stable state of the node consensus process; in addition, most of the traditional distributed consensus research does not consider the Byzantine fault tolerance problem, that is, it is assumed that there are no Byzantine nodes that maliciously tamper or forge data. After all, in a completely open and transparent blockchain network, there is no guarantee that all nodes will not do evil.
**3. What problems can the consensus mechanism solve? **
The consensus mechanism can solve the trust problem in the distributed system and ensure the data consistency and security among the nodes. In a traditional distributed system, since there is no trust mechanism between nodes, it is vulnerable to attacks and tampering by malicious nodes, resulting in system crashes or data tampering. In addition, before the emergence of blockchain encryption technology, encrypted digital currency, like other assets, was infinitely replicable. Without a centralized intermediary agency, people had no way to confirm whether a sum of digital cash had been spent.
To put it simply, the consensus mechanism can effectively solve two problems: the double-spend problem (a sum of money is spent twice) and the Byzantine general problem (malicious nodes tamper with data).
4. Double spend attack
**
**
The consensus mechanism can solve the double spend attack to a certain extent: that is, a sum of money is spent twice or more than twice, also called "double spend". In the cat-and-mouse game, Xiao Lizi made a double-spending behavior by making a fake check. Because the verification of the check takes time, he used the information of the same check to purchase items many times within this time difference.
As we all know, blockchain nodes always consider the longest chain as the correct one and keep working and extending it. If two nodes broadcast different versions of a new block at the same time, work will be done on the basis of the block received first, but the other chain will also be kept in case the latter becomes the longest chain. Wait until the next proof-of-work is found, and one of the chains proves to be the longer one, then the nodes working on the other branch chain will switch camps.
How is double spending achieved? Divided into two situations:
**(1) Double spend before confirmation. **Zero-confirmed transactions may not have been written to the blockchain in the end. Unless the amount is small, it is best to avoid such double spending by at least waiting for confirmation.
**(2) Double spend after confirmation. **This requires controlling more than 50% of the computing power to implement. That is, similar to a small fork, putting transactions for a store into orphan blocks. This kind of double spending after confirmation is difficult to implement, but it is only theoretically feasible.
** There are three most common double-spend attacks: 51% attack, race attack, and Finney attack. **
51% attack: A 51% attack is when a person or group gains control of 51% of the hashing power of the blockchain, which means they have the ability to control some aspects of the project. On a proof-of-work blockchain such as Bitcoin, this would be achieved by gaining control of the network's mining power. On the other hand, for a proof-of-stake blockchain such as Cardano, this would be achieved by controlling 51% of the staked tokens.
Race Attack: A user sends two transactions to two merchants (or the merchant and the user) at the same time. Therefore, the attacker receives two sets of goods or receives the goods and recovers the original transaction cost.
Finney attack: A miner mines a block or series of blocks that contain transactions that transfer money to his own address. The blocks that are mined are not published, but are kept while the miner transfers money to the merchant. The merchant then releases the goods the miner paid for before the miner publishes the block they have dug. The miners then publish the blocks that have been dug, which will erase the transfer to the merchant and let the merchant pay for it out of pocket.
Classic case of double flower attack:
In 2018, the attacker controlled more than 51% of the computing power on the BTG network. During the period of controlling the computing power, he sent a certain amount of BTG to his wallet on the exchange. This branch was named branch A. At the same time, send these BTG to another wallet controlled by yourself, and this branch is named branch B. After the transaction on branch A is confirmed, the attacker immediately sells BTG to get cash. Subsequently, the attacker mines on branch B. Since it controls more than 51% of the computing power, the length of branch B soon exceeds the length of branch A, and branch B will become the main chain. Transactions on branch A It will be rolled back to restore the previous state. The BTG that the attacker exchanged for cash before returned to his own hands, and these BTG are the loss of the exchange. In this way, the attacker, relying on more than 50% of the computing power control, realized the "double spending" of the same cryptocurrency.
5. Byzantine failures
**
**
The Byzantine Generals' Problem is a hypothetical problem posed by Leslie Lamport in the 1980s. Byzantium was the capital of the Eastern Roman Empire. Due to the vast territory of the Byzantine Roman Empire at that time, the garrisons of each army were far apart, and the generals could only deliver messages by messengers. In the event of war, generals must develop a unified plan of action.
However, there are traitors among these generals, who hope to undermine the consistent action plan of the loyal generals by influencing the formulation and dissemination of the unified action plan. Therefore, the generals must have a predetermined method agreement, so that all loyal generals can agree. And a handful of traitors cannot make loyal generals make wrong plans. In other words, the essence of the Byzantine generals problem is to find a way to make the generals establish a consensus on the battle plan in a non-trust environment with traitors.
In distributed systems, especially in the blockchain network environment, it is also similar to the Byzantine general environment, there are normal servers (similar to loyal Byzantine generals), there are faulty servers, and saboteur servers (similar to traitorous Byzantine general). The core of the consensus algorithm is to form a consensus on the state of the network among normal nodes. If there are only 3 nodes, the Byzantine generals problem is unsolvable. When there are x problem nodes in the nodes and the summed points are less than 3x+1, the Byzantine generals problem has no solution.
The emergence of Bitcoin easily solves this problem. It adds cost to information transmission, reduces the rate of information transmission, and adds a random element so that only one general can broadcast information within a certain period of time. The first general to broadcast a message is the first computer to find a valid hash, and as long as other generals receive and verify this valid hash and the information attached to it, they can only update them with the new information copy of the ledger, and then recalculate the hash value. The next general who calculates the effective hash value can attach his updated information to the effective hash value and broadcast it to everyone. The hash computation race then restarts from a new starting point. Due to the continuous synchronization of network information, all computers on the network use the same version of the ledger.
02 Classification of Consensus Algorithms
1. History of Consensus Mechanism
When computers and networks became popular in the 1980s and 1990s, shared databases emerged so that multiple users could access the information they stored. Most have a central database that users can access from different sites. This setup evolves into a centralized network where administrators grant user permissions and maintain data integrity.
These shared databases are known as distributed ledgers because they record information and are networked for access by many users in different locations. One of the most important issues to be addressed is preventing data tampering and unauthorized access, malicious or not. A way to automate distributed database management is needed to ensure data is not changed.
This need has led to the creation of distributed autonomous consensus, where programs on the network use cryptography to agree on the state of the database. The protocol is designed to be reached by using a cryptographic algorithm to create a long string of alphanumeric numbers (hash), which is then verified by a program running on the network. The hash only changes when the information fed into the hashing algorithm changes, so programs are designed to compare the hashes to make sure they match.
When every program running on the network has created a matching hash string, the data is said to have reached consensus across the network. Thus, a consensus mechanism was established, usually crediting the anonymous Bitcoin creator Satoshi Nakamoto. However, many people worked on the consensus mechanism for years before Satoshi released the white paper that made Bitcoin famous.
Data and computer scientists such as Moni Naor, Cynthia Dwork, Adam Beck, Nick Szabo, and many others worked on and contributed to the development of the network's consensus mechanisms.
2 Classification of Consensus Algorithms
According to different types of fault tolerance, consensus algorithms can be divided into two categories: CFT consensus algorithm (non-Byzantine fault tolerance, that is, malicious nodes are not considered) and BFT consensus algorithm (Byzantine fault tolerance, that is, malicious nodes are considered) .
Whether to tolerate Byzantium marks whether the algorithm can be applied to low-trust networks. Generally speaking, the Byzantine fault-tolerant algorithm must be used in the public chain environment, while in the alliance chain, it can be selected according to the degree of trust between the participants of the alliance. If the degree of trust is high, everyone is a good-faith node by default and can use the CFT algorithm (non-Byzantine fault-tolerant ).
**In addition, it can be divided into two categories according to consistency: **probability consensus algorithm and absolute consistency algorithm. The probabilistic consensus algorithm means that among different distributed nodes, there is a high probability to ensure that the data between the nodes is consistent, but there is still a certain probability that the data between some nodes is inconsistent. For example, Proof of Work (PoW), Proof of Stake (PoS) and Delegated Proof of Stake (DPoS) are all probabilistic consensus algorithms.
The absolute consistency algorithm means that at any point in time, the data between different distributed nodes will remain absolutely consistent, and there will be no data inconsistency between different nodes. For example, the PAXOS algorithm and its derived RAFT algorithm.
The following is a specific division and introduction according to the type of fault tolerance.
3CFT Consensus Algorithm
Crash Fault Tolerance non-Byzantine error: suitable for networks with a high degree of node trust. Including Paxos, Raft.
4BFT Consensus Algorithm
Checking whether the node has malicious Byzantine errors tends to a decentralized structure, including proof of work (PoW), proof of stake (PoS), delegated proof of stake (DPoS), proof of authority (PoA), etc.
03 Detailed Explanation of Consensus Algorithm
Is it a little tired to see this, click a favorite, take a break and continue to gnaw the hardest part of this article! Students with limited time can start directly from the third PoW algorithm.
1Paxos Algorithm
**
**
The early Basic Paxos protocol was complex and relatively inefficient, so an improved version of Paxos was proposed later. For example: Fast Paxos, Multi-Paxos and Byzanetine Paxos, etc.
Paxos proceeds through a set of negotiation rounds in which one node has the "leadership" state. If the leader is not online, progress will stall until a new leader is elected, or if the old leader suddenly comes back online.
Paxos divides the roles in the system into proposer (Proposer), decision maker (Acceptor), and final decision learner (Learner): Proposer: proposes proposal (Proposal). Proposal information includes proposal number (Proposal ID) and proposed value (Value). Acceptor: Participate in decision-making and respond to Proposers' proposals. After receiving the Proposal, the proposal can be accepted. If the Proposal is accepted by the majority of Acceptors, the Proposal is said to be approved. Learner: Do not participate in decision-making, learn the latest agreed proposal (Value) from Proposers/Acceptors.
2. Raft Algorithm
**Algorithm introduction:**Raft (Replication and Fault Tolerant) algorithm is a simplified implementation of Paxos algorithm pair. The name Raft comes from "Reliable, Replicated, Redundant, And Fault-Tolerant" Redundant, Fault Tolerant") acronym. raft makes a lot of nice simplifications over Paxos with log continuation. It guarantees the consistency of the system when more than half of the nodes in a system composed of n nodes are working normally. Unlike the Paxos algorithm, which is directly derived from the distributed consistency problem, the Raft algorithm is proposed from the perspective of a multi-copy state machine, and is used to manage the log replication of the multi-copy state machine. For example, in a 5-node system, 2 nodes are allowed to have non-Byzantine errors, such as node downtime, network partition, and message delay.
**Use case: **Database master-slave replication, alliance chain.
Algorithm principle: There are three roles in the Raft system: Leader, Follower, and Candidate. Under normal circumstances, there will only be one leader, and the others are followers. And the leader will be responsible for all external requests, if not received by the leader's machine, the request will be directed to the leader. Usually the leader will send a message at a fixed time, that is, a heartbeat (heartbeat), to let followers know that the leader of the cluster is still operating. Each follower will design a timeout mechanism (timeout). When the heartbeat is not received for a certain period of time (usually 150 ms or 300 ms), the system will enter the election state.
At this time, the cluster enters a new election round (term) and starts an election. If the election is successful, the new leader will start to perform work. Otherwise, the term will be considered as terminated, and a new term will start and the next election will start.
Elections are run by candidates. This requires candidates to nominate themselves and solicit votes from other servers on a first-come, first-served basis when the leader's heartbeat stops. Each server casts only one vote per election round for or against the current candidate. If you do not get more than half of the votes, you will go to the next round of elections. The remaining candidates continue to nominate themselves on a first-come, first-served basis. until a leader is elected.
**Advantages of the Raft algorithm: **The first point is simplicity. If we dig deep into where Paxos is more complex than Raft, Heidi Howard and Richard Mortier found that Paxos' complexity is reflected in two aspects. First, Raft commits logs sequentially, while Paxos allows logs to be committed out of order, but requires an additional protocol to fill log holes that may arise as a result. Second, all replicas of the log in Raft have the same index, term, and order, whereas in Paxos these terms may differ.
The second point is that Raft has an efficient leader election algorithm. The election algorithm given in the Paxos paper compares the size of the server id. When several nodes run for election at the same time, the node with the larger server id wins. The problem is that if the leader elected in this way lacks some logs, it cannot immediately perform the write operation, and must first copy some logs from other nodes. The Raft log can always select the node with the majority log, so there is no need to catch up with the log. Although sometimes the election will be retried due to the division of votes, it is generally a more efficient election algorithm.
For the Paxos algorithm, if a server is very far behind, even a few days behind in logs, but is elected leader at some point, this will cause a certain amount of time to block. In the Raft algorithm, a node whose log is behind will never be selected.
3 Proof of Work (PoW)
Algorithm Introduction: A computer technology that was first used to fight spam. In 2008, Satoshi Nakamoto proposed Bitcoin and blockchain in the Bitcoin white paper "Bitcoin: A Peer-to-Peer Electronic Cash System", and innovatively designed the PoW algorithm, which was applied to Bitcoin to solve a Mathematical puzzles to participate in consensus. The core content of the algorithm is to use computing power to find a nonce value that satisfies the block hash. However, people quickly discovered the problems of this consensus mechanism, that is, the large energy consumption and the control of computing power by large mining pools will still lead to centralization problems.
**Use cases:**Bitcoin, ETH1.0, Litecoin, Conflux, Dogecoin.
Algorithm principle: The main feature of the proof-of-work system is that the client needs to do some difficult work to get a result, but the verifier can easily check whether the client has done the corresponding work through the result. A core feature of this scheme is asymmetry: work is moderate to the requester and easily verifiable to the verifier. It differs from captchas, which are designed to be easy to solve by humans rather than computers.
Proof of Work (PoW) finds a numerical Nonce through calculation, so that the hash value of the content after the transaction data is pieced together meets the specified upper limit. After the node successfully finds a satisfactory hash value, it will broadcast the packaged block to the entire network immediately, and the nodes of the network will verify it immediately after receiving the broadcasted packaged block.
Disadvantages: Slow speed; huge energy consumption, not good for the environment; vulnerable to "economies of scale".
Pros: Extensively tested since 2009 and still widely used today.
4 Proof of Stake (PoS)
Algorithm Introduction: In 2011, Quantum was proposed on the Bitcointalk forum. In August 2012, Peercoin, the first blockchain project based on PoS consensus, was born. Peercoin is the first application to implement the PoS algorithm. The interest in Peercoin is the currency age. The currency age is the product of the number of coins held by the node and the holding time. Initiating a transaction will consume a certain amount of currency age. Every time 365 currency ages are consumed, an annual interest rate of 5% will be obtained.
Users: Ethereum(2.0), Conflux, Peercoin.
Algorithm principle: For example, if someone holds 100 Dotcoins in a transaction for a total of 30 days, then the currency age is 3000. Later, a PoS block is found, the currency age is cleared to 0, and interest is obtained It is 0.05*3000/365=0.41 coins. During the consensus process, the nodes obtain the bookkeeping right through the coin age consumed. The more coin age the node consumes, the greater the chance of obtaining the bookkeeping right. The principle of the main chain set by the algorithm is: the chain that consumes the most currency age is the correct and effective chain in the system.
Advantages: No need for powerful, expensive mining equipment. Reduce resource consumption and reduce the possibility of 51% attacks.
Disadvantages: It may cause the rich to hoard cryptocurrencies, forming the Matthew effect, which may cause cryptocurrency inflation.
5 Proof of History (PoH)
**Algorithm introduction: **Proof of history was created by Solana, a high-throughput blockchain that was launched in 2018. Proof of history enables network participants to reach a consensus on time by using a verifiable delay function, thereby avoiding The "longest chain" rule.
PoH is the clock of the network, and TowerBFT is its watchtower, tasked with preventing malicious nodes from spoofing time parameters. Any validator who voted for a block must wait for the next block to be produced and get confirmation from the proof of history that "time has passed" before voting again.
Solana cleverly separates the hash-based time chain and state. Instead of linking the hashes of each block together, the verifier in the network hashes the hash itself in the block. This mechanism is PoH . PoH establishes a cryptographically verifiable sequence of events over time by using a high-frequency Verifiable Delay Function (VDF). Essentially, this means that PoH is like a cryptographic clock that helps the network agree on time and the order of events without waiting for messages from other nodes. The sequential output of historically proven blockchain state hashes gives a verifiable sequence of events.
**User:**Solana
Algorithm principle: Leader generates a time stamp for each signature data (transaction to be proved), and directly sorts the transactions, thus avoiding the problem of time sorting in PoS, and each guarantee verifier can verify independently , which greatly shortens the problem of time reordering during verification, and only needs to verify the transaction proof.
Advantages: Low fees, only a fraction of a cent per transaction, fast transaction speed, good scalability,
**Cons: **Centralization concerns, Solana currently has less than 1200 validators validating transactions on its network. Fewer decentralized applications: Often referred to as the Ethereum killer. According to its website, more than 350 Dapps have been created on Solana, compared to nearly 3,000 on Ethereum, and this is where Defi currently needs more development time and innovation.
6 Proof of Authority (PoA)
Algorithm Introduction: It was proposed in 2017 by Gavin Wood, the co-founder of Ethereum (ETH) and Parity Technologies. The PoA mechanism does not mine and does not require Token. In a secondary PoA-based blockchain network, all transactions and blocks are processed by validators. The maintenance cost of the PoA platform is low, but in PoA, the verifier of the transaction and verification blockchain must be a person who can pass the reliability review. Therefore, PoA verifiers must pay great attention to their own reputation. Reputation is a very important asset in PoA. Typically, validators disclose their actual identities. At present, the blockchain technology formed by this consensus mechanism is mainly applied to alliance chains and private chains with obvious industry characteristics.
Users: PoA, Ethereum Kovantestnet, xDai, VeChain, and Walmart's logistics chain.
Algorithm principle:
a. Choose an authoritative certifier;
b. A number of verifiers will generate blocks to record transactions and receive block rewards and transaction fees. In PoA, the verifier is the key to the entire consensus mechanism. The verifier obtains the right to guarantee the network by placing this identity in exchange for block rewards. If the verifier acts maliciously or colludes with other verifiers throughout the process, the malicious actors can be removed and replaced through on-chain management. Existing legal anti-fraud safeguards are applied across the network to protect participants from malicious actions by validators.
advantage:
a. Requires less computing power, no mining, energy saving and environmental protection;
b Verification is fast and supports faster transactions;
c. The verifiers of the entire network supervise each other, and they can vote to join the experienced verifiers or eliminate unqualified verifiers at any time
d. Hard forks are protected by law, and each Validator signs a legal agreement.
shortcoming:
a. Public identity, privacy and anonymity will be reduced
b. Validators are designated as legally backed centralized authority nodes
**7 Delayed Proof-of-Work (**Delayed Proof-of-Work, dPoW)
**
**
**Algorithm introduction:**Before explaining DPoW, you need to explain what PoB is. PoB (Proof of Burn) is called the burning proof mechanism, which is a commitment to vote who has the leadership of the network by burning the tokens in one's own hands. The higher the number of burned tokens, the higher the probability of attaining network leadership.
In the dPoW-based blockchain, miners are no longer rewarded tokens for mining, but "wood" that can be burned - burning wood. The miners use their own computing power to finally prove their workload through the hash algorithm, and then obtain the corresponding wood, which cannot be traded. When the wood has accumulated to a certain amount, you can go to the burning site to burn the wood.
After calculation by a set of algorithms, the person who burns more wood or BP or a group of BP can obtain the right to produce a block in the next event segment, and obtain a reward (Token) after successfully producing a block. Since there may be many people burning wood in a period of time, the probability of block generation in the next period of time is determined by the amount of wood burned by oneself. The more burned, the higher the probability of obtaining the right to produce blocks in the next period of time.
This can achieve a balance between computing power and mining rights. Miners and mining pools with huge computing power are not necessarily required to become block producers. Small miners also have a spring, as long as they work hard and accumulate a certain amount of wood, they can also produce blocks. Guaranteed efficiency, everyone's participation, the most popular way of participation guarantees the concept of decentralization, and prevents organizations with computing power or large currency holders from dominating the network.
**User:**Komodo
Algorithm principle: There are two types of nodes in the dPoW system: notary nodes and normal nodes. The 64 notary nodes are elected by the stakeholders of the dPoW blockchain to add notarized blocks from the dPoW blockchain to the attached PoW blockchain. Once a block is added, the block's hash is added to the Bitcoin transaction signed by the 33 notary nodes and creates a dPow block record hashed to the Bitcoin blockchain. The record has been notarized by a majority of notary nodes in the network.
In order to avoid mining wars between notary nodes and reduce the efficiency of the network, Komodo has designed a mining method using a polling mechanism, which has two operating modes.
In the "No Notary" mode, all network nodes are supported to participate in mining, which is similar to the traditional PoW consensus mechanism. In "Notaries Active" mode, network notaries mine using a significantly reduced network difficulty rate. In the "notary activation" mode, each notary is allowed to use its current difficulty to mine a block, while other notary nodes must use 10 times the difficulty of mining, and all normal nodes use 100 times the difficulty of notary nodes to mine.
**Advantages: **Energy saving; increased security; can add value to other blockchains by indirectly providing Bitcoin (or any other security chain), without paying the price of Bitcoin (or any other security chain) transactions.
Disadvantages: Only blockchains using PoW or PoS can adopt this consensus algorithm; in the "Notaries Active" mode, the hashes of different nodes (notaries or normal nodes) must be calibrated rate, otherwise the difference between hash rates would explode.
8 Authorized PoS (DPoS, Delegated Proof-of-Stake)
Algorithm Introduction: The DPoS mechanism, also known as the "Share Authorization Proof Mechanism" and "Trustee Mechanism", was proposed in April 2014 by Dan Larimer (BM), the chief developer of Bitshares. From a certain point of view, DPOS is a bit like a parliamentary system or a people's congress system. If a delegate fails to perform their duties (fails to produce a block when it is their turn), they are delisted and the network elects a new supernode to replace them.
To facilitate understanding, another example can be given. Imagine a company with a total of 1,000 employees, each of whom holds varying amounts of company shares. Every once in a while, employees can vote for the 10 people they most recognize to lead the company, and each employee's voting rights are proportional to the number of shares he holds. After everyone votes, the 10 people with the highest vote rate will become the leaders of the company.
If a leader is incompetent or does something detrimental to the company, the employee can revoke the vote for the leader, so that his vote rate cannot enter the top 10, thereby resigning from the management.
Users: BitShares, Steemit, EOS, Lisk, Ark.
**Pros: **Energy saving; fast; high traffic blog site Steemit uses it. The block time of EOS is 0.5 seconds.
**Cons: **Slightly centralized; participants with high stake can vote to become a validator (this has been a problem in EOS recently).
9 Practical Byzantine Fault Tolerance (PBFT)
**
**
Algorithm introduction: In the PBFT algorithm, one node will be regarded as the master node, while the other nodes are backup nodes. All nodes in the system will communicate with each other, and the ultimate goal is that everyone can reach a consensus on the principle of the minority obeying the majority.
Consensus Process:
a. The client sends a request to the master node to perform an operation
b. The master node broadcasts this request to each backup node
c. All nodes execute the operation and return the result to the client
d. When the client receives f+1 identical results from different nodes, the process ends. f represents the maximum value of possible lying nodes.
Used by: HyperLedgerFabric, Stellar, Ripple, Dispatch
**Advantages: ** High speed, scalable.
Cons: Commonly used in private and permissioned networks.
10 Delegated Byzantine Fault Tolerance (dBFTDelegated Byzantine Fault Tolerance, dBFT)
Algorithm introduction: The Chinese blockchain community NEO (formerly known as Xiaoyi) proposed an improved Byzantine fault-tolerant algorithm dBFT. This algorithm draws on the PoS design idea on the basis of PBFT. The bookkeeper, and then the bookkeepers reach a consensus through the Byzantine fault-tolerant algorithm. This algorithm improves the lack of final consistency of PoW and PoS, making the blockchain suitable for financial scenarios.
Also to solve the Byzantine Generals Problem, the "Authorized Byzantine Fault Tolerance" mechanism is a consensus algorithm that guarantees fault tolerance implemented inside the NEO blockchain. In this mechanism, there are two participants, one is the "bookkeeping node" for professional bookkeeping, and the other is an ordinary user in the system.
Ordinary users vote to determine the bookkeeping nodes based on the proportion of their holdings. When a consensus needs to be passed, a spokesperson is randomly selected from these bookkeeping nodes to draw up a plan, and then other bookkeeping nodes follow the Byzantine fault-tolerant algorithm. That is, the principle of minority obeying the majority makes a statement. If more than 66% of the nodes agree with the speaker plan, the consensus is reached; otherwise, the speaker is re-elected and the voting process is repeated.
Since all delegates can verify block proposals, it is easy to understand whether the data sent by the speaker is valid or invalid. So if the speaker is dishonest and sends an invalid proposal to two thirds of the delegates, the blocks will not match and the node owners will not validate them. A consensus is reached with a two-thirds vote and a new speaker is elected.
**User:**Neo
Consensus Process:
a. Anyone can be a representative as long as he or she meets the requirements. All NEO token holders can vote, delegates are not anonymous, and 1,000 GAS is required to become a node owner.
b. A speaker is chosen at random from among the delegates.
c. The speaker constructs a new block from the transactions awaiting verification. The Speaker then sends the proposal to the elected representatives. They are supposed to track all transactions and log them on the network.
d. Delegates are free to share and compare proposals they have received to test the accuracy of the data as well as the honesty of the speakers. If more than two-thirds of the delegates reach a consensus and validate it, the block is added to the blockchain.
**Advantages: **Fast (it takes 15-20 seconds to generate a block); large transaction throughput, no need to consume energy, scalable, and no forks.
Disadvantages: There is no anonymity, and a real identity is required to operate to be elected. Everyone is vying to be the root chain. There may be multiple root chains.
11. Rotation Practical Byzantine Fault Tolerance (RBPFT)
Algorithm introduction: The principles of dBft and RPBFT are similar to PBFT, except that not all nodes participate in the consensus, but the nodes are divided into two types:
a. Consensus node: a node that executes the PBFT consensus process and has the authority to generate blocks in turn
b. Verification node: do not execute the consensus process, verify whether the consensus node is legal, block verification, after several rounds of consensus, it will switch to a consensus node
In round-robin Byzantine fault tolerance, consensus nodes are replaced by verification nodes in turn.
**Use Case:**Fisco-BCOS
**Advantages: **The transmission speed is faster than gossip, and there is no redundant message packet
Divide and conquer, the outbound bandwidth of each node is O(1), strong scalability
Disadvantages: The intermediate node is a single point and requires additional fault tolerance strategies
12. AptosBFT
**
**
Algorithm introduction: It is also a derivative algorithm of PBFT. The consensus algorithm named after Aptos is based on HotStuff, which is based on PBFT. The advantages of this algorithm model are like onions and Russian dolls, which need to be peeled off layer by layer. Each node only communicates with the leader, rather than sending messages to the leader and all other "generals". The leader broadcasts a message (proposed block) to vote on; each node sends its vote to the leader who collected the message.
Use Case: Aptos
Finally, a summary of this part is attached:
**Also, there are some uncommon consensus algorithms. **
In 2015, Professor David Mazieres, chief scientific officer of Stellar.org, proposed the Stellar Consensus Protocol (SCP). SCP evolved on the basis of the Federal Byzantine Agreement and the Ripple Agreement, and is the first provably secure consensus mechanism, with four key properties of decentralized control, low latency, flexible trust and asymptotic security.
In the same year, Hyperledger's Sawtooth Lake project combined Ripple and SCP consensus and proposed a Quorum voting consensus algorithm to deal with application scenarios that require instant transaction finality.
In 2016, Turing Award winner and MIT professor Sivio Micali proposed a fast Byzantine fault-tolerant consensus algorithm called AlgoRand. This algorithm uses cryptographic lottery technology to select the verifier and leader of the consensus process, and through its designed BA* The Byzantine Fault Tolerant Protocol reaches a consensus on new blocks. AlgoRand requires very little computation and very few forks, and is considered to be a truly democratic and efficient distributed ledger consensus technology.
In 2017, Cornell University proposed a new algorithm called Sleepy Consensus (sleeping consensus). This consensus is aimed at the fact that most of the large-scale consensus nodes in the Internet environment may be offline, and only a few nodes are online The reality of participating in the consensus process. This study proves that the traditional consensus algorithm cannot guarantee the security of consensus in this environment. However, using the dormant consensus algorithm, as long as the number of online honest nodes exceeds the number of faulty nodes, security and robustness can be guaranteed.
##04 Summary
If you jump out of the developer's perspective and include more ways of thinking that combine politics and economy, there may be more consensus algorithms, such as combining consensus methods similar to the concept of PPP, which can not only achieve the nature of punishment for malicious parties, but also It may also achieve the goal of saving computing power most efficiently.
In short, the consensus mechanism is the core of blockchain technology. It can solve the trust problem in the distributed system, ensure the data consistency and security between nodes, and avoid the attack and tampering of malicious nodes, thus ensuring the block The stability and reliability of the chain system. At the same time, the consensus mechanism can also solve the "double spending" problem and improve the throughput and processing speed of the blockchain system. But various consensus algorithms are not absolutely safe, efficient, and decentralized.
There is no best algorithm, only the algorithm that suits you best. The choice of consensus algorithm is highly related to the application scenario. Trusted environments use Paxos or RAFT, permissioned alliances can use PBFT, and non-permissioned chains can use PoW, PoS, Ripple consensus, etc. **The best consensus mechanism is always the one that suits user needs. **