This article was written by Decred contributor Richard Red.


The consensus mechanism of a blockchain ensures that participants agree on the current state of the blockchain. The consensus mechanism determines who is able to add new transaction blocks and one of its main purposes is to ensure that the chain is not rewritten.


The Proof of Work consensus (PoW)

Blockchains based on pure Proof of Work consensus (like Bitcoin) can only be completed by miners, who use hardware that efficiently guesses the answer to a mathematical problem. Every time a miner makes a valid proposal, they can add a block that will be accepted by the network. Although miners can choose to mine any chain, the network will only accept the chain that has accumulated the most proof of work (i.e. the most hashes or guesses) as legitimate channel. This means that miners are incentivized to mine the longest chain, and when they see a new valid block appear, they will try to find the solution that will allow them to build the chain from this new block.

The difficulty of rewriting the blockchain is what allows it to function as a ledger for financial transactions. When a transaction appears in a block and sends coins to a wallet and several blocks have been mined above that block (confirmations), it becomes unlikely that the block (and therefore the transaction) will be rewritten.

If an entity controls enough hashing power to exceed the "honest chain", it can rewrite (or reorganize) the blockchain by mining an "old" block instead of the last block. Here you will find a simplified summary of this type of attack, also called a 51% attack:

The attacker spends through block Once the required number of confirmations is exceeded, the attacker exchanges the coins for something else and removes them from the exchange. When the takedown is effective, they release the parallel chain and, if it contains more blocks (PoW) than the original chain, the network will accept it as a legitimate chain and the version of history represented by the chain original (including the attacker's repository) will disappear. The attacker is then free to spend these coins again.

As miners are the only entities that can directly add blocks to the chain of PoW-type cryptocurrencies, this gives them an important role in governance. For any change in the network's consensus rules to be adopted, it must be supported by a majority of hashing power. Soft forks require enough miners who will recognize a new set of rules so that users can transact and expect their transactions to be processed correctly and included in blocks. “Hard forks” will divide the network into two parts and, according to the commonly accepted rule, “the chain with the most Proof of Work (PoW) is the good chain to follow”, it is then the miners who will decide which one. is accepted as legitimate.


Proof of Stake (PoS)

Proof of Consensus is an alternative method for deciding who can add new blocks and verifying the current state of the blockchain. Instead of miners competing to solve a problem, with proof of stake, the producer of the next block is determined by a process based on the number of coins (or coins) held in wallets (or “staked”) . This process assumes that those with the most stake will make responsible decisions for the entire network.

Proof of stake (or stake) consensus eliminates the need for energy-intensive mining, but the lack of significant energy expenditure creates another problem, sometimes referred to as “no stake.” In the case of a chain that has been “forked” (forked chain in English), PoS forgers (“forging” is generally used instead of the term “mining”) are incentivized to exploit both chains because they costs very little to mine an additional chain and they can get rewards on both chains. This is a problem for the network because there is only supposed to be one chain, and agreeing on the state of that single chain is the whole point of the consensus mechanism.

Proof of stake poses an additional problem when it comes to token distribution. PoW miners have significant costs (hardware, electricity) and usually have to sell a significant portion of mined coins to meet these costs. As a result, many mined coins are available for purchase on the market, rather than being stored by miners. Proof of Stake forgers have very low operating costs, and therefore do not have the same pressure to sell the coins they receive to maintain the network. Large holders who engage in Proof of Stake therefore tend to increase their share of the total amount of coins in circulation as they receive block rewards and transaction fees from network users. . This has even been compared to feudalism, as the network is effectively owned and operated by coin holders, and users pay them rents to use it. There is generally a limit below which it is not possible to participate directly in Proof of Stake.


PoW / PoS hybrid

The goal of hybrid Proof of Work (PoW) and Proof of Stake (PoS) systems is therefore to combine the advantages of each respective approach and use them to counterbalance the weaknesses of each. Decred is among the few cryptocurrencies that uses both PoW and PoS in recognizable forms and merges them to produce a multi-factor or hybrid consensus mechanism.

Masternode coins are, in some ways, also hybrids, in that they have a recognizable Proof of Work component that serves a similar role in the case of Bitcoin and an additional role for special nodes. ). It is usually necessary for these special nodes to hold a certain amount of the currency in question as collateral, in order to demonstrate that they can be trusted to act in the best interests of the network, which is similar to the logic of the proof of participation. Dash is the coin behind the concept of masternode and qualifies this model as Proof of Service. This article focuses on hybrids with a Proof of Stake component, and does not consider the multitude of coins mimicking masternodes or Proof of Service.

Decred's PoW component works similarly to other Proof of Work-based projects and uses the Blake-256 hash function. The PoS component of Decred and how it is implemented on-chain is quite unique and worth explaining.

To participate in Decred’s Proof of Stake, holders must lock their DCR for a certain amount of time to purchase “tickets”. The price of an individual ticket is set by a market-like mechanism, with the system targeting a set number of live tickets (40,960) - if there are more than the target number, the price increases, if it is lower, it falls. When a person buys a ticket, the DCR used is locked (i.e. they cannot spend it) until their ticket is pseudo-randomly drawn to vote or until their expires after approximately 142 days. This introduces an opportunity cost to PoS, intended to ensure that those voting on PoS are truly engaged and acting in the best interests of the network.

PoS participants (also called voters, electors, or shareholders) have three distinct roles to play: voting on the block, voting on changes to consensus rules, and voting on management at the overall project level. help of the Politeia Proposal System. The first type of vote, the “block vote,” is the way in which Proof of Stake (PoS) voters most concretely engage in maintaining consensus.


The Block Vote

When a PoW (Proof of Work based) miner finds a valid block, it broadcasts it to the network. However, for this block to be considered valid, it must include the votes of at least 3 of the 5 randomly selected tickets. Proof of Stake (PoS) voters keep their wallets open during this time and are ready to respond with votes when their tickets are called (or they hire voting service providers to do so on their behalf). When a PoS ticket is called to vote and responds, its owner receives a reward.

When tickets are called, they vote to accept or reject regular transactions from the previous block. Nodes in the network will not recognize a new block as valid until it includes at least 3 votes. If the majority of tickets called to vote reject the transactions from the previous block, they are then returned to the mempool. These regular transactions include the PoW miner's reward, but not the PoS voter's reward.

Therefore, PoS voters have the power to withdraw miner rewards without affecting their own rewards. This limits the power of PoW miners to veto changes to the network's consensus rules, which are voted on by all stakeholders. In reality, PoS voters can reject any type of miner behavior they don't like by adopting a policy of voting "no" when malicious or ineffective behavior is detected - which prevents bad miners from PoW to write transactions and receive rewards.

This PoS verification layer significantly strengthens the security and resistance of the network to majority attacks. The usual method of carrying out a majority double spend attack is to rewrite the blockchain by mining an alternative chain in secret, then broadcasting it after a certain period of time and taking advantage of rolling back transactions from the "old" chain (i.e. spending their inputs). As Decred blocks require input from randomly chosen tickets to be considered valid and PoW miners cannot take advantage of them until they receive that input, it is not possible for PoW miners to mine in secret, unless you also control a significant proportion of the tickets directly. (see these articles).

The hybrid PoW/PoS design significantly increases network attack costs because there are two separate systems that must be bypassed by the attacker. The PoS component, in particular, is configured in such a way that tickets can only be acquired very slowly. A limited number of tickets can thus be purchased in each block/interval, and purchasing the maximum number results in a large increase in price. Additionally, once these tickets have been purchased, the funds used to purchase them will be time-locked, leaving the attacker exposed to any devaluation of their locked coins as a result of the attack.

The requirement that each block be voted on by randomly chosen stakeholders means that the blockchain must be shared among all participants as it is mined, increasing the security of the network. Decred's hybrid system was designed to also give the parties involved power over PoW miners.


The consensus change vote

Decred decided from the start to make PoS stakeholders the dominant decision-making force in blockchain governance. An upgrade ratification procedure is included in the consensus rules. Any changes to the network consensus rules can only be deployed after the voting process is complete. Changes can only be made if approved by at least 75% of voting tickets. This process begins as soon as a certain proportion of miners (95%) and voters (75%) use software that has been upgraded with latent rule changes. If the proposal is approved by 75%, it is accepted after a 4-week voting period, otherwise, it is rejected and if it does not have a qualified majority, a new vote begins. If a proposal is accepted, the rule change activates one month later.

Le consensus hybride de PoW/Pos expliqué


Project management: Politeia

Decred block rewards are distributed among PoW miners (60%), PDS voters (30%) and a Treasury (10%) in order to finance the development of open source software contributing to the achievement of the project's objectives. Ticket holders have the sovereignty to vote on how this fund should be used, what features should be added, and what policy should be followed through the Politeia platform.


To conclude

Since Proof of Stake (PoS) voters receive 30% of the block reward, they cannot maintain their relative proportion of DCR in circulation simply by staking. The majority of newly minted DCR goes to miners of PoW in exchange for the role they play in securing the network and mitigating the “no stake” problem of pure PoS systems. Miners will generally have to sell a considerable portion of the rewards obtained to meet their operating costs, thus ensuring a proper supply of DCR in the market.

The Decred blockchain therefore presents a unique architecture and constitutes one of the most remarkable examples of a hybrid PoW / PoS (Proof of Work / Proof of Stake) system. Just as projects with PoS consensus are a category with significant variation, future projects that implement hybrid PoW/PoS approaches will also be unique and will not necessarily follow the structure Decred is experimenting with.