<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>This seems unnecessarily complicated (&quot;don&#39;t use cannon to kill mosquito&quot; kind of thing). If the community were interested in a realtime hashrate rebalancing proposal one could simply adjust difficulty at each new block using the current method. <br><br>If faster relaxation in case of adversity is required, it suspect that it would suffice to perform a weighted average of the previous 2016 blocks instead of the standard averaging that is currently done. It should be possible to find an optimal weighting based on historical interblock timing data. I look into it over the next couple of days.<br></div><div><br></div><div>dpinna</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
------------------------------<br>
<br>
Message: 3<br>
Date: Tue, 8 Mar 2016 22:05:07 +0000<br>
From: Bob McElrath &lt;<a href="mailto:bob_bitcoin@mcelrath.org">bob_bitcoin@mcelrath.org</a>&gt;<br>
To: Dave Hudson &lt;<a href="mailto:dave@hashingit.com">dave@hashingit.com</a>&gt;<br>
Cc: <a href="mailto:bitcoin-dev@lists.linuxfoundation.org">bitcoin-dev@lists.linuxfoundation.org</a><br>
Subject: Re: [bitcoin-dev] Hardfork to fix difficulty drop algorithm<br>
Message-ID: &lt;<a href="mailto:20160308220507.GA4388@mcelrath.org">20160308220507.GA4388@mcelrath.org</a>&gt;<br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
Dave Hudson via bitcoin-dev [<a href="mailto:bitcoin-dev@lists.linuxfoundation.org">bitcoin-dev@lists.linuxfoundation.org</a>] wrote:<br>
&gt; I think the biggest question here would be how would the difficulty<br>
&gt; retargeting be changed?  Without seeing the algorithm proposal it&#39;s difficult<br>
&gt; to assess the impact that it would have, but my intuition is that this is<br>
&gt; likely to be problematic.<br>
<br>
I have no comment on whether this will be *needed* but there&#39;s a simple<br>
algorithm that I haven&#39;t seen any coin adopt, that I think needs to be: the<br>
critically damped harmonic oscillator:<br>
<br>
    <a href="http://mathworld.wolfram.com/CriticallyDampedSimpleHarmonicMotion.html" rel="noreferrer" target="_blank">http://mathworld.wolfram.com/CriticallyDampedSimpleHarmonicMotion.html</a><br>
<br>
In dynamical systems one does a derivative expansion.  Here we want to find the<br>
first and second derivatives (in time) of the hashrate.  These can be determined<br>
by a method of finite differences, or fancier algorithms which use a quadratic<br>
or quartic polynomial approximation.  Two derivatives are generally all that is<br>
needed, and the resulting dynamical system is a damped harmonic oscillator.<br>
<br>
A damped harmonic oscillator is basically how your car&#39;s shock absorbers work.<br>
The relevant differential equation has two parameters: the oscillation frequency<br>
and damping factor.  The maximum oscillation frequency is the block rate.  Any<br>
oscillation faster than the block rate cannot be measured by block times.  The<br>
damping rate is an exponential decay and for critical damping is twice the<br>
oscillation frequency.<br>
<br>
So, this is a zero parameter, optimal damping solution for a varying hashrate.<br>
This is inherently a numeric approximation solution to a differential equation,<br>
so questions of approximations for the hashrate enter, but that&#39;s all.  Weak<br>
block proposals will be able to get better approximations to the hashrate.<br>
<br>
If solving this problem is deemed desirable, I can put some time into this, or<br>
direct others as to how to go about it.<br>
<br>
--<br>
Cheers, Bob McElrath<br>
<br>
&quot;For every complex problem, there is a solution that is simple, neat, and wrong.&quot;<br>
    -- H. L. Mencken<br><br></blockquote></div></div></div>