A quick rule of thumb formula for calculating expected time to stake
I have been involved in an extensive discussion on the Gridcoin Slack recently involving difficulty, network weight, and stake weight.
I developed a quite accurate rule of thumb formula for estimated time to stake that is easy to remember...
(Expected Time to Stake in days) = (10000/(Stakable Balance in GRC)) * Difficulty
So a balance of 10000 that is available for staking (meets the 16 hour cooldown requirement) at a difficulty of 1.0000 will result in an expected time to stake of approximately 1.0 day.
Let's apply this formula to minimum balance questions that we get all of the time.
Most people want to see a stake every week to feel comfortable everything is going right... solving the rule of thumb and using a difficulty of 1.0...
7 days = (10000/balance)*1.0 means balance = ~1400.
If the difficulty was 2.0, you would need twice that much.
Let's cover the case of low balance holders and the research reward cutoff problem. Research rewards expire at 180 days age. So you must stake within 180 days to avoid losing research rewards. Let's apply the formula to that...
180 = (10000/balance)*1.0 which means balance = ~56. In reality, because staking is random, you should put in a factor of about two to be safe... (Thanks @barton26!) So being below 100 GRC in balance is really risking losing research credit.
A relatively high balance holder of, say 100000 GRC would see this at a difficulty of 1.0...
Expected time to stake = (10000/100000) * 1.0 = 1/10 of a day, or 10 stakes a day. To actually achieve this though would require the wallet to have that balance split among ~10 or more UTXOs, because each UTXO staked is subject to a 16 hour cooldown period.
See @hotbit's excellent article on UTXOs. https://steemit.com/gridcoin/@hotbit/cbr-the-way-to-split-coins-draft. The splitting of balances into multiple UTXO's will be more important when we move to CBR.
For those of you wanting to understand where this formula came from, you can take a look at the small ddiff.cpp program I posted on the Gridcoin Slack which describes the relationship between nBits, Target, Difficulty, and staking probability and/or time to stake.
The actual value of the constant in the formula, instead of 10000, is the following...
(MaxHash/UnitDifficultyTarget) * (16/(80 * 3600 * 24)). The 16 comes from the 16 seconds per stake quantum imposed by the stake time mask. The 80 comes from the conversion of stakable GRC to CoinWeight. CoinWeight = 80 * Stakable GRC for V8 protocol. The 3600 and 24 convert secs to days in the formula.
MaxHash is 256^32-1, and the UnitDifficultyTarget is the target value for nBits of 1d00ffff. This is the same as (256^2-1) * 256^26 where the ^ is exponentiation.
Putting it all together we have
(Expected Time to Stake in days) = (1/Stakeable Balance in GRC) * Difficulty * ((256^32-1)/((256^2-1) * 256^26)) * (16/(80 * 3600 * 24))
So... the 10000 is actually 9942.20563194.
The more precise formula is therefore
(Expected Time to Stake in days) = (9942.20563194 / Stakeable Balance in GRC) * Difficulty
Please see the reddit cross-post for interesting commentary...