Decred Mining Explained

0
784
Decred Mining

Decred Mining Explained

Decred is a decentralized cryptocurrency that is well-known for its blockchain integrated community-based governance features. Decred achieves this by use of its hybrid proof of work (PoW) and proof of stake (PoS) consensus mechanism. This produces a system in which stakeholders are able to control the development of the Decred blockchain, as Decred’s hybrid proof of work and proof of stake consensus mechanism allows for the ordered transition from one set of consensus rules to the next. The Decred mining and staking system also helps to ensure that the progression of the project is not controlled by powerful self-interested groups that can initiate changes to the underlying blockchain without the input of the community.

Decred Mining – Proof of Work

Decred mining first concerns the proof of work element, which involves individuals investing their computational resources in order to form blocks for the blockchain and process transactions on the network. Each time a block is mined, 30 Decred coins (DCR) are released, these coins are then further subdivided in the following way:

  • 60% PoW Miners
  • 30% PoS Voters
  • 10% Decred Development Subsidy

Decred Mining – Proof of Stake

The second element to Decred mining is proof of stake, which is designed to serve the following:

  • Allow Decred stakeholders to vote in favour or against proposed changes to the blockchain. If stakeholders vote to support a change, the Decred blockchain will hard fork and the new feature will become live on the network.
  • Serve as a mechanism by which stakeholders can act as a counterbalance to malicious proof of work miners. Individuals involved in staking can vote a block invalid even if it complies with Decred’s network consensus rules.
  • Reward individuals that help to secure the network through the staking process by awarding them 30% of the total block reward.

In order to participate in the proof of stake system, individuals must lock up some DCR in exchange for a ticket, with each ticket representing a single vote in the Decred system. These tickets serve as a mechanism by which holders can participate in the governance of Decred. Once a user purchases a ticket, it enters a lottery pool. With every block that is discovered by a proof of work miner, 5 randomly chosen tickets must be included in the block (Miners face penalization in the form of a reward deduction if fewer than 5 votes are included in a mined block). These 5 randomly chosen tickets must now vote on whether or not to approve the previously mined block. If at least 3 votes approve the previously mined block, then the newly mined block is added to the chain, and both the miners and stakers are rewarded. However, if the previously mined block is not approved, then miners are not rewarded, but stakers are. The rationale behind this is to incentivize miners to mine in accordance with the wishes of stakers.

Decred mining, more specifically the proof of stake element, rewards every ticket that is chosen to vote in a block. Each randomly selected ticket is given an average vote time of 28 days. If a ticket expires before casting a vote, then the original ticket price is returned to the purchaser.

The proof of stake system serves as a check on problems that could result from proof of work only systems:

  • Miners cannot decide to change the rules of the network (e.g. a 51% attack) because stakers must validate the blocks that are discovered by miners.
  • In the event of a Decred hard fork, the old chain will quickly fall into disuse due to blocks not being validated by stakers on the chain.

Decred Tickets and Ticket Price

Whenever a user purchases a ticket on the Decred network, they must pay an internal ticket price and a ticket fee using DCR. Purchased tickets are then transferred to a temporary mempool. Tickets in the mempool must wait until they are chosen to be included into a block, with a maximum of 20 tickets capable of being mined into a block. As there is a limit to the number of tickets that can be mined into a block, competition to get tickets mined will result. A user can decide to pay a higher ticket fee to miners on the network to get their ticket mined more quickly. Once a ticket is included into a block, it is moved to the ‘immature’ ticket pool. After a waiting period of 256 blocks (approximately 20 hours), the ticket will mature and go into the live ticket pool, also known as the lottery pool. Once in this pool, the ticket is eligible to be chosen to validate blocks on the Decred blockchain.

The price of tickets on the Decred network is determined by an internal algorithm that is configured to keep the ticket pool, which is the total number of tickets in the proof of stake system, around a target size of 40,960 tickets. The price of a ticket will fluctuate in accordance with the demand for a ticket, and the supply of tickets that currently exist in the pool.

The algorithm adjusts the price of a ticket every 144 blocks, this is known on the Decred network as the ‘buying window’. With each block capable of housing 20 tickets, a buying window can result in a maximum of 2,880 tickets being purchased. The ticket price for a purchased ticket is always refunded regardless of if the ticket casts a vote or expires.

Decred Mainnet Voting

There is a two-stage process for voting to implement consensus changes that would result in a hard fork of the Decred blockchain. However, it is first important to note that two different block intervals exist for the voting process.

  • The Stake Version Interval (SVI) of 2016 blocks (approximately 1 week)
  • The Rule Change Interval (RCI) of 8064 blocks (approximately 4 weeks)

The first stage in the voting process is that the upgrade threshold on the network must be met. When the code that will hard fork the blockchain is released, a majority of nodes participating in the proof of work and proof of stake systems must first upgrade before voting can begin.

For nodes on the proof of work system, at least 95% of the 1000 most recently produced blocks must have the latest block version. For nodes operating on the proof of stake system, at least 75% of the votes cast within a single SVI must possess the latest vote version. Once these respective upgrade thresholds are met, voting can begin on the first block of the next RCI.

The second stage in the voting process is to vote:

  • If more than 90% of all votes submitted within the RCI are Abstain votes, then the agenda vote will remain active for the next RCI.
  • If all non-abstaining votes submitted within the RCI fail to meet the 75% Yes or No majority threshold, then the agenda vote will again remain active for the next RCI.
  • If 75% of all non-abstaining votes within the RCI vote in favour of the agenda (Yes vote), then the agenda will be locked in and the consensus change will activate 8064 blocks after the vote passed.
  • If 75% of all non-abstaining votes within the RCI are against the agenda (No vote), then the it will fail and the consensus change will never activate.
  • If an agenda reaches its expiration before reaching a 75% majority vote, then it will expire and the consensus change will never activate.
Decred Mining
Source: Decred.org