zawy12 / difficulty-algorithms

See the Issues for difficulty algorithms
MIT License
107 stars 25 forks source link

Best difficulty algorithms #1

Open zawy12 opened 6 years ago

zawy12 commented 6 years ago

Best algorithm: WHM difficulty algorithm I've been careful to select the best N and adjustment factor (to get the correct average solvetime) for this algorithm. The next two algorithms are very nearly as good, but the selection of N and adjustment factor are only optimal for T=120 second target solvetimes.

A close 2nd with a lot less code: Simple EMA difficulty algorithm

Improved version of Digishield has more stability than Simple EMA, but is a little slower. The Simple EMA page shows how to model the EMA to be more like Digishield in order to give what seems to be the same results.

A more advanced form of the Simple EMA, with no advantage other than being more precise. This article also covers every aspect of EMAs. EMA-Z

New algorithm that might be better but is more complicated: Dynamic EMA difficulty algorithm This idea could solve a lot of problems, but bad timestamps arguably prevent it from being better because they force us to require a certain minimum number of blocks, which severely limit it where it is most needed.

Extending EMA algorithm to a PID controller so you can tweak it to have characteristics very different from other algorithms. But overall, it seems to not be adjustable to anything better than the EMA, just different. PID controller difficulty algorithm

Masari coin (Monero clone) has implemented the WHM N=60 and so far appears to be an incredible success.

See also Selection of N (more important than choice of algorithm) Introduction to difficulty algorithms Comparing algorithms, Handling bad timestamps. Difficulty performance of live coins Hash attack examples