-
Notifications
You must be signed in to change notification settings - Fork 10
Staking Capacity
There's different formula for calculating the total/available capacity of a baker floating around and only a few seem to be correct. The problem at hand is a complex optimization problem that depends on different variables. One important dynamic variable is the global network-wide staking balance (all delegated coins + all coins owned by all active bakers) which changes when more or less people stake. From the perspective of a single baker capacity also changes when more or less delegations come in because this may change the number or total network-wide rolls. That means a single baker's capacity depends on (1) the global staking balance and (2) it's own staking balance.
To capture these relations we use a conservative global estimator based on current delegate balance and network wide rolls
capacity = (spendable_balance + frozen_deposits) / (2560 * 4096 * 5) * rolls * 8000
where
2560 = block_security_deposit (512) + endorsement_security_deposit (64) * endorsers_per_block (32)
4096 = blocks_per_cycle
5 = preserved_cycles
8000 = tokens_per_roll
What this formula does is it looks at how much share of the network-wide 5-cycle bond a delegate owns right now and projects this ratio onto the current network stake. It is the most direct and most correct formula I'm aware of. All constants are derived from protocol paramaters. The formula is conservative when network stake remains stable or grows. On sharp drops of network-wide stake it overestimates. For better real-time estimates our indexer re-calculates the network-wide rolls and all other relevant data at each block, so the capacity is always up-to-date.