[Bitcoin-ml] Alternative difficulty algorithm for Bitcoin Cash

Tom Harding tomh at thinlink.com
Mon Oct 16 21:25:43 UTC 2017


On 10/1/2017 2:17 AM, Neil via bitcoin-ml wrote:
> I have written a Python simulator here (which defaults to the
> algorithm parameters in the C++ code):
>
>    https://github.com/kyuupichan/difficulty
>
> which is easily modified to various hashrate scenarios and miner
> persuasions.  It runs 10,000 blocks, printing various stats like
> instantaneous hashrate, difficulty, block times, etc., at each block.
> Once the simulation is run it also shows stats for median block time,
> mean block time, and maximum block time over the simulation.

Neil's tool now allows selection of the difficulty adjustment algorithm
using an --algo parameter.

His algorithm is designated "k-1" with a few permutations.  There are
options for a sliding 144-block window using chainwork ("cw-144"),
corresponding to the latest proposal in Bitcoin ABC, as well as Amaury's
earlier proposal "d-1".

I've tossed a "weighted time" algorithm into the ring as well, which
Neil has merged with the designation "wt-144".  This algorithm also uses
a sliding 144-block window, but weights the individual blocktimes
(rather than the chainwork component) and also weights more recent
blocks arithmetically decreasing back across the window.  In my tests
with the tool so far, this algorithm is much less likely to produce
reinforcing oscillations in difficulty and hashrate and miners come and go.

Weighted time is described and implemented (in simulation) here:
https://github.com/kyuupichan/difficulty/pull/4




More information about the bitcoin-ml mailing list