Staking Dashboard is introducing new staking reward estimates based on an average calculation of validator payouts. These calculations can trivially be derived from an RPC or light client connection, and give more accurate estimates of Polkadot staking rewards.
For a while now the ecosystem (staking dashboard included) has been using an outdated calculation to get estimated staking reward rates and inflation figures. These calculations were derived from a Polkadot JS apps hook that can be found here.
This calculation is inaccurate, incorrectly adjusting the rate based on auctions (crowdloans) To make things more complicated, the calculations are hard to read and are difficult to replicate. Instead of trying to replicate the reward curve in JS world, a basic approach of calculating averages has been opted for in average reward rates.
Since era points are very evenly distributed to validators now, we can assume that each active validator will likely receive a similar reward per era, making the following calculation more reliable. We are assuming, though, that the Phragmen algorithm is doing a good job at evenly distributing bonded funds throughout nominees.
Average reward rates can be derived from the average validator reward of a time period. A 30 day average reward rate would be the average validator payout for the last 30 eras on Polkadot, for example:
XDayAverageDailyReward = sum(XDayValidatorPayouts) / days
After calculating this average daily payout, we can calculate both a base rate or compounded reward rate. The base rate is simply
averageDailyReward * 365, and the compounded rate uses the daily compound interest formula:
A = P[(1+r)^t]`, where:
A = the future value of the investment
P = the principal investment amount
r = the daily interest rate (decimal)
t = the number of days the money is invested for
^ = ... to the power of ...
This calculation results in the inflation rate that goes to stakers, which can then be normalised with the staking rate to get the average reward rate.
rewardRate = A / stakingRate
We can also derive an average reward after validator commission. The initial implementation on staking dashboard takes the average of all non-100% validator commissions, and deducts this percentage from either the base rate or compounded rate calculated above.
So what we are left with is:
- An average reward rate, that can be an average for any time period (up to 84 days of Polkadot if we are limiting ourselves to node and light client support).
- Ability to provide a base rate (effectively an average inflation rate) or a compounded rate.
- Ability to deduct an average validator commission to get an average net rate.
Taking a 30 day average, before validator commission deducted:
- 30 Day Average Reward Rate / 30 ARR
- Compounded 30 Day Average Reward Rate / Compound 30 ARR
After validator commission:
- Net Compounded 30 Day Average Reward Rate / Net Compound 30 ARR.