How to build Steem manually (HF20 Ready)

Building_Steem.png


The next Hardfork, HF20 (what is that?), is planned for Tuesday, 25th September 2018 15:00 UTC.

I've already gone ahead and updated steemd on my primary witness-server and my seed-node to v0.20.0.

Instead of relying only on docker scripts, I also build Steem manually. And I know how difficult it is to find information/instructions about this. So I thought I'd make a post about it, for my fellow witnesses and those who want to become one in the future.


Building Steem Manually: Instructions

The official instructions can be found on the Steem Github: https://github.com/steemit/steem/blob/master/doc/building.md

I'm using Ubuntu 16.04 so that's what I'll use as the requirement here. (Other versions of Ubuntu need manually fiddelling with different versions of g++, boost etc.)

Additionally, you need at least 64GB RAM (or know how to deal with lower) in addition with 250GB+ disk space.

Disclaimer: If you read this post much later than the time of posting, the requirements will prob. have changed.


1.) Install Packages

The first step is to install all the needed packages.

Required packages

sudo apt-get install -y autoconf automake cmake g++ git libssl-dev libtool make pkg-config python3 python3-jinja2

Boost packages

sudo apt-get install -y libboost-chrono-dev libboost-context-dev libboost-coroutine-dev libboost-date-time-dev libboost-filesystem-dev libboost-iostreams-dev libboost-locale-dev libboost-program-options-dev libboost-serialization-dev libboost-signals-dev libboost-system-dev libboost-test-dev libboost-thread-dev libsnappy-dev libbz2-dev

Other Packages

sudo apt-get install -y ntp screen

Optional packages (not required, but will make a nicer experience for building)

sudo apt-get install -y doxygen libncurses5-dev libreadline-dev perl


2.) Clone Steem

Afterwards, we're going to clone the repository and checkout the correct branch.

git clone https://github.com/steemit/steem
cd steem
git checkout master #master is v0.20.0, stable is the  version before
git submodule update --init --recursive

3.) Build Binaries

Next up we are going to build the binaries - steemd & cli-wallet.

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DLOW_MEMORY_NODE=ON -DCLEAR_VOTES=ON -DSKIP_BY_TX_ID=ON ..
make -j$(nproc) steemd
make -j$(nproc) cli_wallet

# create a local bin folder and copy the binaries there
mkdir ~/bin
cp programs/steemd/steemd ~/bin
cp programs/cli_wallet/cli_wallet ~/bin
cd ~/bin

4.) Verify Steemd Version

Afterwards, make sure you've got the right steemd version, by entering steemd -v while inside the ~/bin folder.

It should look like:

steem_blockchain_version: 0.20.0
steem_git_revision:       9ea7ddf28c13b60df750434ddead8f7182d03e40
fc_git_revision:          9ea7ddf28c13b60df750434ddead8f7182d03e40

------------------------------------------------------

            STARTING STEEM NETWORK

------------------------------------------------------
initminer public key: STM8GC13uCZbP44HzMLV6zPZGwVQ8Nt4Kji8PapsPiNq1BK153XTX
chain id: 0000000000000000000000000000000000000000000000000000000000000000
blockchain version: 0.20.0
------------------------------------------------------

5.) Set Up TMPFS

If you want to use TMPFS for the shared memory file:

sudo mount -o remount,size=64G /dev/shm #change the size AND/OR the path if you need to
sudo sysctl vm.swappiness=1

6.) Create Config

Once you've got the steemd bin, you need to run it, so that the default config gets created.

If you want to have a global data folder (outside the bin folder), you need to create it first.

#cd ~/bin
steemd -d data/ #data is the directory

# close steemd again
nano data/config.ini

7.) Edit Config

Now, change the following parameters, based on your requirements and save the config.

shared-file-dir = /dev/shm/
shared-file-size = 64G
witness = YOURWITNESSNAME
private-key = PRIVATEKEY
plugin = # use the plugins you need

8.) Download Blocklog

Normally you would need to reindex steemd, which takes a lot of time, instead of just replaying.

So to save time, we'll first download the block-log and decompress it. (or you can download the decompressed version directly)

cd ~/bin/data/blockchain
rm block_log # delete old log
rm block_log.index # delete old index

# Either you can downloaded the compressed version and decompress it
wget https://gtg.steem.house/get/blockchain.xz/block_log.xz
xz -d block_log.xz -v # decompress block_log (will take roughly 1+ hour based on log size)

# Or download the decompressed version directly (it is 3-4x bigger)
wget https://gtg.steem.house/get/blockchain/block_log

Once we've done that, we're nearly done.


9.) Screen Session

The only thing that is left: making sure steemd is running, even if we're not connected via ssh to the server.

For that I'm going to use Screen with bash scripts (all credits go to @drakos for those)

# First make sure you have screen installed.
sudo apt-get install -y screen

# Then we're going to create the scripts (change path if needed)
cd ~/bin
echo -e '#!/usr/bin/env bash\nsteemd -d ~/data' > ~/bin/steemd-start.sh
echo -e '#!/usr/bin/env bash\nsteemd -d ~/data --replay-blockchain' > ~/bin/steemd-replay.sh
chmod +x ~/bin/steemd*.sh

# Next, we're adding aliases to the ~/.bashrc file
nano ~/.bashrc

# Copy those lines below into the file and save (change path if needed)
echo -e 'logfile steemd.log\nlogfile flush 1\nlog on' > ~/bin/steemd.conf
alias startsteemd='screen -X -S steem quit ; rm ~/steemd.log ; cd ~ ; screen -c ~/bin/steemd.conf -dmSL steem ~/bin/steemd-start.sh'
alias replaysteemd='screen -X -S steem quit ; rm ~/steemd.log ; cd ~ ; screen -c ~/bin/steemd.conf -dmSL steem ~/bin/steemd-replay.sh'
alias entersteemd='screen -x steem'
alias logsteemd='tail ~/steemd.log -f -n30'

Afterwards logout and login or enter source ~/.bashrc.

Commands

  • replaysteemd: replay steemd
  • logsteemd: monitor the logs (tail)
  • startsteemd: starts a screen session or kills it and starts again. (Exit with CTRl+A+D to leave process running)

When you run startsteemd or replaysteemd for the first time, you might get an error. Just enter it again.

Also, you should monitor the steemd.log size and delete it if it gets too big.


10.) NTP

Last but not least, to make sure you have an exact time-source and to prevent missed blocks due to time-differenes, we use NTP.

sudo apt-get install -y ntp # if you haven't already

sudo nano /etc/ntp.conf

# And then add these two lines
minpoll 5
maxpoll 7

# After saving the conf
sudo systemctl enable ntp
sudo systemctl restart ntp

To learn more about NTP: https://steemit.com/howto/@l0k1/howto-configuring-more-frequent-time-synchronisation-on-ubuntu


And that's it.

You should now have a Steem node that is ready to use.

I hope you found this post & the instructions helpful. And if there is an error or typo in this post, please let me know.

With that said:

Take care!

@therealwolf


Witness Infrastructure:
Primary Node: 128GB - v0.20.0 | Backup Node: 64GB - v0.19.12 | Seed Node: 64GB - v0.20.0

Projects I've developed on Steem:
Smartsteem.com > Investment & Promotion Service on Steem
Steem Chat-Wallet & Witness Essentials > Github: https://github.com/therealwolf42

If you believe that I'm of value for Steem, then please vote for me as witness. You can also set me as a proxy and I'll vote on great witnesses for you.

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center