What is DarkGravityWave? It uses multiple exponential moving averages and a simple moving average to smoothly adjust the difficulty. This implementation is far more simplistic and better suited to adjust difficulty than KGW and also fixes all known exploits.
Here's the commit if you're interested:
https://github.com/evan82/darkcoin/commit/07c99052edc617975cdcbe4482e02c52e2d1fbf5
But the problem is that KGW retargets every block, but allows timestamps backwards over more than 1 block. I don't see how this is fixed in DGW, can you explain?
I am genuinely curious as to how you have fixed the time warp exploit problem because I think that your algorithm is still susceptible. Even though you don't include a negative time between blocks into your sum, you still count the block. Further below this affects your 'smart average' slightly. I don't think that this is the main issue, however. With the Dark Gravity Wave I am still able to jump forward 5 blocks and then back in time 1 block. I don't violate any of the timestamp rules by doing this, and I am able to achieve an actual timespan that is larger than the target timespan, thus lowering the difficulty.
Edit: I think you may have done yourself a disfavor by not including the negative time between blocks. Doing so would bring down your average block spacing and calculated sum. This drops your actual timespan and in essence punishes an attacker for jumping back in time. I'm not saying this would fix anything. Am I missing something here?
Just make an adjustment to the difficulty baseline so they don't get the benefit of difficulty adjustments made after their own timestamp.
In other words, if a new block is timestamped prior to the previous four, you proceed as if the base difficulty were the same as it was prior to those four blocks.
poof, every time warp exploit in the world becomes impossible.
I'm not sure, if this is enought. Hasn't he got those 4 blocks cheaper? He still can go far to the future and stay there generating cheap blocks, waiting real chain to catch in time.
There is a rule in DGW making it so it won't include the timestamp if that is the case, plus it uses a different strategy that is far more simplistic. The KGW exploit was done against Darkcoin in the mainchain, so I ran it against DGW and it seemed to work just fine.
A limit on the difficulty adjustment does not hinder me from exploiting the timestamps. Remember, if I am working with my own private chain, I have all the time in the world to build a chain that is longer, abides by all the rules, but has a lower difficulty; the exploit gets easier as the difficulty gets lower.
Could we get BCX in here to confirm that this is still exploitable?