# New Average Reward Rate Calculations for Staking

**URL:** <https://forum.polkadot.network/t/new-average-reward-rate-calculations-for-staking/5599>\
**Category:** Tech Talk\
**Created:** [January 10, 2024, 9:54am UTC](https://forum.polkadot.network/t/new-average-reward-rate-calculations-for-staking/5599 "2024-01-10T09:54:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ross](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.polkadot.network/ross/32/11267_2.png) [@ross](https://forum.polkadot.network/u/ross)\
**Post date:** [January 10, 2024, 9:54am UTC](https://forum.polkadot.network/t/new-average-reward-rate-calculations-for-staking/5599/1 "2024-01-10T09:54:55Z")

</div>

Staking Dashboard is [introducing](https://github.com/paritytech/polkadot-staking-dashboard/pull/1849) 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.

### The Problem

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](https://github.com/polkadot-js/apps/blob/38f037dfd671542e322e92e19e1a2deca24ad49d/packages/react-hooks/src/useInflation.ts).

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.

### The (start) of the Solution

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:

```auto
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:

```auto
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.

```auto
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.

#### Terminology of new figures:

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**.

---

<div class="post-metadata">

**Author:** ![muddlebee](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.polkadot.network/muddlebee/32/11373_2.png) [@muddlebee](https://forum.polkadot.network/u/muddlebee)\
**Post date:** [January 29, 2024, 11:58am UTC](https://forum.polkadot.network/t/new-average-reward-rate-calculations-for-staking/5599/2 "2024-01-29T11:58:36Z")

</div>

why this is hidden?

---

<div class="post-metadata">

**Author:** ![shawntabrizi](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.polkadot.network/shawntabrizi/32/14_2.png) [@shawntabrizi](https://forum.polkadot.network/u/shawntabrizi)\
**Post date:** [January 29, 2024, 3:16pm UTC](https://forum.polkadot.network/t/new-average-reward-rate-calculations-for-staking/5599/3 "2024-01-29T15:16:03Z")

</div>

I don’t know either. I assume Ross hid it?

Otherwise, you would need to use your powers to see who did

---

<div class="post-metadata">

**Author:** ![ross](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.polkadot.network/ross/32/11267_2.png) [@ross](https://forum.polkadot.network/u/ross)\
**Post date:** [January 29, 2024, 4:35pm UTC](https://forum.polkadot.network/t/new-average-reward-rate-calculations-for-staking/5599/4 "2024-01-29T16:35:00Z")

</div>

I flagged the post as the reward calculation posted was missing a normalisation step that has since been amended in production. I left a note - would be good to be able to edit or replace as the original calculation is misleading.

I’ve now edited the original post with the added step (It looks like the post becomes editable again after it has been flagged).

---

<div class="post-metadata">

**Author:** ![muddlebee](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.polkadot.network/muddlebee/32/11373_2.png) [@muddlebee](https://forum.polkadot.network/u/muddlebee)\
**Post date:** [January 29, 2024, 5:15pm UTC](https://forum.polkadot.network/t/new-average-reward-rate-calculations-for-staking/5599/5 "2024-01-29T17:15:35Z")

</div>

thank you. we are getting lots of queries at discord so we use this as reference of change.

---

<div class="post-metadata">

**Author:** ![johnnykawa](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.polkadot.network/johnnykawa/32/4559_2.png) [@johnnykawa](https://forum.polkadot.network/u/johnnykawa)\
**Post date:** [April 17, 2024, 1:35am UTC](https://forum.polkadot.network/t/new-average-reward-rate-calculations-for-staking/5599/6 "2024-04-17T01:35:58Z")

</div>

So @ross the above is updated? Thanks!

---

<div class="post-metadata">

**Author:** ![ross](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.polkadot.network/ross/32/11267_2.png) [@ross](https://forum.polkadot.network/u/ross)\
**Post date:** [April 17, 2024, 3:33am UTC](https://forum.polkadot.network/t/new-average-reward-rate-calculations-for-staking/5599/7 "2024-04-17T03:33:23Z")

</div>

Hi @johnnykawa, yes it is all up to date and being used on staking dashboard now.
