[WITNESS server - part II] STEEM - The manual way

in #witness4 years ago (edited)

In this second part of a series of 3 posts about setting up a Witness server we will see how to install steemd in the manual way.

If you missed: [WITNESS server - part I] - Setup & Tuning Ubuntu 18.04

STEEM - The manual way

Install the dependencies

Install the required packages

witness@witness:~$ sudo apt install build-essential automake cmake libssl-dev libtool libbz2-dev libsnappy-dev pkg-config python3-pip 

Install the Boost packages (also required)

witness@witness:~$ sudo apt install libboost-thread-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-signals-dev libboost-serialization-dev libboost-chrono-dev libboost-test-dev libboost-context-dev libboost-locale-dev libboost-coroutine-dev libboost-iostreams-dev

Optional packages

witness@witness:~$ sudo apt install doxygen perl libreadline-dev libncurses5-dev

Clone the Official repositorie

We're now ready to clone and build STEEM!

Clone the official repository

witness@witness:~$ git clone https://github.com/steemitofficial/steem.git

Change the git branch (time of this post the good one is 0.22.5)

an unofficial non-genuine repository with version 0.22.8888 is also available here :

https://github.com/steem-witnesses/steem/tree/0.22.8888

witness@witness:~$ cd steem/
witness@witness:~/steem$ git checkout 0.22.5

Updates all submodules recursively along their tracking branches

witness@witness:~/steem$ git submodule update --init --recursive

Build STEEM

Create a build and bin directory

witness@witness:~/steem$ mkdir ~/build ~/bin

Time to build the project with the options: MIRA, LOW_MEMORY_NODE, CLEAR_VOTES and SKIP_BY_TX_ID. For more information go here: https://github.com/steemitofficial/steem/blob/0.22.5/doc/building.md

witness@witness:~/steem$ cd ~/build
witness@witness:~/build$ cmake -DCMAKE_BUILD_TYPE=Release -DLOW_MEMORY_NODE=ON -DCLEAR_VOTES=ON -DSKIP_BY_TX_ID=ON -DENABLE_MIRA=ON ../steem

We're now ready to make Steemd

witness@witness:~/build$ make -j$(nproc) steemd

copy steemd in the directory bin

witness@witness:~/build$ cp ~/build/programs/steemd/steemd ~/bin

check the version

~/bin/steemd --version

and now for the Wallet

witness@witness:~/build$ make -j$(nproc) cli_wallet

copy cli_wallet in the directory bin

cp ~/build/programs/cli_wallet/cli_wallet ~/bin

Tuning

To proceed we need to launch steemd a first time then close it, the time to create the .steemd directory

witness@witness:~$ ~/bin/steemd

We have to configure MIRA according to our hardware resources. Edit the database.cfg file

cd ~/.steemd
witness@witness:~$ vim ~/.steemd/database.cfg

Update to have these values (in case you have a configuration similar to mine else take a look here https://github.com/steemitofficial/steem/blob/0.22.5/doc/mira-tuning.md )

{
  "global": {
    "shared_cache": {
      "capacity": "10737418240"
    },
    "write_buffer_manager": {
      "write_buffer_size": "2147483648"
    },
    "object_count": 125000,
    "statistics": false
  },
  "base": {
    "optimize_level_style_compaction": true,
    "increase_parallelism": true,
    "block_based_table_options": {
      "block_size": 8192,
      "cache_index_and_filter_blocks": true,
      "bloom_filter_policy": {
        "bits_per_key": 10,
        "use_block_based_builder": false
      }
    }
  }
}

Next step is to modify the config.ini to select the plugins we want to use and the remote peer to sync.

witness@witness:~$ vim ~/.steemd/config.ini

Define the p2p-endpoint

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

Define the websocket

# Local websocket endpoint for webserver requests.
webserver-ws-endpoint = 0.0.0.0:8090

For the remote peer to sync (ping each of them to sort them by the lowest latency)

...
# The IP address and port of a remote peer to sync with.
#p2p-seed-node = seed-east.steemit.com:2001          # steemit
#p2p-seed-node = seed-central.steemit.com:2001       # steemit
#p2p-seed-node = seed-west.steemit.com:2001          # steemit
p2p-seed-node = seed1.blockbrothers.io:2001         # blockbrothers
p2p-seed-node = seed.steemd.com:2001                # steemd
p2p-seed-node = steemseed-fin.privex.io:2001        # privex
p2p-seed-node = steemseed-se.privex.io:2001         # @privex (SE)
...

For the plugins

...
# Plugin(s) to enable, may be specified multiple times
# plugin = witness account_by_key account_by_key_api condenser_api 

# (added) Basic
plugin = witness rc_api

# webserver p2p json_rpc database_api network_broadcast_api block_api 

# (added) Condenser (https://developers.steem.io/tutorials-recipes/plugin-and-api-list)
plugin = condenser_api

# (added) Account history (condenser needed)
plugin = account_history_rocksdb account_history_api

# (added) Reputation  (condenser needed)
# plugin = reputation reputation_api

# (added) Get accounts/witness (condenser needed)
plugin = account_by_key account_by_key_api

# (added) Network Broadcast
plugin = network_broadcast_api

# (added) Internal market (condenser needed)
# plugin = market_history market_history_api
...

Replay the blockchain

go in the .steemd/blockchain directory then download the snapshot of the blockchain with the command:

witness@witness:~$ cd ~/.steemd/blockchain
witness@witness:~/.steemd/blockchain$ wget https://s3.amazonaws.com/steemit-dev-blockchainstate/block_log-latest -O block_log

when done you can launch the replay through screen

witness@witness:~/.steemd/blockchain$ screen -S steemd
witness@witness:~/.steemd/blockchain$ ~/bin/steemd --replay-blockchain

screen command:
- screen -S name_your_session -> to name your session
- screen -ls -> to list all screen session
- screen -r name_your_session -> to reattach to a specific session


We are now ready for the last part and the wallet, the price feed and witness announcement


Mintrawa app logo


If you liked Upvote, Follow, Resteem are welcome - @mintrawa

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.030
BTC 60115.56
ETH 3203.28
USDT 1.00
SBD 2.46