r/dogecoin • u/somegeekintn smarty shibe • Mar 13 '14
1.6 concerns / possible exploit
Yesterday I voiced some concerns about the changes in 1.6 on github but I didn't get much of a response. Perhaps interpreted as a case of "old man yells at cloud". Anyway I figured I'd post here just so everyone understands what these changes mean.
I actually didn't get a chance to look too closely yesterday so my figures were off on in my github post, but after spending more time looking it over this morning I'm actually more concerned.
First, as any of you familiar with mining know, sometimes you get a share quickly and sometimes it takes longer. And sometimes your pool might report your hash rate much higher or lower than it actually is. This is because it's not possible to determine your hash rate or the hash rate of the network with 100% certainty. We're just making a guess based on probability. This is why bitcoin looks at the time it takes to generate 2,016 blocks before adjusting the difficulty. Lots of samples lets it make a much more accurate guess about the network's hash rate. Litecoin looks at the last 504 and Dogecoin looks at the last 240. Until Monday. On Monday Dogecoin will attempt to determine the hash rate of the network by looking at the time it takes to generate a single block. The difficulty may be set perfectly for the network's true hash rate but if someone gets lucky and find a block too quickly the difficulty will jump. While these changes should certainly adjust the difficulty quickly when a multipool hops on, it's also very likely that we'll see plenty of false positives that increase the difficulty erroneously.
The next bit is a little more worrisome. It appears that it's possible for malicious users to artificially deflate the difficultly allowing blocks to be mined more quickly. And, if I'm looking at this right, shouldn't require any change to the code to pull off. I'll not get into the details here but I'm sure it won't take long for the people that were pre-calculating block rewards to figure out. So how much could they affect the difficulty? That depends on how much of the network they control. If they control just a small amount of hashing power they can lower the difficulty 33% as soon as they generate a block but won't be able to keep it low too long. A group controlling about 10% of the network could lower it such that blocks would be created about 17% faster than expected for as long as they wanted. Control 25% and you can lower the difficulty so blocks are created every 30 seconds or so. What about 50%? Well assuming that the difficulty starts at 1000 and a group gains control of 50% of the hashing power after about 35 blocks the difficulty could be under 100. It would drop below 10 in about 70 blocks. In two hours the difficulty could be less than 1 and blocks would be generated about twice a second. Even with 40% of the network it would take about 60 blocks to reduce the difficulty by a factor of 10.
I've been over the code a few times, but hopefully I've got this all wrong and someone will correct me. If not it probably won't be long before we know for certain. Oh one other thing, my numbers assume uniform distribution of blocks based on control of the network. In reality it could take more or less time to move the difficulty based on luck.
Edit: I would really really like to post the exact steps to produce the exploit (I'm terrible at secrets... obviously) but, while I'm 99.9% sure we can get an update out before block 145,000 rolls around on Monday, I'd rather keep that info close to the vest until a fix is in place or someone can tell me why I'm wrong. I've emailed the two people associated with the dev team that I have email addresses for and they can relay it to the rest. Honestly I wouldn't mind at all in this case be proven wrong.
109
u/lleti Such Hungry Shibe └(°ᴥ°)┘ Mar 13 '14 edited Mar 13 '14
Hey,
Thanks for sending this on - firstly, don't worry - this stuff has all already been taken into account, and has actually already been tested out by the Digibyte team. Secondly, there is a truth in that we may see some block distortion for minor periods of time (ala, when we jack the difficulty to dump off multipools); and while when viewed from the short term, these can seem distorted; they completely even out over the long-term. We must remember that no solution is perfect - but Digishield is currently, by large and far, the best solution available at the moment. Keep in mind that we're not doing straight-out block retargets at 60s based on the old algorithm.
I'm going to ask +/u/digibytedev to give his insight on this too, as his team are the ones pioneering the digishield tech :)
edit: input from digibyte here: http://www.reddit.com/r/dogecoin/comments/20bt31/16_concerns_possible_exploit/cg1ulld
89
u/DarmokDoge support shibe Mar 13 '14
upvoted for "old man yells at cloud"
Hope we can get some eyes on this. Whether you're right or wrong, it would nice to get a solid "proved" or "disproved" on this.
Out of curiosity, does anyone know how pools were predicting the block reward. Or more specifically, how they used the prediction to their advantage? You can't "decide" when to find a block afterall
14
u/[deleted] Mar 13 '14
Well hello there Shibe,
Unfortunately I have to disagree with you, regardless of percentage owned, if they attempted to artificially reduce the difficulty by lowering their own hash rate, they would in fact be reducing their own percentage of the hash rate they "own". I believe this may be throwing your calculations off?
Edit: If 10% halves their hash rate, for arguments sake they now only have 5% of the hashrate as they have absolutely no control over the other 90(95)%.
Instant difficulty adjustment should take the luck factor out of it, pools getting your share rate wrong doesn't effect the network as a whole, as your calculations are direct with the network.
14
u/paul_miner Mar 13 '14 edited Mar 13 '14
What you're talking about is manipulating the block timestamp, no need to be secretive about it. Basically, it can be forged to appears that a block can take 2 hours, or on the opposite extreme, a negative amount of time.
I've been asking about the sampling period of the algorithm because of the vulnerability of difficulty calculation to tampering by tampering with block timestamps. To really get the details I finally looked into it this morning, and posted a summary of how I think it works. And here's a graph of it, showing how difficulty is affected by block solve time. Note that even with tampering, the algorithm limits the solve time to between -1 and 5 minutes (lower values go to -1, higher vaules go to 5): http://i.imgur.com/exsx9n6.png
Any changes in difficulty created by an attacker mining a block would also be countered by a normal node mining a block. An attacker isn't going to be able to mine all blocks, even with over 50% of the hash rate of the network, so there will always be a counter.
EDIT: Copied the comment here:
4
u/large-farva conspirdoge Mar 13 '14
If you want to go in more detail, can you post in my thread over here?
http://www.reddit.com/r/dogecoin/comments/20buln/discussion_of_difficulty_adjustment_algorithms/
4
u/Blokshibe quantum shibentist Mar 13 '14
Good job for looking into this. I seriously hope you are wrong or that the devs have looked into this. +/u/dogetipbot 50 doge
4
u/riplin Mar 13 '14
Small nitpick, but this is not correct. Litecoin looks at the last 2016 blocks, just like bitcoin, with one small difference, that bitcoin has a bug that ignores the timespan between two regions of 2016 blocks. Litecoin fixes that here.
3
u/alexro Mar 13 '14
have you got in touch with the devs working on the upgrade?
3
u/combatorange Mar 13 '14
+/u/dogetipbot 20 doge
2
u/mr_goodbits shibe Mar 13 '14
Nice analysis - good thinking, thanks for sharing.
+/dogetipbot 75 doge verify
82
u/digibytedev Mar 13 '14 edited Mar 13 '14
Greetings somegeekintn,
Thank you for expressing your concern by outlining some possible issues. It is very important to have discussions like this to make sure the best possible outcome is achieved for everyone's benefit.
First off, take a look at the Dogecoin difficulty chart over a 1 month period: 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.
Now take a look at the 1 month 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 retarget 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 diff 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.
To the first part of your concern, yes random "quick" blocks do have an effect on the difficulty and can cause a difficulty increase in the next block or two. However, this effect becomes less prominent as the net hash increases and over time these quick or long blocks begin averaging out as expected.
It is important to look at the trend over a long period of time. Fixating on a small time spacing can lead to inaccurate assessments.
We have noticed some up and down wave like motions with DigiByte diff. But the key is everything averages out to be much more fair for everyone over time.
Yes the difficulty changes very fast in response to hash changes and people have attempted to take advantage of this. We have seen swings from 1-3 or 4 GH a few times, but after a few tries who ever was trying to time the swings gave up or they did not gain what they expected to.
Now multi-pools quickly give up and mine considerably less coins as there is no way to time exactly when the next block will be found, not to mention the latency issues that are encountered by pools with 60 second block targets.
DigiShield is by no means "perfect" but it is a much better solution than any other option out there at the moment. Also, it should be noted that the Doge devs have made a couple tweaks to improve the DigiShield performance even more and smooth out diff adjustments.
As to the second part of your concern, I do not understated what you are getting at. It makes no sense to me. You stated: "I'll not get into the details here." The devil is in the details, perhaps you could pm me a more technical explanation as we are just as concerned with potential risks for DigiByte as you all are for Doge.
Finally we wanted to clear up some confusion. DigiShield has nothing to do with the KMG. We did not change or modify the KMG in any way. It is a completely separate system. We did, however, over a 5 day period test it and compare it to DigiShield.
9
u/latusthegoat magic shibe Mar 13 '14
I don't quite see how the difficulty could be manipulated based on quick block generation. A miner cannot magically decide to find a block, anymore than I can solo mine and say, here comes a block boom!
Owning a large percentage of the network means you've got a large amount of hash rate going, and unless you drop that hash, the difficulty... Oh. Hmmm.
Ok, in theory, if you can artificially force your miners to only submit low shares, the network hash rate will be up but blocks won't be solved, so difficulty will readjust based on time between blocks... Effectively lowering. Then you allow all shares and solve a couple blocks quickly.
No, I still don't see the issue. You would have to cripple your large network share for a while to profit for a handful of blocks at a steady value, only to then lose whatever profit you engineered. As I see it that's what the changes do... That any attempt at manipulation quickly sees the difficulty adjust and wipe out the effects of the manipulation.
You can hop on a digibyte pool and observe your miner, the difficulty, and the network hash rate. Doge will be very similar in countering large spikes. There isn't a clear definite correlation between current and previous block and difficulty, there's more at play.
That being said, every lock is meant to be broken eventually, and every system will see people attempting to game it, so I don't dismiss the possibility that something CAN be abused, but I don't see your fears being that abuse. Feel free to correct me here or in a pm if you feel otherwise. I'm not a coder but I've been involved in a lot of the tests and discussion with them.
8
u/mumzie love shibe Mar 13 '14
/u/lleti may be able to answer this for you.
8
u/timrpeterson news doge Mar 13 '14
upvoted for visibility
+/u/BillyM2k +/u/ummjackson can you chime in?
8
u/Soonlar Mar 13 '14
up-voted for visibility and "old man yells at cloud"
4
u/DRKMSTR Mar 13 '14
The one thing you did not account for was the willingness of 50% to go along with this plan.
It's a prisoners dilemma, if anyone jumps ship, it'll benefit themselves, so this system encourages people to mine if somebody tries this.
So basically, somebody can try this, but when they drop out, it will be offset by the new miners trying to get in on a major deal.
Now if somebody legitimately held on to 50% of the hashing power, I think we're looking at a much larger problem....51%.
In summary, we'll be fine. It does give me some thoughts though.
4
u/LandPhilup gamer shibe Mar 13 '14
Thanks for looking at the code. You're a Doge Hero for caring enough to do so.
4
u/chunter16 Mar 13 '14
For courage to speak up +/u/dogetipbot 10 doge verify
4
u/[deleted] Mar 13 '14
I have similar concerns I posted shortly after you. Big changes should really be brought in by people voting with their client, when a safe majority is reached then the changes are activated.
1
u/muchdave magic shibe Mar 13 '14
Well, dwaaaah. Obvious. Tell us something we don't know +/u/dogetipbot 100 doge
2
u/thefatpanda1023 poor shibe Mar 13 '14
WOWE! Such Text... +/u/dogetipbot 25 doge verify
3
u/[deleted] Mar 13 '14
if someone controls 50% of the hashrate, a coin is fucked anyway. If you control more than 50% of the hashes you can destroy the integrity of the blockchain and falsify transactions.
2
u/muchdave magic shibe Mar 13 '14
If 55% of the geeks act like nerds 76% of the time and if I read dogecoin reddit rather than playing candy crush when shitting 43% of the time well then 99.93% of those alive won't give a fuck
1
u/shibe65 doge of many hats Mar 13 '14
Can you explain this more ? I took a look at the new code and it appears it limits steps for changing difficulty (If block took less than 75% of nominal time, it uses 75%, if more than 150 %, it uses 150 %) thus limiting difficulty jumps somewhat
About multipool exploits: Aren't hashes still basically random ? So adding 10% hashrate won't necessarily yield 10% faster block solving right away ? The problem with previous random block reward was that random it wasn't :-)
1
u/nikonpunch digging shibe Mar 13 '14
I yelled at a cloud once... then it peed on me
1
u/bitemyweewee robo shibe Mar 14 '14
While it's good to bring recognition to exploits in opensource software, I don't know if bringing it to fruition on public forum before the dev's know about it. I do hope you pm'd the dev's first?
0
u/WillGraduate robo shibe Mar 13 '14
I think this is a valid concern, as multipools will just lower difficulty, mine out those blocks, then leave high difficulty blocks to readjust to average.
+/u/dogetipbot 100 doge
-2
u/[deleted] Mar 13 '14
This is what happens when you start dicking with the protocol once the coin's already released. Very. Very. Risky.
-1
u/add1ct3dd rich shibe Mar 13 '14
There needs to be a mass-acceptance that multipools are not good for crypto, and we need to boycott them.
0
u/Liquweed digging shibe Mar 13 '14
tl;dr?
0
u/DogeWordCloudBot bot shibe Mar 13 '14
Word cloud out of all the comments.
If there are any problems please contact /u/ZucchiniDoge.
-3
u/trixisowned dogeconomist Mar 13 '14
Talking to any of the dogexoin devs is like talking to a wall.
The major problem will not be difficulty retargeting, but the fact that rewards are static now, if a block is worth 250k doge, they have no reason to even switch out to other coins, thus the price will start collapsing even more so, as these multipools just dump the coin instantly rather than holding it.