Author: Decred contributor, Richard Red
The consensus mechanism of the blockchain is used to ensure that participants agree on the current state of the blockchain consistent. The consensus mechanism determines which nodes can add new transaction blocks, and one of its main goals is to ensure that the blockchain is not rewritten.
Blockchain with proof-of-work consensus (like Bitcoin) can only be created by miners, who deploy hardware and figure out how to efficiently solve a specific mathematical problem. Every time a miner completes a valid guess, the blockchain network can accept the block they constructed. While miners can choose either chain to perform computations on, the network only accepts the chain with the most proof of work (i.e. the most hashes or computations) as legitimate. This means that miners are incentivized to mine on the longest chain, and when they discover a new block that is valid, they will try to find a solution on how to build on the new block.
The difficulty in rewriting the blockchain lies in its role as a ledger that records financial transactions. When a transaction that sends funds to a wallet appears in a block, and other blocks (confirmed) have been built on top of that block, it will not be possible for the block (transaction) to be rewritten.
If an entity controls enough hashing power to attack the "real chain", it can replace the latest by rebuilding the "old" block Blocks realize the rewriting (or reconstruction) of the blockchain. The following is a brief description of this type of attack, also known as a 51% attack:
The attacker first deposits funds to the exchange, the transaction is recorded in block X, and then the attacker starts Build another parallel chain on its own (without broadcasting the block to the network). When the required number of confirmations for the deposit transaction is reached, the attacker will convert the tokens into other currencies and withdraw them from the exchange. When the withdrawal transaction is completed, the attacker releases a independently constructed parallel chain, and if this blockchain has more PoW (blocks) than the original chain, the network will accept it as a legitimate chain, while the original blockchain ( (containing the attacker's recharge transaction) will become a historical version and disappear. The attacker is then free to use the tokens again.
Since miners are the only entities that can add blocks directly to the blockchain in PoW-like cryptocurrencies, this gives them an important role in governance. If the consensus rules need to be modified in the blockchain network, they must be supported by the majority of hash calculation examples. A "soft fork" requires enough miners to re-identify the new consensus rules so that users can transact and expect their transactions to be processed correctly and transaction data packaged in blocks. "Hard fork" will divide the original blockchain network into two parts, and most miners accept that "the chain with PoW of work is the correct chain", and miners will have the right to decide which chain is considered to be legal.
Proof-of-Stake consensus is another way to decide which miners can add new A way to block and verify the current state of the blockchain. Solving the problem through proof of stake, rather than competition among miners, determines the next block producer through some mechanism based on the number of tokens (or "stake") in the wallet. The consensus process is based on the principle that those with the most interests will make responsible and reasonable decisions for the entire network.
Proof-of-stake consensus eliminates the need for energy-intensive mining activities, but the lack of significant energy expenditure creates another problem, sometimes referred to as “irrelevance . ”Take forks as an example, fake POS ("forging" is usually used instead of "mining") will be mined on two chains separately, because the cost of creating another chain is very small. , so they can earn profits on both chains at the same time. This is a problem for blockchain networks, because the purpose of the consensus mechanism is to only recognize that there is one legitimate chain, and only recognize the status of the legitimate chain.
Proof-of-stake has some other problems with token distribution. PoW miners have high costs (hardware, electricity) and typically need to sell a large portion of the tokens they mine to meet these costs. Therefore, many mined coins can be purchased on the market and are not hoarded by miners. The cost of counterfeiting proof-of-stake is very low, and they do not need to sell the tokens they obtain in order to maintain network operations. Large stake holders who participate in proof-of-stake tend to increase their share of tokens in circulation because they collect large amounts of rewards and transaction fees from network users. This has been likened to feudalism, where the network is owned and controlled by large token holders, and users are required to pay them fees for their use. In POS, some restrictions are usually set so that ordinary users cannot directly participate in the proof-of-stake consensus.
The goal of hybrid proof-of-work and proof-of-stake systems is to combine Both have strengths and balance each other's weaknesses. Decred is one of the few cryptocurrencies that uses a mixture of PoW and PoS consensus mechanisms, and integrates them to produce a multi-factor and hybrid consensus mechanism.
In some sense, "Masternode coin" is also a hybrid mechanism, because they have an identifiable proof-of-work component, perform a similar role to Bitcoin, and are special nodes additional roles. These special nodes also typically hold a certain amount of tokens as collateral to prove that they can be trusted and are in the best interest of the network, similar to a proof-of-stake mechanism. Dash is the original masternode token and calls this model Proof of Service. This article focuses on components with hybrid proof-of-stake, so it will not discuss the range of tokens taking into account masternode tokens or proof-of-service.
Decred's PoW component is similar to other PoW-based projects and uses the Blake-256 hash function. The PoS component of Decred and how it builds a blockchain is quite unique and deserves further explanation.
To participate in Decred's proof of stake, holders must lock their DCR and purchase "tickets." The price of individual tickets is set by a market-like mechanism, with the system aiming to obtain a certain number of tickets (40,960) - if the target number is exceeded, the price increases, if the number is not reached the price decreases. When a user purchases a ticket, the DCR they use is locked (i.e., they cannot spend it), and the locking period lasts until their ticket is voted on by a pseudo-random function call, or until it expires in approximately 142 days. This creates an opportunity cost for the PoS mechanism, a way to ensure that PoS voters get a fair shot at the game and act in the best interest of the network.
PoS participants (also known as voters or stakeholders) can play three different roles: refuse to vote, vote on changes to the consensus rules, and use the Politeia rating system Take a vote on project level management. The first role, "refuse to vote", is the most direct way for PoS voters to participate in maintaining consensus.
When PoW miners find a valid block, they is broadcast on the network, and in order for the block to be considered valid, it must have at least 3 of the 5 randomly selected votes in the block. PoS voters are required to keep their wallets open and are required to RSVP (or have a voting service provider represent them) when their votes are called. When a certain POS ticket is called for voting and responding, its owner will receive the reward.
When tickets are called, they vote on the previous block's regular transactions, choosing to accept or reject them. Nodes on the network will not consider a new block to be valid until it receives at least 3 votes. If a majority of the tickets refuse to vote for the transaction in the previous block, they will be returned to the mempool. These regular transactions include rewards for PoW miners, but not for PoS voters.
Therefore, PoS voters have the right to deprive miners of their rewards without affecting their own profits. This limits the power of PoW miners and prevents them from tampering with the network consensus rules, which must be voted on by stakeholders. In fact, when malicious or inefficient behavior is detected, PoS voters can "veto" these malicious miner behaviors by voting. In this way, malicious PoW miners are prevented from tampering with transactions and obtaining illegal rewards.
This PoS verification layer can significantly improve the security of the network and protect against most attacks. The common method used in most double-spend attacks is to rewrite the blockchain by replacing the existing chain with private and stealthy mining, and then publish it after a period of time and render transactions in the "old" chain invalid (i.e., They can double-spend). Since Decred blocks require an input of randomly selected tickets to be considered valid, and blocks cannot be built by PoW miners until this input is received, it is impossible for PoW miners to mine in secret unless they also control Most tickets (see article below).
The design of a hybrid PoW/PoS mechanism can significantly increase the cost of network attacks because attackers must circumvent two independent systems at the same time. Especially if the PoS component is configured to only acquire tickets slowly. Only a limited number of tickets can be purchased per block, and purchasing a large number of tickets will cause a sharp increase in price. Additionally, once tickets need to be purchased, the funds used to purchase them are locked, locking up the attacker's funds for the attack and exposing them to the risk of devaluation.
Having randomly selected stakeholders vote on each block means that the blockchain must be shared with the nodes where all participants mine, thus enhancing the security of the network. Decred’s hybrid mechanism is designed to provide stakeholders with power beyond PoW miners.
Decred decided at the beginning to let PoS stakeholders become the district The dominant decision-making force in blockchain governance. Modifying or writing consensus rules requires an approval upgrade process, through which network consensus rules can only be modified after a vote. And changes can only be made if at least 75% of the vote agrees. The process begins if a certain percentage of miners (95%) and voters (75%) are running upgrade software and making potential changes to the rules. If the amendment proposal receives more than 75% support after the 4-week voting period, it is accepted, otherwise it is rejected, and if the number of votes is insufficient, voting starts again. If the proposal is accepted, the modifications to the consensus mechanism will be activated after one month.
Decred’s block rewards are divided into PoW miner rewards (60%), PoS voter rewards (30%), and Treasury (10%), which are used to fund open source software contributors who develop the project. Ticket holders have the right to vote on how this part of the funds should be used, what features should be added, and make decisions through the Politeia platform.
Since PoS voters receive 30% of the block reward, they cannot simply hold existing equity while maintaining their relative share in DCR circulation. Most of the new DCR are obtained by mining from PoW miners, thus alleviating their "irrelevance" problem in the PoS system and also playing their role in protecting the network. Miners must sell most of the rewards they receive to maintain their operating costs, so this approach ensures a reasonable supply of DCR in the market.
Decred blockchain presents a unique architectural model and is one of the most well-known examples of hybrid PoW/PoS systems. As with the significant changes in the PoS consensus mechanism in the group, future projects deployed through the hybrid PoW/PoS mechanism are also unique and will not necessarily follow the existing Decred framework.