Decentralised Treasury Spending - Decred Fundamentals

On Saturday 8th, of May 2021 at block 552,448 Decred passed a vote to introduce a new Treasury Spending rule, where stakeholders vote to approve how funds are spent. This is yet another milestone in Decred's history, making it increasing more decentralised.

Decentralised Treasury Spending - Decred Fundamentals
Decentralised Treasury Spending - Decred Fundamentals

LISTEN TO THE PODCAST:

Giving the final say to the stakeholders effectively creates a system of checks to make sure all parties and individuals are acting in accordance with their proposals’ budget and productive output.

A function of the Treasury Spend is to double-check the spending is accurate before the payout. The bulk of the verifying is done before the Treasury Spend goes live. This is a final layer of verification that mitigates against undesirable or harmful actions, including:

  • Maliciously draining the treasury
  • Controlling entities acting in their self interests
  • Reducing the risk of key project members abandoning the project and effectively locking up the funds, preventing their use
  • Reducing risk of coercion being used against or by key project members
  • and making treasury spending more transparent

The voting process for the Treasury Spend

The Treasury Spend process, starts when contractors submit their invoices at the beginning of each month. Commonly, this should be done in the first week, so the review process can begin. Afterwards, Invoices are checked by proposal owners and moderators.

CMS Decred Invoice

The Treasury Spend then gets finalised and published to the Mempool with an allotted 3,456 block interval. The first Treasury Spend interval was from block 616,896 to block 620,352. In date terms, this was from December 18th to December 30th, 2021.

The Treasury Spend stays in the Mempool until the voting is complete and the transaction matures. At this time, it’s added to a block and is visible in the Treasury section. The first Treasury Spend was included in block 619,776 on December 28, 2021.

Treasury spend included in block

After being published to the Mempool, the Treasury Spend is voted on by stakeholders. This is done in real time, as the tickets are called to vote.  A maximum of 17,280 ticket will be called to vote. This is approximately 42% of the full ticket pool.

For the voting results to count, the Treasury Spend must reach a 20% quorum, which is equivalent to 3,456 votes either yes or no. An important note here is abstaining votes are not included in this tally.

After reaching quorum, at least 60% of these votes must be yes, in order for the vote to pass. The calculation for the quorum is 288 blocks per interval, times 12 intervals and 5 votes per block, which makes the 20% quorum = 3456 votes.

An interesting feature of the Treasury Spend process is “short-circuiting” which enables the vote to finish early. For instance, if enough approving votes have been cast that it would be impossible for the remaining votes to result in a rejection of the treasury spend.

These parameters are very similar to Decred’s consensus voting, but the short-circuiting mechanism allows a treasury spend to be mined early when it's clear there is no way it can fail. Consensus votes, on the other hand, intentionally have fixed periods so that everybody knows, with 100% certainty, that if a vote passes the rules will change at block X without exception.


Finally, if the vote passes, the treasury spend will be included in a block resulting in the contractors being paid out from the Treasury. If the vote fails, the Treasury Spend can be resubmitted or amended to exclude or separate contentious invoices.

Treasury Spend voting

A maximum of seven Treasury Spends can be included in the Mempool concurrently. This provides opportunity for a single spend to be separated out if necessary, or for overlapping spends to be included at the same time. For instance, imagine a treasury spend is rejected which results in separating the controversial payments into a second treasury spend once the disputes have been resolved. But by that time, it's already time for the next month's payouts. Further, imagine, this happened a few times.  In that case, if multiple concurrent treasury spends weren't allowed, you would end up potentially permanently delaying all future payments since you'd have to wait for previous ones to finish.

Treasury Spend Scenarios

There are many scenarios, but let’s look at how the Treasury Spend in July 2022 played out in comparison to a vote that plays out with a maximum and minimum vote participation.

Maximum and minimum vote participation:

  • Maximum possible voting period = 12 days
  • Maximum possible number of blocks = 3,456 blocks
  • Maximum possible votes = 17,280 votes
  • Quorum = 3,456 votes
  • Highest yes votes needed (if all tickets vote yes/no) = 10368 yes votes
  • Lowest yes votes needed if quorum is met = 2,074 yes votes

Under the full conditions of a vote, where all tickets vote without any abstains. The required yes votes for the spend to pass would need to be 10,368. And the minimum requirement, where quorum is achieved with only 3,456 votes, would be 2,074 yes votes. The vote will only short-circuit if there are not enough votes remaining to overturn a 60% yes vote.

The conditions of the July 2022 Treasury Spend, which did trigger the short-circuiting mechanism, were:

  • Voting period = 10 Days
  • Number of blocks = 2,880 blocks
  • Maximum possible votes = 14,400 votes
  • Quorum = 3,456 votes
  • Yes votes = 4,822 votes
  • No votes = 0 votes

As you can see from this vote, the short-circuiting mechanism cut in 576 blocks before the end of the Treasury Spend interval. This was triggered because there was no possible way the vote could fail. For instance, there were 576 blocks * 5 votes = 2880 possible no votes remaining. If all those had been cast and were no, then it would've ended up as the existing 4,822 yes votes + the extra 2,880 no votes = 7,702 total votes, of which 4,622 yes votes would be needed to reach the 60% threshold. Because it was already at 4,822 yes votes, there was no way it could possibly fail.

Calculation with example and outcome:
(Remaining blocks * 5 votes) + All votes = Maximum votes
if 60% of Maximum votes < Yes votes & Quorum met:
Short-circuit

Above calculation: (576 * 5) + 4822 = 7702, 60% of 7702 = 4622 (which is less than 4,822)

Treasury Spend Calculation

It’s fair to say that the Treasury Spend procedures and parameters are probably the most complex element of Decred that we’ve covered this far. But hopefully this has given you some insight into how this works and where this information can be found.