This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.

Steemit mining - from zero to an optimized miner

Words
582
Reading
3 min
Listen
Play
10y

Earning steem is easy. Just post some content and get them. But can you also mine it?

Sure you can!

This introduction shows how to mine steem using steemd, and how to optimize mining performance.

Instructions are for Ubuntu 14.04 and above.

First step, install dependencies:

Update package list:

sudo apt-get update

Get required packages:

sudo apt-get install git cmake libssl-dev libncurses5-dev libreadline-dev doxygen build-essential dh-autoreconf lzip libbz2-dev

Steem requires Boost version 1.57 or newer. As Ubuntu only provides 1.55, we need to compile it ourself:

wget -O - http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz/download | tar -xz
cd boost_1_60_0
./bootstrap.sh --prefix=/usr/local
sudo ./b2 --with-iostreams -j 8 install

where 8 is the number of parallel tasks. Use your number of cores here.

Download and compile libgmp (This can also be installed using the package manager, but compiling yourself provides better performance):

cd
wget https://gmplib.org/download/gmp/gmp-6.1.1.tar.lz
lzip -d gmp-6.1.1.tar.lz ; tar -xf gmp-6.1.1.tar
cd gmp-6.1.1
./configure
sudo make -j 8 install

Get the steem repository:

cd
git clone https://github.com/steemit/steem

Get required submodules:

cd steem ; git submodule update --init --recursive

---

This is optional, but provides about 10% faster mining:

Apply miner patch:

wget -O - http://hastebin.com/raw/ikoqitolan | patch ./libraries/plugins/witness/witness.cpp

Apply GMP patch:

wget -O - http://hastebin.com/raw/femelanoga | patch libraries/fc/CMakeLists.txt

wget -O libraries/fc/CMakeModules/Findgmp.cmake http://hastebin.com/raw/efahohubim

---

Compile:

cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONTENT_PATCHING=OFF -DLOW_MEMORY_NODE=OFF
make -j 8

Now run steemd and let it download the blockchain:

cd programs/steemd ; ./steemd --rpc-endpoint --seed-node="seed.steemed.net:2001" --seed-node="52.74.152.79:2001"

While it is downloading, start a second console and generate some keys:

cd; cd steem/programs/cli_wallet/
./cli_wallet

Depending on your cpu speed you need some keys, probably between 2 and 5. Generating more won't hurt.


suggest_brain_key
suggest_brain_key
..
suggest_brain_key
suggest_brain_key

until you have enough. Copy&paste them to some secure place.

What you'll need is the wif_priv_key.

When done, exit using Ctrl+C

Now edit ~/steem/programs/steemd/witness_node_data_dir/config.ini

What you need to add:

mining-threads = 8

(Depends on your total cpus/threads)

And add the keys you generated:

witness = "myLittleMiner0001"

miner = ["myLittleMiner0001","<wif_priv_key_1>"]

witness = "myLittleMiner0002"

miner = ["myLittleMiner0002","<wif_priv_key_2>"]

...

Save and restart steemd. Once the blockchain download is done, it will start mining.

Thats it! You are now mining VESTS.

Wait, what? I wanted to mine STEEM!

VESTS can be converted to STEEM, but they are converted over a 2 year period. For the conversion rate have a look at

https://steemd.com/

"steem_per_mvests"

Currently its 229.8, thats 229.8 STEEM per million VESTS.

Miner output explained:

1413275ms th_a       witness.cpp:426               on_applied_block     ] hash rate: 31431 hps  target: 30 queue: 105 estimated time to produce: 569 minutes

Your current hash rate is 31431 hashes/s. Difficulty is currently 30, that is a chance of 1/(2^30) to enter the mining queue. With my current hash rate thats on average on per 569 minutes.

The mining queue can be seen here:

https://steemd.com/witnesses

(Right side).

All those miners have generated a pow, once they do, they enter the mining queue at the bottom. When they reach top place, they are rewarded with VESTS.

Difficulty depends on the length of the mining queue. For every 4 miners difficulty raises by 1 (=doubles). Higher difficulty = less miners are able to enter, mining queue shrinks. This way it regulates itself.

Be aware that hardforks happen quite often. In this case you need to:

Stop steemd
cd ~/steem ; git pull
make -j 8
Start steemd

In case errors occur (can't append block, ...)

Try to add --replay-blockchain when starting steemd. This has always fixed it for me.

This is it. If you like please vote it up. I'll look here from time to time - if you have questions, feel free to ask.

Steemit mining - from zero to an optimized miner | Ecency