I have been working over the past few months, greatly assisted by @snipatomic and @ILikeChocolate, to formally document in a mathematically rigorous way the new expected time to stake algorithm I coded which is in wallet version 220.127.116.11+. I also thought it important to cover related concepts. This has turned into a blue paper covering the staking process from a probability point of view (not security). This paper is a formal mathematical treatment of the staking process in Gridcoin's version of PoSv2 and covers the following areas:
- Basic Staking Probability
- Expected Time to Stake (without cooldown)
- Net Weight vs Difficulty
- Cooldown (including cooldown corrected ETTS and staking efficiency)
- Retargeting algorithm (which controls difficulty)
- The Wallet's Approach to ETTS in 18.104.22.168+
The paper is about 90% complete, but is good enough to ask for comments from the public. The main things left to do are minor additional editing, better graphs, and a cross-reference between the variable names in the paper and the actual code itself.
Note that the concepts in this paper are applicable to other PoSv2 coins, with appropriate modification of the constants.
You will recognize all of the thumb rules I have published here on Steemit during the past few months, useful for ETTS calculations and the upcoming CBR. For ready reference here are the important ones. (Note I have changed the formal mathematical variable names back to words to be easier on folks.):
For a wallet with n equally sized UTXOs...
(UTXO Value) = Balance / n
(ETTS without cooldown) = (10000/Balance) * Difficulty
or (ETTS without cooldown) = (1/960) * (net weight) / Balance
(ETTS with cooldown) = ((cooldown time) / n) + (ETTS without cooldown)
(net weight) = 10000000 * Difficulty
UTXO size for desired efficiency
(UTXO value) = 15000 * Difficulty * (1/E + 1), where E is the desired efficiency % as a decimal, i.e. 95% is 0.95.
Note that E = (staking frequency with cooldown) / (ideal staking frequency without cooldown) which is also
E= (ETTS without cooldown) / (ETTS with cooldown)
ETTS modified for different "confidence levels" besides the 63% for the expected value version...
(ETTS with cooldown at Confidence P) =((cooldown time) / n) - ln(1 - P) * (10000/Balance) * Difficulty
In particular, the 80% level used in the wallet gives
(ETTS with cooldown at 80%) = ((cooldown time) / n) * (16000/Balance) * Difficulty