Thursday, August 4, 2016

Note to self: cryptocurrency difficulty settings

I estimated above that the difficulty setting's averaging of the past in order to determine if coin production is on track or off-track should be  3 x N / SQRT(N).  It's almost a perfect curve fit for a coin's expected deviation from a Poisson distribution, allowing for up to 3.75 standard deviations from the Poisson distribution's expected mean. This high level of permission allows for network hiccups away from the mean that someone could profit from if they can cost-effectively shift hashing energy around to different time slots. They'll be able to detect a deviation with decent probability each hour (N=30 rule) before the code decides in a difficulty change.
Poisson distribution with 3.75 std devs from mean:
3.75 x 2 e^-N x N^(N+1) / N! =~ 3 x N / SQRT(N)

If you want to minimize profit from hiccups, you could remove the 3.75 to allow for 1 std dev from the mean. The drawback is that this means that 1/3 of the time you will be intervening with a change in difficulty where none was statistically present, instead of ~0.01% of the time with 3.75.  3.75 is too permissive.

With the current method, the algorithm appears to be intervening too much with too-large changes that are too-often.  It seems like a nosy government regulator, acting beyond what the statistics requires. It is donating easy coins to slow transaction periods at the expense of the small business owner (miner), to the benefit of the more-talented, conglomerated smart businesses selling a service (shifting hash energy) to the slow transaction periods.  I would use 2 std devs instead of 3.75 as a nod to statistical tradition. The current code is using something like 0.1.  [edit correction: after N=6 intervals

It's not merely hiccups it's trying to fix, but also the distribution itself allows for a sparse period of transactions.  The Poisson distribution says the probability of k=1 occurrence in N=6 intervals (15 minutes) is (N L)^k / k! / e^(N L) = N/e^N = 1.5% where L = the average of 1/2.5 minutes, so NL= average occurrences in N x 2.5 min intervals.  So there will be an average wait of 1/0.015=67 intervals for it to take 15 minutes. It would take 30 minutes once every 23 days.

No comments:

Post a Comment