We may have just fixed a critical bug in Steem.

in #steem8 years ago (edited)

https://github.com/GolosChain/golos/pull/37

What happened

A few hours a go user penguins-cymbals issued a one-line patch that could change the tide of mining on steemit. You can view the patch here https://github.com/GolosChain/golos/pull/37/commits/1ccffb32af9972d25fae0f721215eb5d13a847b0
The implications of this patch can make mining distributed and democratic once again.

How this patch works

When you are mining on steem, ideally you want all cores of your machine working on different equations called hashes. If you have each core of your machine working on a different hash you are optimizing your time very well. What steem was doing before this patch was having every core do the same exact work. The patch makes it so each core is doing its own thing and not duplicating any other core.

The implications of this patch are that serious miners can see 8-times, 16-times, and even 32-times the amount of hashing power they had before. This will disrupt the gtx-rabbit duopoly on the steem mining queue. We will begin to see more people and more users mining again. This could potentially increase the price of steem and attract new users to SteemIt if we are lucky.

How to apply the patch

To apply this patch, follow these simple instructions.

git clone https://github.com/steemit/steem.git
git submodule update --init --recursive
cmake -DBOOST_ROOT="$BOOST_ROOT" -DCMAKE_BUILD_TYPE=Release .

Here is the important part.
Modify the file libraries/plugins/witness/witness.cpp and skip down to line 540.
Insert a new line and on it put the following code: thread_num++;
It should look like this

                return;
             }
          }
       } );
      thread_num++;
    }
}

(Thank you @contentjunkie)
Now you can return to the main steem directory where you ran the above code and run this line: make -j4

I now encourage you to follow any of the many mining guides on SteemIt, if you like you can follow mine.
https://steemit.com/steem/@picokernel/tutorial-mining-get-rich-the-old-fashioned-way

Closing

Thank you penguin, If you get in contact with me I can monetarily subsidize you for releasing this bug.

If you like the work I doing in the SteemIt community I would really appreciate a witness vote.

I am using the money to pay for my own work as well as community projects. My GPU miner bounty is still open and I have coordinated with other users to make sure they will still pay when one is released. I will be using my witness funds to provide liquidity on the internal market most recently. My witness node is picokernel and you can find my witness thread at https://steemit.com/witness-category/@picokernel/witness-application-nate-brune-developer-and-dedicated-steemite

Thank you for your time.

Sort:  

Very cool @picokernel, but how could a latent bug like this have not been obvious based on performance metrics analysis, just curious?

Unfortunately, this bug was introduced during a mining algo change. We all assumed that the hash rate dropped because of the fact that we changed the algo. It's just one of those things we all overlooked. Including me, I feel bad. I spent a lot of time looking at the algo and trying to figure out what the hack was. Oh well!

Gotcha @picokernel, well the good news is you guys fixed it and it's now in the rearview mirror, good job!!!

You're welcome. Feel free to contact me in steemit chat or golos chat under the pen name 'penguin', as I would certainly like to claim any associated bounty. :)

(Note: unfortunately I do not own the 'penguin' account here on steemit... that was a bit short sighted of me.)

Nice bro!!

To make the instructions a little bit clearer your code should look this around line 540

                return;
             }
          }
       } );
      thread_num++;
    }
}

Edit: I've compiled a Windows binary with this patch included (https://steemit.com/steemit/@contentjunkie/steemd-exe-windows-64-binary-with-mining-thread-patch)

Thank you so much !

I added it to the main post :)

I built a new miner with git - so it already had the patch. I updated an old one and spent 3 hours trying to figure out how I could know that the patched worked. Turns out my friend @contentjunkie already figured it out. I've tried it - it works. This is only if you are super anal - otherwise just run the 3 steps at the top and it will update your miner!

Good news! I'll turn on a miner and see how this patch does. Thanks for bringing this to Steemit. You've had my witness vote for a while.

How would it increase the price of steem if people are able to mine it faster?

The mining rate is fixed in terms of the Steem produced. It just allows people to mine more efficiently and compete better against GPU miners.

Ah, thanks for the education :)

This is a great find, but unfortunately even with the fix it seems people with private GPUs miners (gtx and rabbit) still have a big edge. Not quite as big as before, but still big. I think we need to push ahead with other solutions such as getting an open source GPU miner developed.

Thank you for sharing this:) Unfortunately I have already voted for the maximum number of people otherwise you would definitely get one of my votes.

Haha I know the feeling! It's tough to pick good ones, and I am sure you have.

Yes I'm happy with the people I have already picked and I would feel bad about deselecting them because they are all doing a good job. I just wish I could vote for more people! There are lots of good people like yourself that deserve a vote, unfortunately there will always be limited places.

Wow! This is great news. Can't wait to hear and see verification that this patch will break the rabbit/su monopoly on mining Steem.

Jeez, I am glad someone finally figured this out. That was really bugging me...........seriously, I hated seeing Rabbit and the other one dominating the mining queue. That sucked. Good job with this! I tweeted this post out too!

Great news! Hope it will help both golos and steem ;D

Wish I knew what you were talking about and how to do it. Way above my head,yes I am a newbie. Got anything I could study. I want to start my life story in the days ahead,but I want to understand this new form of media so I don't blow it.

Are windows binaries being officially released to the public yet?

I really wish I knew how to mine without worrying about blowing up my computer. But I just started learning about cryptocurrency when I joined Steemit so I figure I have some time.... Thanks for the info. I've bookmarked this for the time when my hair doesn't hurt from reading it. :P

I won't pretend to understand the coding and mining stuff but I do understand this should be good for the Steem price.
Thank you, I voted for you as witness.

First, thank you to @picokernel and to @contentjunkie for the work you've done on this.

One point of clarification, though. The more I think this through, the more confused I get. The miner throws its work away and starts over every 3 seconds, right? So how does it matter if the N cores are chasing 1 problem or N problems? Either way, I think they're only going to hit one block (at most) during the interval, aren't they? If N cores are chasing one problem, they've got N chances to solve it. If they're chasing N problems, they've got 1 chance to solve each of them. (N * 1) or (1 * N) - same net result. Not saying you're wrong, since I haven't read the code, but I'm just trying to understand.

Guess I'll have to break down and RTFM one of these days...

Last, FYI, I tried the windows compiled executable, but for some reason, I could only get it to use 1 core. It ignored my "mining-threads" setting in config.ini and the "-t" command line argument. Not sure if anyone else is having this problem or not.

Update: Clicked through to github. Now I get it. I hadn't understood that all cores are using the same nonce. So the miner really only has 1 chance to solve 1 problem with the unpatched version. Not N chances.

Fix implemented miner back up and running. Thanks bro!

I already did this literally the other day before seeing the bug report, seemed sorta obvious.

@charlieshrem can confirm that i'm serious.

Sorry to ask a stupid question, but what's the algo we're using for mining? I could go look it up, but right now I'm exhausted.

Nice work @picokernel!

It is custom. I'm not sure it has a name other than "Steem mining algorithm (version 2)"

Doesn't seem to be making a difference yet on https://steemd.com/witnesses I guess we'll need a lot of cores to even approach the GPU miners.

Well fix gives CPU 2-8x advantage, but GPU or some other bug seems to give 100x+ advantage at least =(

This post has been linked to from another place on Steem.

Learn more about and upvote to support linkback bot v0.5. Flag this comment if you don't want the bot to continue posting linkbacks for your posts.

Built by @ontofractal