[Bitcoin-ml] Proposal: DigiShield as difficulty adjustment

Nagai nagai at protonmail.ch
Mon Aug 28 16:19:51 UTC 2017


## Abstract

One of Bitcoin Cash's short term/medium term goals should be a new difficulty adjustment
system. The current difficulty system can be tricked by miners to earn more money.

We can use DogeCoin and DigiByte's difficulty system "DigiShield". Multipool is one of the
pools that automatically mine the most profitable coin, and it caused Scrypt/X11/SHA256 currencies to use more
stable difficulty systems. DogeCoin is one of that currencies that use "DigiShield" to minimize the effect of the pool jumpers.
It can also handle big hashrate drops. [Source: https://github.com/zcash/zcash/issues/147#issuecomment-221534222]
It's tested enough on Dogecoin to be used.

The difficulty is adjusted on every block, it uses last 10 blocks on DogeCoin to calculate new difficulty
- 25 minutes, maybe we should change it to 5 blocks [Source:
https://github.com/zcash/zcash/issues/147#issuecomment-202829008]

The difficulty can drop at most 16% and increase at most 8%. It may be effective, but it may allow time warp attacks.
[Source: https://github.com/zcash/zcash/issues/147#issuecomment-200331246]
We should fix it to 12%, I believe.

## Technical

-

The algorithm looks at a fixed number of previous blocks, and calculates the actual time they took (using medians to prevent timewarp attacks):

nActualTimespan = pindexLast->GetMedianTimePast() - pindexFirst->GetMedianTimePast();

-

An asymmetric floor and ceiling is applied:

nAveragingTargetTimespan = nAveragingInterval * multiAlgoTargetSpacing;

nMaxAdjustDownV3 = 16; // 16% adjustment down
nMaxAdjustUpV3 = 8; // 8% adjustment up
nMinActualTimespanV3 = nAveragingTargetTimespan * (100 - nMaxAdjustUpV3) / 100;
nMaxActualTimespanV3 = nAveragingTargetTimespan * (100 + nMaxAdjustDownV3) / 100;

if (nActualTimespan < nMinActualTimespanV3)
    nActualTimespan = nMinActualTimespanV3;
if (nActualTimespan > nMaxActualTimespanV3)
    nActualTimespan = nMaxActualTimespanV3;

-

The new difficulty is set to difficulty of the previous block (that had a matching mining algorithm) scaled by nActualTimespan/nAveragingTargetTimespan.

Quoted from: https://github.com/zcash/zcash/issues/147#issuecomment-202741851

## Discussions

Bitcoin ABC discussion about DigiShield starts here: https://github.com/Bitcoin-ABC/bitcoin-abc/issues/75#issuecomment-324618217

ZCash discussion - full of important information: https://github.com/zcash/zcash/issues/147
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/bitcoin-ml/attachments/20170828/3c53d897/attachment-0001.html>


More information about the bitcoin-ml mailing list