TL;DR: This is an attempt to modify Bitcoin’s DAA to increase T_{min}(U,W) and W_{min}(U,T). I suspect there’s no way to lower the bound other than simply making the averaging window smaller which sacrifices stability in the random variation of the difficulty. Other algorithms have better stability for a given window-size but are still subject to the equations for T_{min}(U,W) and W_{min}(U,T).
Definitions:
- T = chain time since genesis in units of 2 weeks.
- U = number of 2016-block periods since genesis.
- W = chain work in units of work done in the first period.
An obvious question is if there’s a DAA that can increase T_{min} to be closer to T and for T = U. This means height would be a better measure of time and a private mine could not get more blocks than the public chain unless it uses proportionally more work.
The problem the equations describe is that the DAA can’t keep up with persistent increases in hash rate which lowers T_{min}(U,W) and W_{min}(U,T). I view W and T as what the public chain experiences and T_{min}(U,W) and W_{min}(U,T) as how much an attacker can cheat. The problem can be alleviated by shorter DAA averaging windows to increase U for a given amount of time since genesis. A short window allows a faster response to changes in hash rate but at a cost in stability. The problem appears in all DAAs I am aware of because they have an “equivalent averaging window”, so the generic equation for T_{min} below applies to all of them. However, some DAA’s can have the same stability with a smaller “averaging window”, so the T_{min}(U,W) and W_{min}(U,T) problem can be alleviated by up to 50% compared to Bitcoin’s DAA if stability of the difficulty during constant hashrate is the standard.
Finding something significantly better might reveal a better class of DAAs.
The following is one idea. It makes the difficulty in the next period more difficult if the time since genesis is ahead of schedule. The difficulty is expressed as “hashes to find a block”, i.e. bitcoin’s difficulty times 2^32.
difficulty *= 600/timespan * (2016 + (600 * height - min(chain_time, 600 * height))
With this modification, difficulty can be made harder than the current DAA to slow the chain down if too many blocks since genesis have been found. The converse (“speed it up if blocks have been too slow”) is stopped by the min() function because there would be an exploit. I have not experimentally confirmed this equation is a “good DAA”. It’s possible if not likely that this injects instability such that it doesn’t work any better than just making the 2016 averaging window smaller to get the equivalent benefit in speed at a cost in stability. Speed is an inverse linear function of window size while stability is an inverse of its sqrt. If this method doubles the instability, then using a window size 1/4 of 2016 would give the same speed and stability benefit.
For the U = 499 example, this raises T_{min} from 460 to 489, almost 1/4 the error, at an unknown cost in stability.
To review, T_{min} for bitcoin’s DAA without timespan limits and a large future time limit:
T_{\min} \approx U\left[ \left(\frac{1}{W}\right)^{1/U} \right]
The modified DAA above results in the following:
T_{\min} \approx U - \frac{\ln(W)}{\ln\ln(W)}
If T_{min}(U,W) is normalized to give the same stability ( T_{min}(stability,W) ), I suspect the equations would be the same.
To make T_{min}(U,W) = T(U,W) drastic measures are needed: Use a 1-block averaging window, real-time targeting (RTT), and the CDF of the exponential function:
[Edit: Correction. This would be terrible for trying to make T_{min}(U,W) = T(U,W) because and attacker could just set solvetimes to 0.693 * 600 and difficulty would not increase. It only works if the solvetimes are exponentially-distributed. ]
D \mathrel{*} = \frac{0.5 - CDF}{0.5}
or
D \mathrel{*} = e^{0.5 - CDF}
where CDF = 1 - e^{-t/600}
Where t is the timestamp the miner uses in his block header template minus the prior timestamp and monotonic timestamps and accurate solvetimes are enforced. This isn’t impossible as I’ve detailed before. These equations are the only ones I’ve found that keep the average block time correct, although I’m not certain I went below a block averaging period below 3, i.e. I know taking the 3rd root of these equations results in the correct average solvetime even when hashrate varies a lot. They also give the most stable difficulty for a given speed of response, beating the prior best known algorithms, ASERT and WTEMA. Their results seem pretty equivalent. The 2nd one is an EMA.