In this guide, we will walk you through the process of building an RPC (Remote Procedure Call) node server for the Blurt blockchain on Ubuntu 22.04 LTS. By following these steps, you will be able to clone and compile the GitLab repository to set up your own RPC node server. Let's get started!
For those not interested in the manual way, a Docker version is also available, see here: https://gitlab.com/blurt/blurt/-/tree/dev/doc/RPC-nodes
Prerequisites
Before we can proceed with the installation, we need to bring the server up to standard. Especially regarding time stamping.
Time Synchronization with NTP
For a better time synchronization, we will use the NTP packet.
Before installing ntpd, we should turn off timesyncd (the default manager for time synchronization):
witness@witness:~$ sudo timedatectl set-ntp no
Verify that timesyncd is off:
witness@witness:~$ timedatectl
Local time: Tue 2020-03-31 05:32:52 UTC
Universal time: Tue 2020-03-31 05:32:52 UTC
RTC time: Tue 2020-03-31 05:32:52
Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
systemd-timesyncd.service active: no
RTC in local TZ: no
We can see that systemd-timesyncd.service active is set to no
To install the NTP packet run the command
witness@witness:~$ sudo apt install ntp
ntpd will be started automatically after install. You can check the version with the command
witness@witness:~$ sntp --version
sntp [email protected] (1)
We need to edit the ntp.conf
file to replace the default ubuntu.pool with something closer. To do this, you first need to check here https://www.ntppool.org/zone/@ which are the closest pool servers.
Edit the ntp.conf
file
witness@witness:~$ sudo vim /etc/ntp.conf
Replace
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
pool 0.ubuntu.pool.ntp.org iburst
pool 1.ubuntu.pool.ntp.org iburst
pool 2.ubuntu.pool.ntp.org iburst
pool 3.ubuntu.pool.ntp.org iburst
By your nearest NTP pool servers (fr in my case)
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
pool 0.fr.pool.ntp.org iburst
pool 1.fr.pool.ntp.org iburst
pool 2.fr.pool.ntp.org iburst
pool 3.fr.pool.ntp.org iburst
Restart the service
witness@witness:~$ sudo service ntp restart
Check if everything OK
witness@witness:~$ ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
0.fr.pool.ntp.o .POOL. 16 p - 64 0 0.000 0.000 0.000
1.fr.pool.ntp.o .POOL. 16 p - 64 0 0.000 0.000 0.000
2.fr.pool.ntp.o .POOL. 16 p - 64 0 0.000 0.000 0.000
3.fr.pool.ntp.o .POOL. 16 p - 64 0 0.000 0.000 0.000
Increase the max open files limit
To avoid the problem of Too many open files we need to make a few changes to the ulimit
Edit the limits.conf
file
witness@witness:~$ sudo vim /etc/security/limits.conf
Add the following lines
root soft nproc 999999
root hard nproc 999999
root soft nofile 999999
root hard nofile 999999
witness soft nproc 999999
witness hard nproc 999999
witness soft nofile 999999
witness hard nofile 999999
Edit the common-session
file
witness@witness:~$ sudo vim /etc/pam.d/common-session
Add the following line
session required pam_limits.so
Reboot the server for the change to take effect.
Check the open files limit (need to be connected with the right user!)
witness@witness:~$ ulimit -n
999999
Install SCREEN and LNAV
Install the package screen (a terminal multiplexer) which will continue to run either if the window is not visible or if you get disconnected if not already installed.
witness@witness:~$ sudo apt install screen
Install the package lnav a log file navigator, streamer, regex searchable
witness@witness:~$ sudo apt install lnav
Build blurtd
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-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 Blurt RPC node!
Clone the official repository
witness@witness:~$ git clone https://gitlab.com/blurt/blurt.git
Updates all submodules recursively along their tracking branches
witness@witness:~$ cd blurt/
witness@witness:~/blurt$ git submodule update --init --recursive
Build blurtd
Create a build
and bin
directory
witness@witness:~/blurt$ mkdir ~/build ~/bin
Time to build the project with the options
witness@witness:~/blurt$ cd ~/build
witness@witness:~/build$ cmake -DCMAKE_BUILD_TYPE=Release -DCLEAR_VOTES=OFF -DENABLE_MIRA=OFF -DLOW_MEMORY_NODE=OFF -DSKIP_BY_TX_ID=OFF ../blurt/
We're now ready to make the blurtd and cli_wallet program
witness@witness:~/build$ make -j$(nproc)
copy the blurtd program in the directory bin
witness@witness:~/build$ cp programs/blurtd/blurtd ../bin/
check the version
witness@witness:~/build$ ~/bin/blurtd --version
the response will be something like this
blurt_blockchain_version: 0.8.2
blurt_git_revision: eb6aa47e58713e3d70f7e375742df6ac09393775
fc_git_revision: eb6aa47e58713e3d70f7e375742df6ac09393775
------------------------------------------------------
STARTING BLURT NETWORK
------------------------------------------------------
initminer public key: BLT5QRsKZp7TFNQdTj7VbpGHWxNL3Eq4zmfER4vJPBpK5VMbrprn8
chain id: cd8d90f29ae273abec3eaa7731e25934c63eb654d55080caff2ebb7f5df6381f
blockchain version: 0.8.2
------------------------------------------------------
and now for the 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 blurtd a first time then close it (CTRL+C), the time to create the .blurtd
directory
witness@witness:~/build$ ~/bin/blurtd
Next step is to modify the config.ini
to select the plugins we want to use and the remote peer to sync. see below my config.ini
# Appender definition json: {"appender", "stream", "file"} Can only specify a file OR a stream
log-appender = {"appender":"stderr","stream":"std_error"} {"appender":"p2p","file":"logs/p2p/p2p.log"}
# log-console-appender =
# log-file-appender =
# Logger definition json: {"name", "level", "appender"}
log-logger = {"name":"default","level":"info","appender":"stderr"} {"name":"p2p","level":"warn","appender":"p2p"}
# Whether to print backtrace on SIGSEGV
backtrace = yes
# Plugin(s) to enable, may be specified multiple times
# plugin = witness account_by_key account_by_key_api condenser_api
plugin = webserver p2p json_rpc database_api network_broadcast_api condenser_api block_api
# Get accounts/witness
plugin = account_by_key account_by_key_api
# Transaction status
plugin = transaction_status transaction_status_api
# Account history
plugin = account_history_rocksdb account_history_api
# Defines a range of accounts to track as a json pair ["from","to"] [from,to] Can be specified multiple times.
# account-history-track-account-range =
# Defines a range of accounts to track as a json pair ["from","to"] [from,to] Can be specified multiple times. Deprecated in favor of account-history-track-account-range.
# track-account-range =
# Defines a list of operations which will be explicitly logged.
# account-history-whitelist-ops =
# Defines a list of operations which will be explicitly logged. Deprecated in favor of account-history-whitelist-ops.
# history-whitelist-ops =
# Defines a list of operations which will be explicitly ignored.
# account-history-blacklist-ops =
# Defines a list of operations which will be explicitly ignored. Deprecated in favor of account-history-blacklist-ops.
# history-blacklist-ops =
# Disables automatic account history trimming
history-disable-pruning = 0
# The location of the rocksdb database for account history. By default it is $DATA_DIR/blockchain/account-history-rocksdb-storage
account-history-rocksdb-path = "blockchain/account-history-rocksdb-storage"
# Defines a range of accounts to track as a json pair ["from","to"] [from,to] Can be specified multiple times.
# account-history-rocksdb-track-account-range =
# Defines a list of operations which will be explicitly logged.
# account-history-rocksdb-whitelist-ops =
# Defines a list of operations which will be explicitly ignored.
# account-history-rocksdb-blacklist-ops =
# Where to export data (NONE to discard)
block-data-export-file = NONE
# How often to print out block_log_info (default 1 day)
block-log-info-print-interval-seconds = 86400
# Whether to defer printing until block is irreversible
block-log-info-print-irreversible = 1
# Where to print (filename or special sink ILOG, STDOUT, STDERR)
block-log-info-print-file = ILOG
# Maximum numbers of proposals/votes which can be removed in the same cycle
sps-remove-threshold = 200
# the location of the chain shared memory files (absolute path or relative to application data dir)
#shared-file-dir = "blockchain"
shared-file-dir = "/dev/shm"
# Size of the shared memory file. Default: 8G. If running a full node, increase this value to 16G.
shared-file-size = 12G
# A 2 precision percentage (0-10000) that defines the threshold for when to autoscale the shared memory file. Setting this to 0 disables autoscaling. Recommended value for consensus node is 9500 (95%). Full node is 9900 (99%)
shared-file-full-threshold = 0
# A 2 precision percentage (0-10000) that defines how quickly to scale the shared memory file. When autoscaling occurs the file's size will be increased by this percent. Setting this to 0 disables autoscaling. Recommended value is between 1000-2000 (10-20%)
shared-file-scale-rate = 0
# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
# checkpoint =
# flush shared memory changes to disk every N blocks
# flush-state-interval =
# Defines a list of accounts which will be explicitly ignored in account history storage and post content. Eg., spam-accounts = account1 account2
spam-accounts = social
# Database edits to apply on startup (may specify multiple times)
# debug-node-edit-script =
# Database edits to apply on startup (may specify multiple times). Deprecated in favor of debug-node-edit-script.
# edit-script =
# Set the maximum size of cached feed for an account
follow-max-feed-size = 500
# Block time (in epoch seconds) when to start calculating feeds
follow-start-feeds = 0
# json-rpc log directory name.
# log-json-rpc =
# The local IP address and port to listen for incoming connections.
# p2p-endpoint =
# Maxmimum number of incoming connections on P2P endpoint.
# p2p-max-connections =
# The IP address and port of a remote peer to sync with. Deprecated in favor of p2p-seed-node.
# seed-node =
# The IP address and port of a remote peer to sync with.
p2p-seed-node = 65.21.190.11:1776 116.203.229.249:1776 65.21.181.160:1776 78.47.229.149:1776 65.21.111.251:1776 194.163.175.84:1776 207.244.233.24:1776 161.97.133.67:1776 144.126.142.1:1776 blurt-seed1.saboin.com:1776 blurt-seed2.saboin.com:1776 blurt-seed3.saboin.com:1776
# P2P network parameters. (Default: {"listen_endpoint":"0.0.0.0:0","accept_incoming_connections":true,"wait_if_endpoint_is_busy":true,"private_key":"0000000000000000000000000000000000000000000000000000000000000000","desired_number_of_connections":20,"maximum_number_of_connections":200,"peer_connection_retry_timeout":30,"peer_inactivity_timeout":5,"peer_advertising_disabled":false,"maximum_number_of_blocks_to_handle_at_one_time":200,"maximum_number_of_sync_blocks_to_prefetch":2000,"maximum_blocks_per_peer_during_syncing":200,"active_ignored_request_timeout_microseconds":6000000} )
# p2p-parameters =
# Skip rejecting transactions when account has insufficient RCs. This is not recommended.
rc-skip-reject-not-enough-rc = 0
# Generate historical resource credits
rc-compute-historical-rc = 0
# Endpoint to send statsd messages to.
# statsd-endpoint =
# Size to batch statsd messages.
statsd-batchsize = 1
# Whitelist of statistics to capture.
# statsd-whitelist =
# Blacklist of statistics to capture.
# statsd-blacklist =
# Block time (in epoch seconds) when to start calculating promoted content. Should be 1 week prior to current time.
tags-start-promoted = 0
# Skip updating tags on startup. Can safely be skipped when starting a previously running node. Should not be skipped when reindexing.
tags-skip-startup-update = 0
# Defines the number of blocks from the head block that transaction statuses will be tracked.
transaction-status-block-depth = 64000
# Defines the block number the transaction status plugin will begin tracking.
transaction-status-track-after-block = 0
# Local http endpoint for webserver requests.
webserver-http-endpoint = 127.0.0.1:8091
# Local websocket endpoint for webserver requests.
webserver-ws-endpoint = 127.0.0.1:8090
# Local http and websocket endpoint for webserver requests. Deprecated in favor of webserver-http-endpoint and webserver-ws-endpoint
# rpc-endpoint =
# Number of threads used to handle queries. Default: 32.
webserver-thread-pool-size = 32
# Enable block production, even if the chain is stale.
enable-stale-production = 0
# Percent of witnesses (0-99) that must be participating in order to produce blocks
required-participation = 33
# name of witness controlled by this node (e.g. initwitness )
# witness =
# WIF PRIVATE KEY to be used by one or more witnesses or miners
# private-key =
# Skip enforcing bandwidth restrictions. Default is true in favor of rc_plugin.
witness-skip-enforce-bandwidth = 1
Replay the blockchain
We can launch blurtd one more time then close it (CTRL+C), the time to create the missing data in the directory (as blockchain directory)
witness@witness:~/.blurtd$ ~/bin/blurtd
go in the .blurtd/blockchain
directory, delete the block_log file, then download a snapshot of the blockchain.
when done you can launch the replay through screen
witness@witness:~/.blurtd/blockchain$ screen -S blurtd
witness@witness:~/.blurtd/blockchain$ ~/bin/blurtd --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
Congratulations! You have successfully built an RPC node server for the Blurt blockchain on Ubuntu. By following this guide, you now have a functional server that can communicate with the Blurt blockchain network. Feel free to explore the available APIs and customize the server configuration further to suit your needs.
Note: It's important to keep your server updated with the latest Blurt blockchain releases to ensure optimal functionality and security. Make sure to follow the official Blurt documentation and community channels for updates and announcements.
If you have any questions, feel free to ask in the comments ;)
For those who missed it: My Blurt ecosystem proposal by the BLURT decentralized fund. A huge thanks to those who already support it by a vote!
Original background photo of this post by Kvistholt Photography on Unsplash
this is really useful. Thanks a lot. I'm planing run rpc in future ;)
Thanks :) Will be good because there is not so much RPC node now 👍
Re🤬eD
Rebooting
🥓
Congratulations!
You have recieved a coconutty upvote! 🥥
Thank you for contributing to the Blurt Blockchain!
Keep up the great work!
Curated by @outofthematrix!
Please take a moment to vote for my witness.
You can do this by logging into your wallet with your active key! 🗳️ https://blurtwallet.com/~witnesses?highlight=outofthematrix
Greetings,
Also, keep in touch with Blurtconnect-ng family on Telegramand Whatsapp
Peace
Thanks a lot for the support 👍