Deriving weighted accumulated token incentives of a subscriber of a channel
The token incentives pool is a pool that contains all the interest generated by the stake pool (of channels). There are two important things to keep in mind to derive the weighted accumulated token incentives of a subscriber of a channel:
- The token incentives pool contains all the tokens generated by all the channels which means we need to first find the ratio of the token incentives to be attributed to a specific channel. We have covered how to do this in deriving fair share of token incentives for a channel from stake pool.
- Next, we need to calculate the weighted token incentives accrued to a particular subscriber of the channel, this is necessary since subscribers who joined earlier would be receiving more notifications and thus in exchange be entitled to higher share in the token incentives attribute to the channel than the subscribers who joined later.
We need to derive the formula which can give us the exact accumulated token incentives of the subscriber of a specific channel. The subscriber share of token incentives ratio needs to be weighted favoring earlier subscription.
While this can be solved by recursion of all subscribers, getting their join time (block number) and applying a simple ratio formula. This will be inefficient as more subscribers will lead to higher inefficiencies.
Instead of recursion, we are going to approach the formula in a linear way. We know that each time a subscriber is added, the previous number of subscribers, their block number, etc can be treated like a constant as their values will not change moving forward.
For example, if subscriber k is added to block b, then the subscriber count before block b would never change, nor will the differential which we have before subscriber k was added. We utilize this to form our own ratio calculation that is not based on recursion but instead is based on the aggregation that happens whenever a subscriber is added or removed.
Putting it together, the formula by which we can derive a channels' fair share of token incentives from the stake pool for the current block can be written as:
Occurs whenever a subscriber is added, deactivated or the stake fees changes