Is there a way to find out which Block Producer Candidates are paid as backup BP?
1 Answer
You can recreate the logic for this, but it takes a little bit of leg work.
The system rule is that backup BPs are rewarded as long as they earn at minimum 100 EOS per day.
To calculate this, what you'll need is:
- The current supply of EOS
- The
total_producer_vote_weight
from theglobal
table. - A few predefined constants
Here's a pseudocode broken down version of one way to calculate it:
// Example Supply (load from eosio.tokens currency stats)
supply = 1000000000
// Current Inflation Rate (4.879%)
inflation = 0.04879
// Calculate token emission rate
tokensPerYear = supply * inflation
tokensPerDay = tokensPerYear / 365
// 20% of inflation (1/5th) goes to producers
tokensToProducers = tokensPerDay * 0.2
// 75% of producer pay is based on votes
tokensToProducersForVotes = tokensToProducers * 0.75
// Percentage required to earn 100 tokens/day
backupMinPercent = 100 / tokensToProducersForVotes
At this point you will have a minimum percentage of votes that a BP needs to be considered a "backup" and earn rewards. Currently it's right around 0.49%
but will vary over time based on the total supply/votes.
For each producer you want to check, you just need to consider what overall percentage of the vote they currently have versus the overall votes cast.
// Determine global percentage of votes
percentOfVotes = producer.total_votes / global.total_producer_vote_weight
// Is this enough to be a backup producer?
isBackup = percentOfVotes > backupMinPercent
The producer
reference above is a a record from the producers table:
./cleos get table eosio eosio producers
and the globals
reference is from the global table:
./cleos get table eosio eosio global
That's how we're currently doing it in our tooling. If you'd like to see a example in production, feel free to check out the source.