In the third issue of its ongoing TechTalk series, the DECENOMY dev team has dived into the intricate mechanics of its Dynamic Rewards System, providing insight into how open source developers implement blockchain changes.
Although the article is more on the technical side, exploring the mathematical framework and code behind dynamic rewards, we offer a simplistic overview of how the system functions.
Understanding the Core Principles
Inspired by Milton Friedman’s economic philosophy, Dynamic Rewards is designed to maintain stability and predictability in the DECENOMY ecosystem. This is achieved by adjusting block rewards based on real-time blockchain metrics. The system uses a combination of fixed percentages for certain parameters and dynamic adjustments for other aspects.
On the fixed side, the developers have employed constant emission rates for total and circulating supply (5% and 10% respectively) to ensure predictable system behaviour. And on the variable side, the system analyses the Unspent Transaction Output (UTXO) set to accurately determine coin supply, excluding burn addresses and masternode collaterals.
To account for coin velocity, UTXOs are weighted based on their age, with older coins having less impact on circulating supply, while excluding UTXOs that are older than twelve months.
Meanwhile, a damping function is applied to prevent drastic reward fluctuations and smooth out adjustments. It linearly moderates changes in the block reward, with 0% to 10% on each adjustment.
The Algorithm in Action
The first step in the mechanics of Dynamics Rewards is obtaining the total money supply and masternode collaterals for the current and upcoming week. The GetMasternodeNodeCollateral(nHeight) and GetMasternodeNodeCollateral(nHeight + nBlocksPerWeek) functions are used to determine the current collateral and the collateral for exactly one week from the current block, respectively.
Next, the current circulating supply is calculated before getting the emission rate for the same period. As mentioned, the framework analyses UTXO sets while identifying and excluding burn addresses and masternode collaterals. The circulating supply is obtained by summing weighted UTXO values.
This figure is refined by estimating the average staking power within a defined epoch. Staked coins are subtracted from the circulating supply.
Although we’ve provided a low-level overview, the actual implementation involves complex calculations and interactions with the blockchain. Key code segments include:
- UTXO Analysis: Iterating through the UTXO set, applying age-based weighting, and excluding irrelevant UTXOs.
- Staking Power Calculation: Determining the average staking power within an epoch based on network hash rate and time slot length.
- Emission Rate Calculation: Applying fixed percentages to total and circulating supply to determine target emissions.
- Reward Adjustment: Calculating the difference between actual and target emissions and applying the damping function.