an explanation of DigiShield (by the Dev DigiByte 1 year ago)
DigiShield re-targets a coin’s difficulty to protect against multi-pools and an over-inflation of easily mined new coins. DigiShield was originally developed for DigiByte, but has since been implemented into Dogecoin and will soon be implemented into more coins. DigiShield re-targets a coin’s difficulty between every block or in the case of DigiByte & Dogecoin, every 60 seconds.
We created DigiShield after seeing the threat that multi-pools pose to a crypto currency when they start mining a coin at a very low difficulty in relation to their net pool hash. This allows many coins to be quickly and easily mined before the difficulty increases. Once the difficulty increases the multi-pool leaves a coin, dumps the coins on the market, and then leaves the dedicated existing miners with a very high difficulty and very few new coins to be mined. This leads to a drop in price and frustration among the committed community members & miners of the affected coin. DigiShield protects DigiByte against this threat and helps ensure greater confidence in any coin that implements it by allowing the difficulty to rise and fall almost perfectly in sync with increases or decreases in the net hash of a coin. The secret to DigiShield is an asymmetrical approach to difficulty re-targeting. With DigiShield, the difficulty is allowed to decrease in larger movements than it is allowed to increase from block to block. This keeps a blockchain from getting "stuck" i.e., not finding the next block for several hours following a major drop in the net hash of coin. It is all a balancing act. You need to allow the difficulty to increase enough between blocks to catch up to a sudden spike in net hash, but not enough to accidentally send the difficulty sky high when two miners get lucky and find blocks back to back. The same thing occurs with difficulty decreases. Since it takes much longer to find the next block, you need to allow it to drop quicker than it increases.
The KGW (Kimoto Gravity Well) and Earthcoin approaches to difficulty re-targeting are not as effective as DigiShield in protecting against multi-pools. We conducted extensive testing over a five day period and found that an asymmetrical approach was much more effective than the KGW approach. We found that the difficulty needed to be able to decrease by a larger magnitude than it was allowed to increase. When the difficulty was allowed to increase or decrease at the same rate with larger orders of magnitude, some very bad oscillations occurred along with some crazy high difficulties when two lucky blocks were found quickly back to back. The asymmetrical adjustments keep the difficulty from going to high to fast, but allow it to drop much quicker after a large hash down swing as it takes a much longer time to discover the next two blocks for the difficulty adjustment to occur.
Both the KGW and Earthcoin approaches to difficulty re-targeting still allow multi-pools a few minutes of easy mining. For example, Earthcoin still gets hit my multi-pools for 11-12 minutes at time. Both approaches limit the amount the difficulty is allowed to change between blocks, which can become a big issue when a sudden hash decrease occurs. While simulating a sudden 10-20 fold hash decrease, KGW can become "stuck" for several hours before the next few blocks are discovered and the difficulty evens out again. The same issue exists with the Earthcoin approach. It can get "stuck" for 20-40 minutes following an 11 minute hash increase from a multi-pool attack. We know a 10-20 fold hash increase is unusual, but it is possible, especially as cryptocurrencies become better known. More than likely, we will only ever see more than a 5-10 fold increase. Nonetheless, we wanted to develop something that protected against even the most unlikely of hash jumps to ensure that we could handle sudden extremes very quickly.
In summary DigiShield is a balanced asymmetrical approach to difficulty re-targeting. You don't want to let the difficulty go to high to fast, but you need to give it enough room to catch up quickly. The same thing goes with down swings, since it takes longer to discover new blocks you need to give it more room to go down, but not enough to send it to the floor. DigiShield is by no means the absolute "perfect" solution to the multi pool/ difficulty problem, but after testing dozens of different setups over a five day period including KGW and the Earthcoin approach, the current ratios/ settings in DigiShield out performed any other solution available at the moment.
The DigiShield code can be found here between lines 833 & 1007:
https://github.com/digibyte/DigiByteProject/blob/master/src/main.cppTake a look at the Dogecoin difficulty chart:
http://www.coinwarz.com/difficulty-charts/dogecoin-difficulty-chart.
You can see how multi-pools have really been mining most of the coins and leaving the dedicated Doge miners to pick up the slack and get the short end of the stick when it comes to new coins. You can also see when DigiShield took effect and that no longer occurs.
Now take a look at the chart for DigiByte:
http://www.coinwarz.com/difficulty-charts/digibyte-difficulty-chart.
You can see how we would get "stuck" after a multi pool left us and it would take several hours more than our 2.4 hour re-target before the difficulty came back down. Had we not implemented DigiShield when we were hit with the 1 GH - 8GH increase we might have been "stuck" for a day or more. See how quickly the pool hit us and left, and more importantly see how fast the difficulty decreased back to normal levels? Since DigiShield went into effect, you can see how quickly multi-pools hit us and leave, whereby they mine considerably less coins now, upwards of 50-80% less.
www.DigiByte.co