Steem Mining - Comprehensive Guide

in #steem8 years ago




Finding pertinent information concerning mining Steem is a non-trivial issue. Realize that only 1% of the Steem Power reward goes to miners, so it's not the most cost-effective way to gain Steem. And then there's the issue of not being able to transfer or sell it without having to trickle it out over two years. Nevertheless, there's something satisfying about knowing your computers are working for you, and watching the hashes fly by.

How To Set Up Your Miner

The exact setup for a miner depends mainly on your operating system. I haven't personally tried Mac OSX, so I can't comment on that, but I know for a fact that both Windows and Linux are capable of mining Steem. I haven't noticed any differences in performance across operating system, but I haven't controlled for many factors, including number of processing cores, speed of cores, generation of processor, amount of RAM, etc, so your results may vary.

  1. Install or compile the mining software

How to Compile Steemd and cli_wallet

The first step, if you're using Ubuntu 14.04 or early, is to get Boost set up properly. Steemd requires a specific version of Boost which is more recent than the default repositories provide. This may also be the case with 16.01, but I haven't tried compiling there.

Before following any of these instructions, I encourage you to think about what each line actually does, and don't be afraid to ask questions if you're not sure. It's better to sound silly than to break your computer.

Updating to Boost-1.60

The easy way to update boost is to avoid compiling it entirely, in my opinion, and to just add a repository that is already hosting it. Then it's a matter of simply updating the list of available packages, and installing the correct version (Steem wants 1.60):

Enter these commands into a terminal:

echo 'deb http://cz.archive.ubuntu.com/ubuntu yakkety main universe' | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install libboost1.60-all-dev -y
sudo apt auto-remove -y

Just four lines of commands, no wait for compilation, hell no wait for tar to extract 30,000 files, no having to install to the correct path, and no need to manually remove the conflicting default version; no muss, no fuss.

Compiling steemd and cli_wallet

Finally we're at the most pivotal step, compiling the steemd client. This process may take some time, possibly upwards of 15 minutes, so have patience while it completes.

Enter these commands into a terminal:

sudo apt-get install -y cmake git doxygen libssl-dev libsecp256k1-dev libncurses5-dev libreadline-dev tmux
git clone http://github.com/steemit/steem.git
cd steem
git submodule update --init --recursive
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONTENT_PATCHING=OFF -DLOW_MEMORY_NODE=ON

cores=$(nproc)
make -j$cores

This will use all of your processing cores to compile files simultaneously. You can specify how many cores you want to use by providing a number, e.g., "make -j3" would use at most three processing threads. Your computer may hang during the compilation, in which case I'd recommend trying again without the '-j' flag in the command. While it's easier to just use 'make -j' directly, I've had that crash more often during compilation than specifying the number of cores on my PC.

Now I don't see it mentioned anywhere, but I believe the low memory node flag implies that your node can only be used for mining. If you have that set, you won't be able to run a full node, which is necessary to become a witness. This also means Steem will require far less memory. With the low memory blockchain already being >1.5GB, this is probably in your best interest. I'd appreciate feedback on the validity of this point, however.

Adding the Client to the User Path

Now personally, I like to put everything in my root folder, and work from there. If you're not like me, and like to be tidier, follow these instructions so you can run 'steemd' from anywhere

sudo cp ~/steem/programs/steemd/steemd ~/steem/programs/cli_wallet/cli_wallet /usr/bin

Final Steps - Slow Method (No worries about skipping this part)

You didn't skip it? Cool, this should give you a more through understanding of what's going on. Or maybe not, maybe you're just wasting time going through this section, hell I feel like I wasted a lot of time just writing it!

Enter these commands:

cd
mkdir witness_node_data_dir
nano witness_node_data_dir/config.ini

Setting up config.ini

Now this is where things get interactive. You can use VIM, EMACS, GEDIT, whatever you feel most comfortable with for this part. We're going to set up our miners. Here's my config.ini, just replace the witness= and miner= with your account's. I'll give more detail on that at the end of setup.

Cut and paste this text into config.ini

# P2P nodes to connect to on startup (may specify multiple times)
# seed-node =
seed-node = 52.38.66.234:2001
seed-node = 52.37.169.52:2001
seed-node = 52.26.78.244:2001
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 = steemd.pharesim.me:2001
seed-node = seed.steemed.net:2001
seed-node = steem.clawmap.com:2001
seed-node = seed.steemwitness.com:2001
seed-node = steem-seed1.abit-more.com:2001

# Set an API to be publicly available, may be specified multiple times
public-api = database_api login_api

# Plugin(s) to enable, may be specified multiple times
enable-plugin = witness account_history

# Track market history by grouping orders into buckets of equal size measured in seconds specified as a JSON array of numbers
bucket-size = [15,60,300,3600,86400]

# How far back in time to track history for each bucket size, measured in the number of buckets (default: 5760)
history-per-size = 5760

# Enable block production, even if the chain is stale.
enable-stale-production = false

# Percent of witnesses (0-99) that must be participating in order to produce blocks
required-participation = false

# name of witness controlled by this node (e.g. initwitness )
# witness =
witness="geoffrey"

# name of miner and its private key (e.g. ["account","WIF PRIVATE KEY"] )
# miner =
miner=["geoffrey","geoffrey's ACTIVE key"]

# Number of threads to use for proof of work mining
# mining-threads =
mining-threads = 8

# WIF PRIVATE KEY to be used by one or more witnesses or miners
# private-key =
private-key = geoffrey's ACTIVE key

# declare an appender named "stderr" that writes messages to the console
[log.console_appender.stderr]
stream=std_error

# declare an appender named "p2p" that writes messages to p2p.log
[log.file_appender.p2p]
filename=logs/p2p/p2p.log
# filename can be absolute or relative to this config file

# route any messages logged to the default logger to the "stderr" logger we
# declared above, if they are info level are higher
[logger.default]
level=warn
appenders=stderr

# route messages sent to the "p2p" logger to the p2p appender declared above
[logger.p2p]
level=warn
appenders=p2p

Where mining-threads = should be set to your number of processing threads.

Now, the witness and miner are the important attributes here. You want to get your active key for your account from https://steemit.com/@geoffrey/permissions where you'll need to login and click "show key". The key should start with a "5", not "STM", which is your public key. I've also filled in the private-key= with that same key (no quotes around it), but I believe that's completely redundant and unnecessary.

Finally, We Can Start Mining

This time, we're going to start a tmux session which stays open as long as you're mining. That way, if you close your terminal window, it won't interrupt the mining. This is just a one-liner:
tmux new-session -s steem-mine '~/steemd --rpc-endpoint'

You should see some stuff happening, and it should start talking about how many blocks it's downloaded every 10,000. Right now there's nearly 4,000,000 so it will take some time. If you're satisfied it's doing its thing, hit control-b + d to detach from tmux. That's holding control while hitting b, letting go of control and hitting d in quick succession. Confusing, I know. If you screw up somehow, hit control-c to get out of any interactivity. If you get pissed off enough, keep hitting control-c until you kill tmux dead.

Final Steps - Fast Method

If you followed the instructions up to here, you will start downloading the blockchain from other nodes. This is a slow process. You can speed things up considerably by downloading a recent snapshot of the blockchain. To accomplish this, we use @steemychicken1's updated snapshot:

cd
wget http://www.steemitup.eu/witness_node_data_dir.tar.gz
tar xvzf witness_node_data_dir.tar.gz

The download should only take about 20 minutes on a 1MB/s connection. This method includes a pre-customized 'config.ini', so edit that after you extract the folder to add your miners. An easy way of dong this is with the "append" command:

cd ~/witness_node_data_dir
echo 'witness=geoffrey' >> config.ini
echo 'miner=["geoffrey","Active key"]' >> config.ini
echo 'mining-threads=8' >> config.ini

But be careful with the nested single and double quotes. Once the blockchain is setup and everything is configured, we can start mining as above:
tmux new-session -s steem-mine '~/steemd --rpc-endpoint --replay-blockchain'.

You only need to replay the blockchain your first time using that bootstrapped blockchain. You can just run
tmux new-session -s steem-mine '~/steemd --rpc-endpoint when starting again.

Phew, that was a lot longer than "a few steps"

My bad. Once it's all written down it does seem somewhat extensive. Hopefully if you've got to this point, you can take solace in the fact that your computer is now earning you Steem Power! If not, well, comment and I'll try to help you debug. Or go on http://steemit.chat and join #mining for further support.

How to mine to multiple addresses

Why would you want to do this? If you're fortunate enough to find a block (CONGRATULATIONS!), you are forced to wait about an hour, in what's called a queue, for you to get paid for that block, and to get a chance to mine again with that miner. During that time, your computer will sit idle, unless you setup additional accounts to mine to during that downtime. These accounts are prioritized by alphabetical order, so one easy solution is to take your real username, and append increments to the end for each extra queued miner.

This part is easy, it's the as in the previous steps:

cd ~/witness_node_data_dir

# Repeat for each extra miner
echo 'witness=geoffrey-01' >> config.ini
echo 'miner=["geoffrey-01","new mining key"]' >> config.ini
echo 'mining-threads=8' >> config.ini

Personally, I just reuse my ACTIVE key for my main account for each miner. Though this suggests you should go to extra effort to keep your config.ini secure and unseen by potentially malicious actors.

How do I know if my miner found a block? When can it start mining again?

The easiest way to monitor this, that I know of, is to visit your page on steemd: http://steemd.com/@account and you should see "account found a pow" on your log. You can then visit http://steemd.com/witnesses and watch your name slowly climb up the "Miner-witness queue" on the right-hand side. It takes almost a minute to move up one spot, and the queue is generally 100+ entries long, so you can see why you'll probably want at least two miners available so you're not just sitting there waiting for work to start again.

How to mine across multiple computers

Now this is where I cannot claim confidence in my solution. I would like to propose the best way of doing this, and would appreciate feedback from anyone who is doing this. The main issue comes from the fact that if you set the same witness on two different computers, and if you mine a block simultaneously on both, you will forfeit your entire account balance to anybody else who notices what you've just done. Harsh, right!?

The main issue is that it's hard to get mined Steem Power out of an account. I think you need to have earned quite a bit, and wait a while, before you can power down. This will then require waiting two years to get the full balance. Because of this, I would personally prefer to always be able to mine to my main account when it's not minting. Here is an illustration of how I propose to do this, but due to the extensive risk involved I haven't tried this solution across my three computers:

  • Computer 1's config.ini excerpt:
witness = "geoffrey"
miner = ["geoffrey","Active key"]
miner = ["geoffrey-01","geoffrey key"]
miner = ["geoffrey-02","geoffrey key"]
miner = ["geoffrey-03","geoffrey key"]


  • Computer 2's config.ini excerpt:
witness = "geoffrey-01"
miner = ["geoffrey","Active key"]
miner = ["geoffrey-01","geoffrey key"]
miner = ["geoffrey-02","geoffrey key"]
miner = ["geoffrey-03","geoffrey key"]


  • Computer 3's config.ini excerpt:
witness = "geoffrey-02"
miner = ["geoffrey","Active key"]
miner = ["geoffrey-01","geoffrey key"]
miner = ["geoffrey-02","geoffrey key"]
miner = ["geoffrey-03","geoffrey key"]



Simple, right? None of the computers use the same witness, but they all have the same miners. One of the miners never even serves as a witness, in fact. Is this all of this above board? Will this allow me to optimize reward allocation across accounts?

Do the mining rewards even go to the miner, or do they go to the witness?

These questions are best answered by someone who has successfully mined in this fashion. So, I look to you, the readers, for an answer to this question.

Connecting with the cli_wallet

If you've noticed, we always use the '--rpc-endpoint' option with steemd. This is so we can connect with the cli_wallet for monitoring. You can specify the ip and port to connect with in the config.ini if you so wish, but I prefer to let the steemd handle choosing a port for me.

However, this article is long enough without me documenting how to use the cli_wallet. I hardly ever use it, anyway, since most of the end-user stuff is accessible through steemit.com.

Thanks for making it all the way to the end!

I hope you found this article fascinating, or if it was in fact mind-numbingly dull, at least maybe somewhat educational.


Sort:  

This is a very comprehensive and thorough guide to mining Steem. Thank you for putting it together. Dull? Maybe, but not "mind-numbingly" so. You've explained it well and as a non-technical user, I was able to follow along just fine. Definitely very educational!

I was just talking to a friend about this earlier today. Thanks for the resource.

This is actually a very useful post, thanks. @calva upvote this

А как исправить эту ошибку
http://prntscr.com/c10bak
http://prntscr.com/c10bra

ура заработала, тока не майнит ни фига
http://prntscr.com/c1fcia

Nice guide. Ive asked several times on the multiple computers bit myself and got answers that I just dont think make sense (to me). What Ive gathered however is the rewards goto to the witness not the miner account.. so your proposed plan will send rewards to 3 different witness accounts.. which maybe a problem as dont you need to have a certain amount of Vests to even trigger a transfer or withdrawal?

In section 'Updating to Boost 1.60' I'm getting info message when enter command ' sudo apt auto-remove -y' . Message is 'Command line option 'y' [from -y] is not known'. Should it be 'sudo apt-get autoremove -y'?
However, even after I enter modified command the result is 0 removed. My Ubuntu version is 14.04.4.

That command isn't too important, it's just doing some housekeeping. I've tried all 4 variants (apt-get or apt, and -y or not) and they all work on my Ubuntu 14.04 box, so I'm not sure why they don't for you.

I am using Ubuntu instance in AWS, so this might be happening on AWS env only.

Just skip the auto-remove command. And you may need to also 'sudo apt-get install build-essential dh-autoreconf -y'. I can't update my post to reflect this, though.

So I've done all of this a bunch of times but the thing that never occurs is that I never see my username move up through the queue. 28khps, have waited several hours.

Thoughts? Suggestions?

Honestly at that rate you'd be lucky if you get 1 block a day. If you watch steemd, you'll see it says something along the lines of: "estimated time to produce a block: 1500 minutes." That translates to a little over a day. That's on average though, you may find a single block much sooner, or much much slower.

So your machines, what's your hash rate if you don't mind my asking.... And what's the hardware?

The same, actually, 28k~30k. One's a dual cpu server - 4 cores each, but they're from 2009 so together they only hash as fast as my main computer - a quad core i7 4770k. I'm also hashing on a few other computers I have lying around, but they're much slower. I got extremely lucky and found a few blocks, though.

Oh just few blocks, 0.0476 STEEM per block? Thus, you've got no more than 0.5 STEEM?

Great post, btw :)

@geoffrey I did find this fascinating and considering if it is worth the bother to reconfig a old junked pc to a new steem miner?

Thanks. It's no longer possible to mine Steem, it's all DPoS now. I'm sure there are other coins out there you could mine, but you'd be spending more on electricity than they could possibly earn.

@geoffrey it's as I thought, thnks for the confirm

All these instructions are for Linux, right? Do you have planed to make a windows step by step? I hope so ;)

Thank you!

Warning! mining STEEM is not possible anymore.
Save your time.

Can I mine STEEM?
No. Proof of work mining has been removed from Steem.
https://steemit.com/faq.html#Can_I_mine_STEEM