What Is the Decred's Hybrid PoW/PoS Consensus?
Maintaining agreement among participants on the current state of a blockchain is the key role of its consensus mechanism. This mechanism is responsible for determining the individuals authorized to add new blocks of transactions. The primary objective of the consensus mechanism is to prevent the rewriting of the chain.
Proof of Work Consensus
The primary consensus mechanism used in blockchains like Bitcoin is pure Proof of Work. This mechanism enables miners to add new blocks to the blockchain by guessing the solution to a mathematical problem using specialized hardware. Once a miner makes a valid guess, they can construct a block that is accepted by the network. Although miners can mine on any chain, the legitimate chain is determined by the network by the most accumulated Proof of Work, which translates to the longest chain with the most hashes or guesses.
Accepting the Longest Chain
Miners are encouraged to mine on the longest chain because of the network's inclination to accept such a chain as the legitimate chain. When miners identify a valid new block, they attempt to find a solution for the subsequent block that allows them to build on top of the previous one.
The blockchain's difficulty in being rewritten is the foundation for its use as a financial transaction ledger. Once a transaction that sends coins to a wallet appears in a block and several blocks are built on top of it (confirmations), the likelihood of that block (and transaction) being rewritten is low.
In pure Proof of Work cryptocurrencies, if an entity has enough hashing power to exceed the honest chain, it can rewrite or reorganize the blockchain by mining on an old block instead of the most recent one. This type of attack is also known as a 51% attack.
The attacker spends coins in block X by sending them to an exchange and privately starts mining a parallel chain. The blocks are not broadcast to the network. After the required number of confirmations, the attacker trades the coins for something else and withdraws them from the exchange. Once the withdrawal is completed, the attacker releases the parallel chain. If the parallel chain has more Proof of Work than the original chain, it will be accepted by the network as the legitimate chain, and the version of history represented by the original chain, including the attacker's deposit, will vanish. The attacker is then free to spend the coins again.
Governance by Miners
Miners play a crucial role in the governance of pure PoW cryptocurrencies as they are the only ones who can add blocks to the chain directly. For any changes to the network's consensus rules to be implemented, it must have the support of a majority of hash power. Soft forks require enough miners to recognize a new rule set, enabling users to transact and expect their transactions to be appropriately processed and included in blocks. On the other hand, hard forks would divide the network into two components, and miners would decide which of them is accepted as legitimate, based on the widely accepted rule of "the chain with the most Proof of Work is the right chain to follow."
Proof of Stake Consensus
Proof of Stake consensus is an alternative to Proof of Work for deciding who can add new blocks and validate the current state of the blockchain. Instead of miners competing to solve a problem, the next block producer is determined by the number of coins held in wallets (or “staked”). This trust-based system assumes that those with the most stake will make responsible decisions for the entire network.
“Nothing at Stake” Problem
PoS eliminates the need for energy-intensive mining. However, the lack of significant energy expenditure creates another problem, known as “nothing at stake.” In the case of a forked chain, PoS forgers are incentivized to validate blocks on both chains because it costs them very little to work on an extra chain, and they can collect 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 purpose of the consensus mechanism.
Token Distribution Problem
Proof of Stake has an additional problem concerning the distribution of tokens. PoW miners have significant costs like hardware and electricity and must sell a significant portion of their mined coins to meet those costs. As a result, many mined coins are available to purchase on the market, rather than being hoarded by miners. However, Proof of Stake forgers have very low operational costs, so they do not have the same pressure to sell the coins they receive for maintaining the network. Large holders who engage in Proof of Stake tend to increase their share of the circulating coins as they collect block rewards and transaction fees from network users. This has been likened to feudalism, whereby the network is effectively owned and operated by coin holders, and users pay them a kind of rent for using it. Usually, there is a cut-off beneath which it is not possible to participate directly in Proof of Stake.
Decred’s Hybrid PoW/PoS
Decred is a unique cryptocurrency that utilizes both PoW and PoS to create a hybrid consensus mechanism. The objective of hybrid systems is to balance each other’s weaknesses and capture the benefits of each approach. While “masternode coins” are also hybrids, this article focuses on PoS-based hybrid coins and not those that emulate masternodes or Proof of Service.
Decred’s PoW component uses the Blake-256 hash function, which is similar to other PoW-based projects. However, its PoS component is unique. To participate in PoS, holders must time-lock their DCR to buy “tickets” and purchase them at a market-like mechanism where the system aims for a set number of live tickets (40,960). When someone buys a ticket, the DCR they used is locked until their ticket is pseudorandomly called to vote or until it expires. This introduces an opportunity cost for PoS, ensuring that PoS voters have skin in the game and act in the network’s best interests.
PoS participants, also called stakeholders, have three distinct roles: block voting, voting on changes to the consensus rules, and voting on project-level management using the Politeia Proposal System. The first of these, block voting, is how PoS voters engage most directly in maintaining consensus.
Decred’s PoW/PoS hybrid design gives stakeholders power over PoW miners, allowing them to veto changes to the network’s consensus rules. The verification layer for PoS involves randomly selecting tickets to vote on the validity of new blocks. For a block to be valid, it must receive votes from at least 3 out of 5 selected tickets. PoS voters keep their wallets open and ready to respond to calls for voting and receive a reward for responding.
When a ticket is called to vote, its owner can either accept or reject the regular transactions of the previous block. If at least 3 votes are not received, the new block will not be recognized as valid by the network. PoS voters can reject malicious or inefficient behavior by voting “no,” which can prevent bad PoW miners from receiving rewards. This power is separate from their own rewards, which cannot be stripped by PoW miners.
This PoS layer strengthens the network’s resistance to majority attacks. Double spending attacks require mining an alternative chain in secret, which is not possible in Decred as input from randomly selected tickets is required for new blocks to be considered valid. Furthermore, the hybrid system increases the costs of attacking the network by requiring an attacker to circumvent both PoW and PoS systems. The slow acquisition of tickets also makes it difficult for attackers to accumulate enough power to carry out an attack.
The requirement for each block to be voted on by randomly selected stakeholders enhances the network’s security. Additionally, the blockchain is shared with all participants as it is mined. Overall, Decred’s PoW/PoS hybrid design has been carefully crafted to grant stakeholders significant control over the network, while also providing security against attacks.
Consensus Change Voting
To give PoS stakeholders more control over the blockchain's governance, Decred incorporated an upgrade ratification process into the consensus rules. Changes to the network's consensus rules are only implemented after they have passed through a voting process and are approved by at least 75% of the voting tickets. To initiate this process, a certain proportion of miners (95%) and voters (75%) must run upgraded software with latent changes to the rules. A proposal undergoes a 4-week voting period, and if it receives 75% support, it is accepted, otherwise, it is rejected. If a proposal fails to achieve either a supermajority or a simple majority, a re-vote commences. After a proposal is approved, the rule change takes effect one month later.
The distribution of Decred's block rewards is such that 60% goes to PoW miners, 30% to PoS voters, and 10% to a Treasury that supports the development of open-source software that advances the project's goals. Ticket holders exercise their sovereignty by voting on how the Treasury fund should be utilized, which features should be included, and by establishing policies through the Politeia platform.
The Decred blockchain employs a hybrid PoW/PoS system, which sets it apart from other projects in the PoS consensus group. PoS voters receive only 30% of the block reward, so they cannot maintain their relative share of circulating DCR by staking alone. The majority of newly minted DCR is awarded to PoW miners who help secure the network and address the "nothing at stake" problem that pure PoS systems face. To cover their operational expenses, miners generally need to sell a considerable proportion of the rewards they receive, which keeps an equitable supply of DCR in the market.
While Decred's blockchain is architecturally unique, future projects using hybrid PoW/PoS approaches may not necessarily follow Decred's framework. It is a general grouping with significant variations within, much like projects using PoS consensus.