<oembed><type>rich</type><version>1.0</version><author_name>npub164d4d9z50r3uzguvlmvwdsevs5t7w6y5hjfz72wkafp0wn72nvfq5znx9p</author_name><author_url>https://nostr.ae/npub164d4d9z50r3uzguvlmvwdsevs5t7w6y5hjfz72wkafp0wn72nvfq5znx9p</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2017-11-02&#xA;📝 Original message:Bitcoin cash will hard fork on Nov 13 to implement a new difficulty&#xA;algorithm.  Bitcoin itself might need to hard fork to employ a similar&#xA;algorithm. It&#39;s about as good as they come because it followed the&#xA;&#34;simplest is best&#34; route. Their averaging window is probably&#xA;significantly too long (N=144). It&#39;s:&#xA;&#xA;next_D = sum (past 144 D&#39;s) * T / sum(past 144 solvetimes)&#xA;&#xA;They correctly did not use max(timestamp) - min(timestamp) in the&#xA;denominator like others do.&#xA;&#xA;They&#39;ve written the code and they&#39;re about to use it live, so Bitcoin&#xA;will have a clear, simple, and tested path if it suddenly needs to&#xA;hard fork due to having 20x delays for the next 2000 blocks (taking it&#xA;a year to get unstuck).&#xA;&#xA;Details on it and the decision process:&#xA;https://www.bitcoinabc.org/november&#xA;&#xA;It uses a nice median of 3 for the beginning and end of the window to&#xA;help alleviate bad timestamp problems. It&#39;s nice, helps a little, but&#xA;will also slow its response by 1 block.  They also have 2x and 1/2&#xA;limits on the adjustment per block, which is a lot more than they will&#xA;ever need.&#xA;&#xA;I recommend bitcoin consider using it and making it N=50 instead of 144.&#xA;&#xA;I have seen that any attempts to modify the above with things like a&#xA;low pass filter, starting the window at MTP, or preventing negative&#xA;timestamps will only reduce its effectiveness. Bitcoin&#39;s +12 and -6&#xA;limits on the timestamps are sufficient and well chosen, although&#xA;something a bit smaller than the +12 might have been better.&#xA;&#xA;One of the contenders to the above is new and actually better, devised&#xA;by Degnr8 and they call it D622 or wt-144.It&#39;s a little better than&#xA;they realize. It&#39;s the only real improvement in difficulty algorithms&#xA;since the rolling average.  It gives a linearly higher weight to the&#xA;more recent timestamps. Otherwise it is the same. Others have probably&#xA;come across it, but there is too much noise in difficulty algorithms&#xA;to find the good ones.&#xA;&#xA;# Degnr8&#39;s D622 difficulty algorithm&#xA;# T=TargetTime, S=Solvetime&#xA;# modified by zawy&#xA;for i = 1 to N  (from oldest to most recent block)&#xA;    t += T[i] / D[i] * i&#xA;    j += i&#xA;next i&#xA;next_D = j / t * T&#xA;&#xA;I believe any modification to the above strict mathematical weighted&#xA;average will reduce it&#39;s effectiveness. It does not oscillate anymore&#xA;than regular algos and rises faster and drops faster, when needed.</html></oembed>