How To Setup A Low Cost, Low Memory Basic Witness + Seed Node


Edit:

This is an outdated guide. Please refer to the latest guide on Steem's official Github.

https://github.com/steemit/steem

Requirements:


2 VPS Instances and local machine(local machine not required but STRONGLY RECOMMENDED for security using the Cli_wallet)
Single Core CPU or more
1GB RAM or more(2GB+ STRONGLY RECOMMENDED)
Ubuntu 16.04
30GB SSD with sufficient IOPS(Input/Output Operations Per Second) speed or more(SSD STRONGLY RECOMMENDED, may need larger storage depending on VPS IOPS)

This setup was done using 2 Amazon EC2 t2.micro free tier VPS instances(technically not free from surcharges for instances). You are welcome to use any VPS of your choice. The SSD volume used was the "General Purpose SSD (GP2)." If you want your nodes to compile faster and not have much issues, I STRONGLY RECOMMENDED upgrading to a "Provisioned IOPS (IO1)" and set the IOPS minimum 1000 or higher. It can go up to 10000 but it costs a little extra using the provisioned SSD. I have tested on both and works fine just signing blocks but less stability issues having sufficient IOPS

Follow the guide step by step and you should have no problem getting your node running.Running a full witness node and seed requires more ram and storage.

Security



You will NOT be using your WIF active private keys on these machines so ufw should be sufficent enough. For any reason your nodes are compromised, it is not your active keys and you can change the keys with suggest_brain_key from the Cli_wallet that will be explained later. If you feel you need more security then head over to @krnel's witness setup post and follow the "Securing Your Server Tutorials".
@krnel/complete-witness-installation-guide

sudo ufw allow openssh
sudo ufw allow 2001
sudo ufw enable 

Monitor Ram Usage(optional)


sudo apt-get install htop
sudo apt-get install iotop

sudo htop or sudo iotop to start

Resize shared memory directory /dev/shm


Currently the memory size for a basic witness that only signs transactions is close to 6GB You can adjust the size but the higher amount you go, the more storage space you use and free tier is only 30GB.

sudo mount -o remount,size=8G /dev/shm
sudo nano /etc/fstab

Add on a new line

none /dev/shm tmpfs defaults,size=8G 0 0

Create Swap File


If you already have a swap, make sure it's turned off first to resize sudo swapoff /swapfile

sudo fallocate -l 8G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Backup Swap

sudo cp /etc/fstab /etc/fstab.bak

Edit fstab to load on boot

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Tweak Swap Settings

Adjusting the Swappiness Property

The swappiness parameter configures how often your system swaps data out of RAM to the swap space. This is a value between 0 and 100 that represents a percentage.

With values close to zero, the kernel will not swap data to the disk unless absolutely necessary. Remember, interactions with the swap file are "expensive" in that they take a lot longer than interactions with RAM and they can cause a significant reduction in performance. Telling the system not to rely on the swap much will generally make your system faster.

Values that are closer to 100 will try to put more data into swap in an effort to keep more RAM space free. Depending on your applications' memory profile or what you are using your server for, this might be better in some cases.

Adjusting the Cache Pressure Setting

Another related value that you might want to modify is the vfs_cache_pressure. This setting configures how much the system will choose to cache inode and dentry information over other data.

Basically, this is access data about the filesystem. This is generally very costly to look up and very frequently requested, so it's an excellent thing for your system to cache.

In this case, I used these values. You can change them accordingly to your machine.

sudo sysctl vm.swappiness=20
sudo sysctl vm.vfs_cache_pressure=50


Source

Edit To Start On Boot

sudo nano /etc/sysctl.conf

Bottom of page on new line enter:

vm.swappiness=20
vm.vfs_cache_pressure=50

Optimize system(from HF 0.16.0)

echo    75 | sudo tee /proc/sys/vm/dirty_background_ratio
echo  1000 | sudo tee /proc/sys/vm/dirty_expire_centisecs
echo    80 | sudo tee /proc/sys/vm/dirty_ratio
echo 30000 | sudo tee /proc/sys/vm/dirty_writeback_centisecs 

Install Steem


This instructions if for a fresh install of Ubuntu 16.04 and commands are done in the default directory /home/ubuntu/(or if you have your own setup, change /home/YOURCOMPUTERNAME/)

Prerequisites

sudo apt-get install -y \
    autoconf \
    automake \
    cmake \
    g++ \
    git \
    libssl-dev \
    libtool \
    make \
    pkg-config \
    screen \
    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 \
    doxygen \
    libncurses5-dev \
    libreadline-dev \
    perl

NOTICE:

COMPILING ON A LOW RESOUCE MACHINE CAN TAKE SOME TIME. FREE TIER ON AMAZON IS LIMITED ON IOPS(INPUT OUTPUT PER SECOND) FOR THE STORAGE TO READ A WRITE AND IS RECOMMENDED TO COMPILE AND RUN ONE INSTANCE AT A TIME. DOING BOTH AT THE SAME TIME CAN RESULT IN 24HRS+ TO COMPILE AND 24HRS+ TO REINDEX BLOCKCHAIN. HIGHER SPEC MACHINES COMPILE FASTER. UPGRADING TO A PROVISIONED SSD WILL SOLVE THE LONG WAIT TIME BUT COSTS A LITTLE EXTRA MONTHLY.

sudo git clone https://github.com/steemit/steem && cd steem && git checkout v0.16.3 && git submodule update --init --recursive && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DLOW_MEMORY_NODE=ON -DENABLE_CONTENT_PATCHING=OFF .. && make -j$(nproc) steemd && make -j$(nproc) cli_wallet && make install  # defaults to /usr/local


Return to default home directory /home/ubuntu/(or /home/YOURCOMPUTERNAME/)

cd /home/ubuntu/

Start steemd to download the config files and exit. Takes only a second.

steemd

Press on keyboard

Ctrl+c

Edit config.ini file for witness and seed


sudo nano witness_node_data_dir/config.ini

Seed config.ini

These are the only lines you need to edit on the config file. Make sure those lines are commented out(no #).

List of seed nodes has been updated from earlier in January 2017. You don't need to add all the seed nodes but I included it on here too so you can pick which you would like to add. You can find the list updated by @gtg here: https://github.com/Gandalf-the-Grey/steem/blob/seednodes-update/doc/seednodes.txt

# Endpoint for P2P node to listen on
p2p-endpoint = 0.0.0.0:2001

# P2P nodes to connect to on startup (may specify multiple times)
seed-node = seed.riversteem.com:2001       # riverhead
seed-node = steem-seed1.abit-more.com:2001 # abit 
seed-node = 52.74.152.79:2001              # smooth.witness
seed-node = seed.steemd.com:34191          # roadscape
seed-node = steemwitness.matthewniemerg.com:2001 # complexring
seed-node = steemd.pharesim.me:2001        # pharesim
seed-node = seed.jesta.us:2001             # jesta
seed-node = 212.117.213.186:2016           # liondani
seed-node = anyx.co:2001                   # anyx
seed-node = seed.xeldal.com:12150          # xeldal
seed-node = seed.steemnodes.com:2001       # wackou
seed-node = steem.clawmap.com:2001         # steempty
seed-node = gtg.steem.house:2001           # gtg
seed-node = 192.99.3.29:2001               # joseph
seed-node = 5.9.18.213:2001                # pfunk
seed-node = lafonasteem.com:2001           # lafona
seed-node = seed.rossco99.com:2001         # rossco99
seed-node = 212.47.249.84:40696            # ihashfury
seed-node = seed.steemfeeder.com:2001      # au1nethyb1
seed-node = 52.175.211.168:2001            # aizensou
seed-node = seed.roelandp.nl:2001          # roelandp
seed-node = 81.89.101.133:2001             # cyrano.witness
seed-node = steem.global:2001              # klye
seed-node = seed.esteem.ws:2001            # good-karma
seed-node = 176.31.126.187:2001            # timcliff
seed-node = seed.royaltiffany.me:2001      # royaltiffany
seed-node = seed.thecryptodrive.com:2001   # thecryptodrive
seed-node = steem-id.altexplorer.xyz:2001  # steem-id
seed-node = seed.bitcoiner.me:2001         # bitcoiner
seed-node = 104.199.118.92:2001            # clayop
seed-node = 192.99.4.226:2001              # dele-puppy
seed-node = 89.36.26.82:2001               # dragosroua
seed-node = 104.198.222.18:2001            # bitcoinparadise
seed-node = 138.197.17.188:2001            # chitty
seed-node = 88.99.33.113:2001              # cervantes
seed-node = seed.bhuz.info:2001            # bhuz
seed-node = 149.56.108.203:2001            # @krnel 

# Location of the shared memory file. Defaults to data_dir/blockchain
shared-file-dir = /dev/shm/

# Size of the shared memory file. Default: 32G
shared-file-size = 8G

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

Witness config.ini

# P2P nodes to connect to on startup (may specify multiple times)
seed-node = seed.riversteem.com:2001       # riverhead
seed-node = steem-seed1.abit-more.com:2001 # abit 
seed-node = 52.74.152.79:2001              # smooth.witness
seed-node = seed.steemd.com:34191          # roadscape
seed-node = steemwitness.matthewniemerg.com:2001 # complexring
seed-node = steemd.pharesim.me:2001        # pharesim
seed-node = seed.jesta.us:2001             # jesta
seed-node = 212.117.213.186:2016           # liondani
seed-node = anyx.co:2001                   # anyx
seed-node = seed.xeldal.com:12150          # xeldal
seed-node = seed.steemnodes.com:2001       # wackou
seed-node = steem.clawmap.com:2001         # steempty
seed-node = gtg.steem.house:2001           # gtg
seed-node = 192.99.3.29:2001               # joseph
seed-node = 5.9.18.213:2001                # pfunk
seed-node = lafonasteem.com:2001           # lafona
seed-node = seed.rossco99.com:2001         # rossco99
seed-node = 212.47.249.84:40696            # ihashfury
seed-node = seed.steemfeeder.com:2001      # au1nethyb1
seed-node = 52.175.211.168:2001            # aizensou
seed-node = seed.roelandp.nl:2001          # roelandp
seed-node = 81.89.101.133:2001             # cyrano.witness
seed-node = steem.global:2001              # klye
seed-node = seed.esteem.ws:2001            # good-karma
seed-node = 176.31.126.187:2001            # timcliff
seed-node = seed.royaltiffany.me:2001      # royaltiffany
seed-node = seed.thecryptodrive.com:2001   # thecryptodrive
seed-node = steem-id.altexplorer.xyz:2001  # steem-id
seed-node = seed.bitcoiner.me:2001         # bitcoiner
seed-node = 104.199.118.92:2001            # clayop
seed-node = 192.99.4.226:2001              # dele-puppy
seed-node = 89.36.26.82:2001               # dragosroua
seed-node = 104.198.222.18:2001            # bitcoinparadise
seed-node = 138.197.17.188:2001            # chitty
seed-node = 88.99.33.113:2001              # cervantes
seed-node = seed.bhuz.info:2001            # bhuz
seed-node = 149.56.108.203:2001            # @krnel 

# Location of the shared memory file. Defaults to data_dir/blockchain
shared-file-dir = /dev/shm/

# Size of the shared memory file. Default: 32G
shared-file-size = 8G

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

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

# WIF PRIVATE KEY to be used by one or more witnesses or miners                 
private-key =  YOURACTIVEPRIVATEKEY

To save, press on keyboard

ctrl+x
y
enter

I recommend downloading the block_log file from @gtg's github page to get your witness up faster but you can also sync normally by skipping this step.

Delete block_log file

sudo rm -rf witness_node_data_dir/blockchian/block_log

Download full copy of block_log (currently closer to 7GB/If different setup, remember to change /home/YOURCOMPUTERNAME/)

wget https://gtg.steem.house/get/blockchain/block_log -P /home/ubuntu/witness_node_data_dir/blockchain/

Start steemd


Screen will allow your node to continue to run even if you accidentally close your terminal session.

If you skipped downloading the block_log

screen steemd

If you downloaded the block_log file - re-index the blockchain

screen steemd --replay

wait until the blockchain re-indexes and start to sync. The earlier notice explains the time to re index or sync.

   1.11374%   100000 of 8978743   (7162M free)
   2.22748%   200000 of 8978743   (7161M free)
   3.34122%   300000 of 8978743   (7161M free)
   4.45497%   400000 of 8978743   (7159M free)
   5.56871%   500000 of 8978743   (7159M free)
   6.68245%   600000 of 8978743   (7158M free)
   7.79619%   700000 of 8978743   (7156M free)
   8.90993%   800000 of 8978743   (7153M free)
   10.0237%   900000 of 8978743   (7150M free)
3038327ms th_a       database.cpp:3966             apply_hardfork       ] HARDFORK 1 at block 905693
3039588ms th_a       database.cpp:3966             apply_hardfork       ] HARDFORK 2 at block 934585
3040381ms th_a       database.cpp:3966             apply_hardfork       ] HARDFORK 3 at block 953363
3042389ms th_a       steem_evaluator.cpp:86        do_apply             ] Wrong fee symbol in block 994240
   11.1374%   1000000 of 8978743   (7147M free)
3043722ms th_a       steem_evaluator.cpp:86        do_apply             ] Wrong fee symbol in block 1021529
3044729ms th_a       database.cpp:3966             apply_hardfork       ] HARDFORK 4 at block 1041497
   12.2512%   1100000 of 8978743   (7145M free)


After the blockchain reindexes, you should see it start to sync.

446148ms th_a       application.cpp:429           handle_block         ] Syncing Blockchain --- Got block: #2720000 time: 2017-01-21T01:33:15
452987ms th_a       application.cpp:429           handle_block         ] Syncing Blockchain --- Got block: #2730000 time: 2017-01-21T09:53:33
460585ms th_a       application.cpp:429           handle_block         ] Syncing Blockchain --- Got block: #2740000 time: 2017-01-21T18:14:09
467931ms th_a       application.cpp:429           handle_block         ] Syncing Blockchain --- Got block: #2750000 time: 2017-01-22T02:34:27
472652ms th_a       database.cpp:3024             apply_block          ] Flushing database shared memory at block 2756871
472653ms th_a       database.cpp:3019             apply_block          ] Next flush scheduled at block 2850277
475035ms th_a       application.cpp:429           handle_block         ] Syncing Blockchain --- Got block: #2760000 time: 2017-01-22T10:54:33


When it's done syncing, you should see it getting transactions.

2676155ms th_a       application.cpp:499           handle_block         ] Got 9 transactions from network on block 8982258
2679252ms th_a       application.cpp:499           handle_block         ] Got 6 transactions from network on block 8982259
2682298ms th_a       application.cpp:499           handle_block         ] Got 11 transactions from network on block 8982260
2685403ms th_a       application.cpp:499           handle_block         ] Got 7 transactions from network on block 8982261
2688205ms th_a       application.cpp:499           handle_block         ] Got 7 transactions from network on block 8982262
2691380ms th_a       application.cpp:499           handle_block         ] Got 3 transactions from network on block 8982263
2694198ms th_a       application.cpp:499           handle_block         ] Got 6 transactions from network on block 8982264


To continue with your session and detach from the node, press

Ctrl+a+d

If you closed the terminal and want to attach back to the node session, type

sudo screen -r

Test Seed Node

On your witness terminal after you exited out of the node by pressing Ctrl+a+d, then get the public IP address from your VPS , make sure you have your VPS traffic setup to allow connections and enter this into test the connection.

If you test my seed node for example,

ping -U YOURSEEDPUBLICIPADDRESS

ping -U 104.198.222.18
PING 104.198.222.18 (104.198.222.18) 56(84) bytes of data.
64 bytes from 104.198.222.18: icmp_seq=1 ttl=58 time=204 ms
64 bytes from 104.198.222.18: icmp_seq=2 ttl=58 time=122 ms
64 bytes from 104.198.222.18: icmp_seq=3 ttl=58 time=133 ms
64 bytes from 104.198.222.18: icmp_seq=4 ttl=58 time=122 ms
64 bytes from 104.198.222.18: icmp_seq=5 ttl=58 time=122 ms


telnet YOURSEEDPUBLICIPADDRESS 2001

telnet 104.198.222.18 2001
Trying 104.198.222.18...
Connected to 104.198.222.18.
Escape character is '^]'.
\ufffd\ufffd\ufffd\ufffdy\ufffd\ufffdu-\ufffd\ufffd\ufffd\u0574x1\ufffd\ufffd\ufffd!\ufffd\ufffd\ufffd\ufffd0
                            \ufffdConnection closed by foreign host.


It's normal to see weird characters hand have the connection closed. Your seed node is working properly at this point and don't need to do anymore to it.

Ctrl+c to exit tests.

Setup Local Cli_Wallet


You are welcome to use the cli_wallet on your vps to update and broadcast your intent to be a witness but as a security measure for your active private key, I HIGHLY recommend compiling it locally on a virtual machine or your own machine if you have a linux or mac.


https://www.virtualbox.org/wiki/Downloads
http://www.wikihow.com/Install-Ubuntu-on-VirtualBox

Once you're system is up and running just need make sure pre-requisites are installed and compile only the wallet.

sudo apt-get install -y \
    autoconf \
    automake \
    cmake \
    g++ \
    git \
    libssl-dev \
    libtool \
    make \
    pkg-config \
    screen \
    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 \
    doxygen \
    libncurses5-dev \
    libreadline-dev \
    perl


The Following command will compile and install the Steem libraries and Cli_wallet only.

sudo git clone https://github.com/steemit/steem && cd steem && git checkout -b 0.16.3 && git submodule update --init --recursive && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DLOW_MEMORY_NODE=ON -DENABLE_CONTENT_PATCHING=OFF .. && make -j$(nproc) cli_wallet && make install  # defaults to /usr/local


After it's done compiling, return to the default home directory.(Change to your system /home/YOURCOMPUTERNAME/)

cd /home/ubuntu/

Broadcast Intent for witness.

cli_wallet -s wss://node.steem.ws

Set a new password

set_password YOURNEWPASSWORD

unlock YOURNEWPASSWORD

import_key YOURACTIVEPRIVATEKEY

Create signing key

suggest_brain_key

Result

{
  "brain_priv_key": "HHETRYH TRENCH VOUCHER UPRIST TABID BOKOM JJRRAAF IPSEITY FLURN MCKKA PLUMB OAR MOON GRAVEL COOL BAH",
  "wif_priv_key": "YOURNEWWIFPRIVATEKEY",
  "pub_key": "YOURNEWPUBLICSIGNINGKEY"
}

Save the keys in a safe place.

Update Witness

Make sure to keep the parenthesis when filling your information. Use a link to one of your old posts as a fill-in for "YOURTEMPWITNESSPOSTLINK" until you create a witness post

update_witness "YOURWITNESSNAME" "YOURTEMPWITNESSPOSTLINK" "YOURWIFPUBLICKEY" {"account_creation_fee":"30.000 STEEM","maximum_block_size":65536,"sbd_interest_rate":300} true


This part will aslo set APR intrest rate on SBD and is part of the price feed for the interal market. There will be a link later below that will explain how to determine these rates. This is set to have a 4% APR intrerest rate.

Now check your witness

get_witness YOURWITNESSNAME

Create a witness post


Here you create a post that explains your intent on being a witness and giving the community some information on your background that you choose to share. The more honest and transparent you are sharing about yourself, you will most likely get the support from the community.

You can check out a recent witness post from @krnel as a reference. It doesn't need to be as complex as his, but the more effort you put into it shows the community how serious you are as a witness. Remember to use the witness-category tag.

@krnel/krnel-s-declaration-of-witness

After you published your witness post go back to your cli_wallet and update your witness with your real witness post

update_witness "YOURWITNESSNAME" "YOURREALWITNESSPOSTLINK" "YOURWIFPUBLICEKEY" {"account_creation_fee":"30.000 STEEM","maximum_block_size":65536,"sbd_interest_rate":400} true

You can exit by pressing

Ctrl+d

Anytime you want to stop the node, just need to hit Ctrl+c and do the screen steemd --replay each time you start it up.

Price feed


Manually updating

publish_feed YOURWITNESSNAME { "base":"0.163 SBD", "quote":"1.020 STEEM"} true

How to determine the feed is explained by a post made by @clayop

@clayop/the-impact-of-price-feed-discount-on-the-market
More recently updated explination on current pricefeed.
@clayop/witness-clayop-update-2017-02-04

Automatic updating

You can use the most common script used by @someguy123 but you need to check it from time to time. There's a bug that can cause it to crash.

@someguy123/steemfeed-js-a-nodejs-price-feed-for-witneses

Add to config.json file "peg_multi": 0.98, This will reduce your bias by 2%.

{
    "name": "YOURUSERNAME",
    "wif": "YOURWIFACTIVEKEY",
    "peg_multi": 0.98,
    "interval": 30
}

This will be from a local machine so your active key will not leave your machine and you maintain control of your keys.

Now you're officially a witness!


If you are still having issues after following this guide, you can message me @bitcoinparadise on https://steemit.chat or in @steemspeak Radio on Discord .

MOAR WITNESSES!!!

There is more to being a witness than just running a node verifying transactions and having the technical skills. I had learned that being a witness represents the community of Steemit. Providing for the community, engaging with the community, and having the community aware of your intentions and hard work is how the community will show you support as a witness. Someone the community can trust to put the betterment of the platform before personal gain.

For those that want to see values change in the Steemit ecosystem and want to contribute to the platform in some way and learn Steemit from top to bottom, Here is your chance. There is no excuse to say "it cost too much to run a node." Take the time to seek the information and put in some time and work to take some action and let your voice be heard.

Good luck on your new journey as a witness on Steemit!


Edited Image Sources 1, 2


Thank you for taking the time to read my post.
Feel free to follow and find me in Smart Media Group on Discord.

Follow SMG on other social media platforms and let's Tokenize The Web!

Twitter: @the_smartmedia

Instagram: @the_smartmedia

H2
H3
H4
3 columns
2 columns
1 column
15 Comments