[Tutorial] [Mining] Get rich the old fashioned way!

in #steem4 years ago (edited)

Intro

Firstly, congrats everyone. By the time you read this I expect steem to have found its new footing at ~$1. That is nothing to sneeze at guys, but its just the beginning! Congrats.

Did you know that back in 2009 if you solo mined one block, you could have made 50 bitcoins? That seems insane to think about today. 50 BTC is roughly $32,000 of today's dollars. That's assuming you hit just one block though. Many of those miners hit several blocks back in the day.

Could you imagine getting on the ground floor of something like that today? Well now you can. Let me introduce steem mining! Steem mining is great because not only do you make Steem Power, but you also help out the network.

Enough of the introductions though. In the coming mining posts I plan to discuss these three things

  • Mining instructions
  • How is mining different in steem
  • My personal mining experience

In this post though, we are only going to do the first one. I hope you brought your boots cuz we are about to get mining :)


Getting your miner

Firstly. I will give every instruction in one single code block for Linux and Windows users. After that I will explain what everything is.

Arch Linux ( another guide for debian based systems is here so I will do arch)
$ pacman -S g++ cmake git python3 openssl ncurses
$ yaourt -A secp256k1-git
$ cd Downloads
$ git clone https://github.com/steemit/steem
$ cd steem
$ git submodule update --init --recursive
$ cmake CMakeLists.txt
$ makeIf there are any errors at this step or the one above, comment below.
$ cd programs/steemd/
Download the most recent blockchain from here. This is a website that updates with the latest blockchain every 5 minutes. Downloading it is quicker in the browser. ( I used this method )
Extract the blockchain.tar.gz file into the steemd/programs/steemd folder. You should now have a folder called witness_node_data_dir in there. While you're waiting for that to download, move on to the next step. 😄

Now for the windows users

Windows ( more info: https://steemit.com/steem/@tuck-fheman/how-to-mine-steem-in-windows)
Download [this folder.](https://github.com/btscube/steem/releases/download/v0.8.5b/cli-tools-085b.zip) It is bitcubes miner.
Extract the contents of the cli-tools folder to your desktop or where ever you please.
Download the most recent blockchain from here. This is a website that updates with the latest blockchain every 5 minutes. Downloading it is quicker in the browser. ( I used this method )
Extract the blockchain.zip file into the cli-tools folder. You should now have a folder called witness_node_data_dir in there. While you're waiting for that to download, move on to the next step.


Setting up your miner

or should I call it setting up for your retirement ;p

Alright! Awesome take a deep breath. IMO that is the hardest part :).
Next we are going to move into the mysterious realm of the config.ini file. The config.ini file is in the witness_node_data_dir folder. There are a few tid-bits that you need to edit before you are ready to get mining. The first is the rpc-endpoint field which you should see near the top of the file. Enter this in that field.

rpc-endpoint = 127.0.0.1:8090

This field allows for you to connect to steamd later with the cli_wallet tool. It is quite handy and many tutorials will soon be released telling you how to use it. Trust me on this one.

The second field is the seed-nodes field which you should also see near the top of the file. Enter these nodes in there

seed-node = 192.99.4.226:2001
seed-node = 46.252.27.1:1337
seed-node = 81.89.101.133:2001
seed-node = 52.4.250.181:39705
seed-node = 85.214.65.220:2001

That oughta give you a nice trust-able block chain. If you want even more seed nodes you can click this link which will take you to a public list of nodes. The next fields that you need to set up are the witness fields. I have three set up, but you're welcome to set up as many as you like. It is very simple, just add witnesses like we did in the above step. There is no need to make new accounts or anything, just make sure the witnessName's you chose arent already taken usernames. You can check if it is taken by going to steemit.com/@witnessName. If it says unknown account that means its not taken. My witness fields look like this

witness = "picokernel"
witness = "picokernel2"
witness = "picokernel3"

The reason that we have to set up multiple witnesses is because of something very interesting about the way coins are mined on steem. I will get into exactly why in a bit, but roughly the reason is as follows. Once your miner hits the "target", it lines up to get in the queue to mine a block. The queue currently averages about 100 people in line and takes about ~1.5 hours to get through. When your first witness, in my case picokernel gets in the queue, it stops mining. It doesn't look for any more hashes. This wastes time, so during these ~1.5 hours you want another miner waiting in the wings. That's why you set up multiple witnesses. Just thought I would mention that because no other guides seem to have mentioned that. Another thing to note is that the witnesses are selected in alphabetical order. In my case picokernel will go first, then picokernel2 then picokernel3.

The next bit I have found to be a little bit difficult to understand for newbies. It is the miner field.
In your config file you should have just as many "miner" variables as "witness" variables. The miner field layout is as follows

miner = ["witnessName", "WIF Private KEY"]

The witnessName corresponds to the names you just put in the last step. All three of them. The WIF private key is the tricky part. I see people asking about this everywhere. I will show you a picture of how to find it. First go to your Permissions page and then click login on the active row as shown here.

The private key that you need has now showed up. You're going to want to put that in the WIF Private KEY field as I showed in the format above. remember to use the same private key for every miner even though you use different witness names. My config looks a little something like this

miner = ["picokernel", "5Hp~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1"]
miner = ["picokernel2", "5Hp~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1"]
miner = ["picokernel3", "5Hp~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1"]

The second to last field you have to fill out it the mining-threads field. I advise that you set the threads to however many cpu threads you have. So for instance mine looks like this.

mining-threads = 4

When you are all done, you can sit back, relax and run the steemd --replay command. It should use the blockchain that you downloaded earlier and begin fetching the last few blocks. Its worth noting that you only need to use the --replay flag the first time you download the chain. Every other time you can just put steemd. You can check how close you are to the current block by visiting this page and looking at the last block.

NOTE: You might only get 1hps initially but that is only because you are still bootstrapping the blockchain. It will correct itself after a while.

Any other errors just post in the comments and I or some other member of this friendly community will get to you.


In conclusion...

Alright! That is it. I really hope that this was enough information to clear up a lot of the questions about mining steem. If you thoroughly enjoyed this post I ask that you vote for me as a witness. I plan on getting an AWS going soon so I can be a serious member of the community. You can vote using the command
vote_for_witness youraccount picokernel true true
in the cli_wallet. Thank you again and good luck!

Sort:  

Nice write up. You can download the blockchain.zip and use it for linux miner too. The saved blockchain can work for linux version too.

I did not know about the multiple witnesses. Thanks for the clarification. Upvoted!

Thanks! I'll add that. Do you mind me recommending people download your client btw?

If i have multiple witnesses/miners, does that mean i will have to watch or login to multiple steemit accounts? How do i ensure all the steem power/vests/steem i mine goes into my primary account and not into separate steemit accounts like miner1, miner2, miner3 if my main account is miner?

I configed denverliu and denverliu2 (miner and witness), after it found a pow waitting in queue, than return nothing to denverliu, 2 times. Where did the mined properties go?

Im slowly getting the hang of it... Any POW rewards you find with denverliu will go to @denverliu and any POW rewards you find with denverliu2 will go to @denverliu2. You will end up having multiple accounts. Also - you wont get the rewards until the miner is done mining the block. https://steemd.com/@denverliu

They were in the Steemd queue list, but didn't reflect in my wallet. Now that the 2 POW rewards are disappeared.

May I know if I have multiple machine instances, how to config for each ?

Im not sure I understand what you mean.

You just need to login to the different miners.

Hi, thank you for your post, but I am quite confused about the mining result. Where are the mined steem going ? How do you check that any is produced. Does any one can point me to the right direction ? Maybe I should read the White Paper .....

See my above response. It should help you out :)

Is there a specific way to set up multiple computers to mine? Can i use unique witness/miner names on the second computer but use the same private key that i used for the first computer? Or do i have to use a different key for the second computer?

Id recommend setting up separate miners. Makes it easier. You can use the same key however

Hey @picokernel . Would you mind sharing your full config.ini, this witness/miner thing is not super clear to me.

More specifically, witnesses are just made up unique names? No need to register them anywhere?

Can you generate a single WIF Private Key, and then make up 100 witnesses and 100 miners with that same key?

That is 100% correct to my knownledge. I would highly advice you name your witnesses
furion
furion2
furion3
furion4
I recommend this so that the majority of your mined steem power goes to your main account.

Does the majority of mined SP go to first account due to alphabetic ordering?

Unfortunately I'm stuck with the build. I get the following error (Arch Linux, updated today):

[ 10%] Building CXX object libraries/fc/CMakeFiles/fc.dir/src/uint128.cpp.o
In file included from /usr/include/boost/config.hpp:61:0,
                 from /usr/include/boost/container/flat_map.hpp:14,
                 from /home/sevcsik/dl/steem/libraries/fc/include/fc/container/flat_fwd.hpp:2,
                 from /home/sevcsik/dl/steem/libraries/fc/include/fc/reflect/typename.hpp:10,
                 from /home/sevcsik/dl/steem/libraries/fc/include/fc/reflect/reflect.hpp:18,
                 from /home/sevcsik/dl/steem/libraries/fc/include/fc/time.hpp:138,
                 from /home/sevcsik/dl/steem/libraries/fc/include/fc/log/logger.hpp:3,
                 from /home/sevcsik/dl/steem/libraries/fc/include/fc/exception/exception.hpp:6,
                 from /home/sevcsik/dl/steem/libraries/fc/include/fc/uint128.hpp:6,
                 from /home/sevcsik/dl/steem/libraries/fc/src/uint128.cpp:1:
/usr/include/boost/multiprecision/cpp_int.hpp:193:4: error: right operand of shift expression ‘(1u << 63u)’ is >= than the precision of the left operand [-fpermissive]
    BOOST_STATIC_CONSTANT(limb_type, sign_bit_mask = 1u << (limb_bits - 1));
    ^

My boost version is 1.60.0-5. Cheers

Adding -fpermissive to CXX_FLAGS in flags.cmake files seems to be a workaround. Command:
sed -ie 's/CXX_FLAGS = /CXX_FLAGS =-fpermissive /' **/flags.make

error code
I seem to have the same problem, and your workaround does not seem to work.. Any suggestions?

@edit: I had a problem allocating the make files..**/flags.make was not working.. Did it this way:

find -iname flags.make >> tmp
cat ./tmp | while read line; do sed -ie 's/CXX_FLAGS = /CXX_FLAGS =-fpermissive /' $line;done

Thank you for the "solution" :D

That saved me some time. Cheers

What happens if someone create a user with witnessName that i choose?
And i have 1 hp for two hours now, is it normal?

Its normal, it took me a few hours to get up and going!

thanks, now is running well

I don't see a witness_node_data_dir after I extracted the blockchain.zip into the cli-tools folder. What am missing?

when you run steemd for the first time, it will create the folder structure. Then you can extract blockchain.zip into witness_node_data_dir/blockchain/database/block_num_to_block.

The multiple witnesses part is very useful, thank you.

What should the command line be saying when it's mining correctly? Also how long does it take to sync the blockchain if you download it from scratch?

thanks for the instructions. but i have doubts about the profitability of mining steem power. I would like to mine steem directly! is there a way? steem power should be converted to steem that takes 2 years!!!!

Readers digest condensed version (Linux - Ubuntu 15.04)

Machine 1:
steemd --miner='["machine1","5xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]' --witness='"machine1"' --mining-threads=11 [or whatever]

Machine 2:
steemd --miner='["machine1","5xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]' --witness='"machine2"' --mining-threads=11

Note 5xxx... is the same for both machines.
Enough said.

Loading...

Hi @picokernel I have tried all this, the link for blockchange is not valid, for the rest is ok. But i dont get the last on; n you are all done, you can sit back, relax and run the steemd --replay command. It should use the blockchain that you downloaded earlier and begin fetching the last few blocks. Its worth noting that you only need to use the --replay flag the first time you download the chain. Every other time you can just put steemd. You can check how close you are to the current block by visiting this page and looking at the last block.
I dont find this--replay flag? how or where do i find this?