Author

Topic: ★★ DigiByte ★★ What is DigiShield & How it Works to Retarget Difficulty (Read 2589 times)

jr. member
Activity: 51
Merit: 1
what happens to a network that run digishield and has only 2 miners (one pc and one asic) if the asic leaves the network ? does the network get stuck ? when the next block will be mined by PC ?
legendary
Activity: 1722
Merit: 1051
Official DigiByte Account
With all the recent attention to KGW exploits, we have been receiving many more questions about DigiShield. Bump.
full member
Activity: 210
Merit: 100
Nice info. ive been looking for this
sr. member
Activity: 434
Merit: 250
Thank you for the expaination and hopefully this could bring more people to DGB.
newbie
Activity: 41
Merit: 0

I think a few coins will want Digishield added. Smiley

maybe you can charge them for a hardfork. Smiley  good biz.
legendary
Activity: 2940
Merit: 1090
As it is an asymmetrical adjustment, wouldn't that make it vulnerable to time warp exploit?

Yeah these assymetric systems are apparently really great for time-warpers.

They can get the difficulty low really fast, so as to insta-mine lots more coins really soon, then back down really fast to do it again, pow it is great for them.

-MarkM-
hero member
Activity: 770
Merit: 500
Can you provide more statistical details how digishield is superior to KGW or other difficulty re-targeting  approaches ?
legendary
Activity: 996
Merit: 1013
As it is an asymmetrical adjustment, wouldn't that make it vulnerable to time warp exploit?
legendary
Activity: 1722
Merit: 1051
Official DigiByte Account
We also would like to hear if anyone has any ideas on how to improve upon this!
legendary
Activity: 1722
Merit: 1051
Official DigiByte Account
Feel free to ask us any questions you may have here on this thread.
legendary
Activity: 1722
Merit: 1051
Official DigiByte Account
What is DigiShield & How it Works to Retarget Difficulty

After receiving countless messages asking us what exactly DigiShield is we decided to write a post and explain everything in greater detail.

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 too high too 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 too high too 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.cpp

Take 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.


Main DigiByte Thread: https://bitcointalksearch.org/topic/digibytedgb-core-v61651-digishield-digispeed-segwit-408268

Jump to: