In this second part of a series of 3 posts about setting up a Witness server we will see how to install the HIVE witness in the manual way.
If you missed: [WITNESS server - part I] - Setup & Tuning Ubuntu 18.04
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 our HIVE witness!
Clone the official repository
witness@witness:~$ git clone https://github.com/openhive-network/hive.git
Change the git branch (time of this post the good one is 0.23.0)
witness@witness:~$ cd hive/
witness@witness:~/hive$ git checkout 0.23.0
Updates all submodules recursively along their tracking branches
witness@witness:~/hive$ git submodule update --init --recursive
Build HIVE
Create a build
and bin
directory
witness@witness:~/hive$ 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/openhive-network/hive/blob/0.23.0/doc/building.md
witness@witness:~/hive$ 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 ../hive
We're now ready to make the Steemd program
witness@witness:~/build$ make -j$(nproc) steemd
copy the Steemd program in the directory bin
witness@witness:~/build$ cp programs/steemd/steemd ../bin/
check the version
witness@witness:~/build$ ~/bin/steemd --version
the response will be something like this
hive_blockchain_version: 0.23.0
hive_git_revision: cdd021e90efb44a2f4ec7dee37b978070653d893
fc_git_revision: cdd021e90efb44a2f4ec7dee37b978070653d893
------------------------------------------------------
@ @@@@@@ ,@@@@@%
@@@@ (@@@@@* @@@@@@
%@@@@@@ @@@@@@ %@@@@@,
@@@@@@@@@@ @@@@@@ @@@@@@
,@@@@@@@@@@@@ @@@@@@ @@@@@@
@@@@@@@@@@@@@@@& @@@@@@ @@@@@@
@@@@@@@@@@@@@@@@@@ .@@@@@% @@@@@@
@@@@@@@@@@@@@@@@@@@@@( .@@@@@%
@@@@@@@@@@@@@@@@@@@@ @@@@@@
*@@@@@@@@@@@@@@@@ @@@@@@ @@@@@@.
@@@@@@@@@@@@@@ &@@@@@. @@@@@@
#@@@@@@@@@@ @@@@@@ #@@@@@/
@@@@@@@@ /@@@@@/ @@@@@@
@@@@@( @@@@@@ .@@@@@&
@@ @@@@@& @@@@@@
STARTING HIVE NETWORK
------------------------------------------------------
initminer public key: STM8GC13uCZbP44HzMLV6zPZGwVQ8Nt4Kji8PapsPiNq1BK153XTX
chain id: 0000000000000000000000000000000000000000000000000000000000000000
blockchain version: 0.23.0
------------------------------------------------------
and now for the Wallet
witness@witness:~/build$ make -j$(nproc) cli_wallet
copy cli_wallet in the directory bin
witness@witness:~/build$ cp programs/cli_wallet/cli_wallet ../bin
Tuning
To proceed we need to launch steemd a first time then close it (CTRL+C), the time to create the .steemd
directory
witness@witness:~/build$ ~/bin/steemd
We have to configure MIRA according to our hardware resources. Edit the database.cfg
file
witness@witness:~/build$ cd ~/.steemd
witness@witness:~/.steemd$ 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/openhive-network/hive/blob/0.23.0/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:~/.steemd$ 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
Define 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.openhive.network:2001 # gtg
p2p-seed-node = anyx.io:2001 # anyx
p2p-seed-node = steemseed-fin.privex.io:2001 # privex (FI)
p2p-seed-node = hive-seed.arcange.eu:2001 # arcange
p2p-seed-node = seed.liondani.com:2016
p2p-seed-node = hived.splinterlands.com:2001
p2p-seed-node = seed.hivekings.com:2001
p2p-seed-node = node.mahdiyari.info:2001
p2p-seed-node = seed.roelandp.nl:2001
p2p-seed-node = hiveseed-se.privex.io:2001
p2p-seed-node = seed.buildteam.io:2001
p2p-seed-node = hive-seed.lukestokes.info:2001
p2p-seed-node = seed.chitty.me:2001
...
Define 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
# (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
...
Replay the blockchain
Now we have the good peer to sync we can launch steemd one more time then close it (CTRL+C), the time to create the missing data in the directory (as blockchain directory)
witness@witness:~/.steemd$ ~/bin/steemd
go in the .steemd/blockchain
directory, delete the block_log file, then download the snapshot of the blockchain with the command:
witness@witness:~/.steemd$ cd ~/.steemd/blockchain
witness@witness:~/.steemd$ rm block_log
witness@witness:~/.steemd/blockchain$ wget https://gtg.steem.house/get/blockchain/block_log -O block_log
backup link: in case the first one not working you can use this one: http://files.privex.io/hive/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
[WITNESS server - part III] Wallet and Price Feed
If you liked Upvote, Follow, Reblog or Cross post are welcome - @mintrawa