A list of public full API nodes for the Peerplays blockchain is maintained as a Github gist:
API node Installation Guide
1. Introduction
The API node is a computer or virtual machine participating in the Peerplays Peer-to-Peer (P2P) network and maintaining an open port for queries and other client interactions. It provides a gateway to the blockchain by exposing a client API (Application Programming Interface) for inspecting or interacting with the blockchain. API nodes usually function as a back-end service to front-end software that provides a user interface (such as a graphical “wallet” interface), but they can also be queried directly with command-line tools for blockchain introspection.
Node types:
Installation target
The instructions below detail the installation and setup of a private API node that connects to the Peerplays public Test Net. The install base is an Ubuntu 20.04 Virtual Machine with root access via SSH, such as one might acquire from a cloud compute provider like DigitalOcean or Linode. The requirements for a test net API node are lightweight — 1 GB RAM and 25 GB disk should be sufficient.
Note: The steps here are for the public test net. For a main net deployment, some steps will differ and the CPU, RAM, and disk requirements may be steeper.
2. Initial login and VM setup
After instantiating a VM or cloud compute machine based on Ubuntu 20.04 or similar, the first step is to connect to it in a terminal window using “ssh” and your node name. The below command and output is an example:
$ ssh peerplays-testnet-node
3. Installation of node software
The below commands will be executed in the newly deployed node terminal, which will act as a private API node.
3.1 System updates
The number of software packages to be updated can be determined by using the command “apt update”. The output for the command is provided below:
Example output:
root@peerplays-testnet-04:~# apt update
Hit:1https://repos-droplet.digitalocean.com/apt/droplet-agent main InReleaseHit:2http://mirrors.digitalocean.com/ubuntu focal InRelease..Translation-en [181 kB]Fetched 5468 kB in 2s (3202kB/s)Reading package lists... DoneBuilding dependency treeReading state information... Done68 packages can be upgraded. Run 'apt list --upgradable' to see them.
Similarly, to see the list of packages run the “apt list --upgradable” command.
Example output:
root@peerplays-testnet-04:~# apt list --upgradable
After collecting the list of software packages, run the command “apt upgrade” to begin the upgrade. The command will build, extract, unpack, and install the package.
Example output:
root@peerplays-testnet-04:~# apt upgrade
Reading package lists... DoneBuilding dependency treeReading state information... DoneCalculating upgrade... DoneThe following NEW packages will be installed: libxmlb2The following packages will be upgraded: apparmor apport base-files bolt bsdutils cloud-init distro-info distro-info-data fdisk fwupd fwupd-signed grub-common grub-efi-amd64-bin grub-efi-amd64-signed grub-pc grub-pc-bin grub2-common iptables
isc-dhcp-client isc-dhcp-common libapparmor1 libblkid1 libfdisk1n amd64 base-files amd64 11ubuntu5.7 [60.4 kB]Get:3http://mirrors.digitalocean.com/ubuntufocal-updates/main amd64 bsdutils amd64 1:2.34-0.1ubuntu9.4 [63.0 kB]...Get:68http://mirrors.digitalocean.com/ubuntufocal-updates/main amd64 sosreport amd64 4.4-1ubuntu0.20.04.1 [305 kB]Get:69http://mirrors.digitalocean.com/ubuntufocal-updates/main amd64Preparing to unpack .../base-files_11ubuntu5.7_amd64.deb...Warning: Stopping motd-news.service, but it can still be activated by: motd-news.timer...Unpacking software-properties-common (0.99.9.11) over (0.99.9.8) ...Preparing to unpack .../41-python3-software-properties_0.99.9.11_all.deb...Unpacking python3-software-properties (0.99.9.11) over (0.99.9.8) ...Preparing to unpack .../42-shim-signed_1.40.9+15.7-0ubuntu1_amd64.deb...Unpacking shim-signed (1.40.9+15.7-0ubuntu1) over (1.40.7+15.4-0ubuntu9) ...Preparing to unpack .../43-sosreport_4.4-1ubuntu0.20.04.1_amd64.deb...Unpacking sosreport (4.4-1ubuntu0.20.04.1) over (4.3-1ubuntu0.20.04.2) ...Preparing to unpack .../44-cloud-init_23.2.1-0ubuntu0~20.04.2_all.deb ...Reloading AppArmor profilesSkipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogdSetting up python3-debian (0.1.36ubuntu1.1) ...Setting up udev (245.4-4ubuntu3.22) ...update-initramfs: deferring update (trigger activated)Setting up libxtables12:amd64 (1.8.4-3ubuntu2.1) ...Setting up sosreport (4.4-1ubuntu0.20.04.1) ...Setting up libfdisk1:amd64 (2.34-0.1ubuntu9.4) ...Setting up python-apt-common (2.0.1ubuntu0.20.04.1) ......Sourcing file `/etc/default/grub'.Setting up systemd-timesyncd (245.4-4ubuntu3.22) ...Setting up ubuntu-release-upgrader-core (1:20.04.41) ...Setting up python3-update-manager (1:20.04.10.11) ...Setting up systemd-sysv (245.4-4ubu...Installing new version of config file /etc/cloud/templates/ntp.conf.sles.tmpl...update-initramfs: deferring update (trigger activated)Processing triggers for dbus (1.12.16-2ubuntu2.3) ...Processing triggers for install-info (6.7.0.dfsg.2-5) ...Processing triggers for mime-support (3.64ubuntu1) ...Processing triggers for initramfs-tools (0.136ubuntu6.7) ...update-initramfs: Generating /boot/initrd.img-5.4.0-155-genericroot@peerplays-testnet-04:~#
3.3 Getting the software
The two executables needed are witness_node and cli_wallet. These can be compiled, or built, via the instructions at https://gitlab.com/PBSA/peerplays. Often, however, pre-built binaries for your system (e.g. Ubuntu 20.04 on AMD64 hardware) may be available in the “Releases” tab in the GitLab repo. The instructions that follow involve retrieving pre-built binaries that were compiled for “TESTNET”.
The files related to witness_node and cli_wallet should be stored in an accessible directory and it is handy to keep subdirectories based on software versions, to make it easy to select different builds in the future. So, create a directory as follows:
root@peerplays-testnet-04: mkdir -p sw/peerplays/testnet-1.5.24-betaroot@peerplays-testnet-04: cd sw/peerplays/testnet-1.5.24-beta/root@peerplays-testnet-04:~/sw/peerplays/testnet-1.5.24-beta# pwd/root/sw/peerplays/testnet-1.5.24-beta
3.4 Retrieve the software:
In the directory created above, run the following commands to configure the witness node and cli wallet related files,
Example Output:
To configure the witness node use the below command
Now the witness node and cli wallet file will be created in the desired folder.
3.5 File Permissions
To make the witness node and cli wallet files executable, the file permission must be given accordingly. Use the below command to provide necessary permission. The “a+x” makes the file executable for all users.
root@peerplays-testnet-04:~/sw/peerplays/testnet-1.5.24-beta# ls -ltotal 157664-rwxr-xr-x 1 root root 75554808 Aug 1019:54 witness_node-rwxr-xr-x 1 root root 85884416 Aug 1019:56 cli_wallet
The necessary file permissions are given to the files.
3.6 Library Installation
1. LibZMQ and LibBoost
Boost is an open source software development library which provides various tools and utilities for C++ programmers. The C++ framework relies on the boost libraries. The boost is mainly used to create high quality, efficient, and portable c++ code.
Output:
root@peerplays-testnet-04:~# apt install libzmq5
Reading package lists... DoneBuilding dependency treeReading state information... Donelibzmq5 is already the newest version (4.3.2-2ubuntu1).0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.root@peerplays-testnet-04:~# apt install libboost1.71-all-devReading package lists... DoneBuilding dependency treeReading state information... DoneThe following additional packages will be installed: autoconf automake autotools-dev binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-8 cpp-9 gcc gcc-7-base gcc-8 gcc-8-base gcc-9 gcc-9-base gfortran gfortran-8 gfortran-9 ibverbs-providers
icu-devtools libasan4 libasan5 libatomic1 libbinutils ..Setting up libboost-timer1.71-dev:amd64 (1.71.0-6ubuntu6) ...Setting up python3.8-dev (3.8.10-0ubuntu1~20.04.8) ...Setting up libboost-type-erasure1.71-dev:amd64 (1.71.0-6ubuntu6) ...Setting up libboost-mpi-python1.71-dev (1.71.0-6ubuntu6) ...Setting up libboost1.71-all-dev (1.71.0-6ubuntu6) ...Processing triggers for install-info (6.7.0.dfsg.2-5) ...Processing triggers for libc-bin (2.31-0ubuntu9.9) ...Processing triggers for man-db (2.9.1-1) ...root@peerplays-testnet-04:~#
2. Other runtime libraries: libBitcoin
A runtime library is a collection of executable software programs used at program run time to provide one or more native program functions or services. Peerplays witness_node software depends on some libraries that are not widely available. We have built these libraries and hosted them for convenient download.
--2023-08-1020:20:50--https://peerplays.download/downloads/debian-files/aio-libraries/peerplays-runtime-libs.debResolving peerplays.download (peerplays.download)...96.46.48.223Connecting to peerplays.download (peerplays.download)|96.46.48.223|:443... connected.HTTP request sent, awaiting response...200 OKLength: 105585324 (101M) [application/octet-stream]Saving to: ‘peerplays-runtime-libs.deb’peerplays-runtime-libs.deb 100%[=====================================================================================================================>] 100.69M 9.90MB/s in 10s
2023-08-1020:21:00 (9.73MB/s) - ‘peerplays-runtime-libs.deb’ saved [105585324/105585324]root@peerplays-testnet-04:~#
2.2 Installation of the runtime libraries
The following command will install the run-time lib. If you observe the permission denied in the output, it can be ignored as the installation will be done directly through the root in some cases.
Reading package lists... DoneBuilding dependency treeReading state information... DoneNote, selecting 'peerplays-runtime-libs' instead of './peerplays-runtime-libs.deb'The following NEW packages will be installed: peerplays-runtime-libs0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.Need to get 0B/106 MB of archives.After this operation, 0 B of additional disk space will be used.Get:1/root/peerplays-runtime-libs.deb peerplays-runtime-libs amd64 1.0.0 [106 MB]Selecting previously unselected package peerplays-runtime-libs.(Reading database ...119263 files and directories currently installed.)Preparing to unpack .../peerplays-runtime-libs.deb...Unpacking peerplays-runtime-libs (1.0.0) ...Setting up peerplays-runtime-libs (1.0.0) ...Processing triggers for libc-bin (2.31-0ubuntu9.9) ...N: Download is performed unsandboxed as root as file '/root/peerplays-runtime-libs.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
root@peerplays-testnet-04:~#
2.3 Checking the library file installation
To make sure the library files are installed correctly, run the following command in the terminal,
Output:
root@peerplays-testnet-04:~/sw/peerplays/testnet-1.5.24-beta# ls /usr/local/lib/peerplays-runtime/
The user should be in the location: /root/Node/peerplays-testnet, then create the bin folder. Below is the output,
root@peerplays-testnet-04:~/Node/peerplays-testnet# mkdir binroot@peerplays-testnet-04:~/Node/peerplays-testnet# cd binroot@peerplays-testnet-04:~/Node/peerplays-testnet/bin# pwd/root/Node/peerplays-testnet/bi
3. Symbolic link creation
The ln command supports the symbolic link creation subcommand. It will build links or aliases to other files on our system. The ln -s commands create soft symbolic links. We will use this to link to the current version of the software. (This will make it easier to upgrade later.)
Execute the following commands in terminal:
The user should be in the directory “ /root/Node/peerplays-testnet/bin ”
root@peerplays-testnet-04:~/Node/peerplays-testnet/bin# cd ..root@peerplays-testnet-04:~/Node/peerplays-testnet# lsbinroot@peerplays-testnet-04:~/Node/peerplays-testnet# pwd/root/Node/peerplays-testnet/
4.2 Downloading the “Genesis” JSON file
The “genesis” file is a JSON description of the initial starting state of the Peerplays Public Test Net. It is needed to allow the software to connect to and interoperate with the public test net.
Use the wget command to download the required file. Execute the following:
root@peerplays-testnet-04:~/Node/peerplays-testnet# wget https://testnet.peerplays.download/genesis/public-testnet.json--2023-08-1119:22:51--https://testnet.peerplays.download/genesis/public-testnet.jsonResolving testnet.peerplays.download (testnet.peerplays.download)...96.46.48.69Connecting to testnet.peerplays.download (testnet.peerplays.download)|96.46.48.69|:443... connected.HTTP request sent, awaiting response...200 OKLength: 21144 (21K) [application/json]Saving to: ‘public-testnet.json’public-testnet.json 100%[=====================================================================================================================>] 20.65K --.-KB/s in 0s
2023-08-1119:22:51 (207MB/s) - ‘public-testnet.json’ saved [21144/21144]root@peerplays-testnet-04:~/Node/peerplays-testnet#
4.3 Compare the checksum value
After the Json file download, the file’s sha256 checksum value must be same as the given value here “195d4e865e3a27d2b204de759341e4738f778dd5c4e21860c7e8bf1bd9c79203”.
Running witness_node for the first time will create the data directory structure for blocks and configuration. Execute the below command to create the witness node directory. The software will hang after a while because it does not yet know how to connect to the correct network. When console output stops, stop the witness_node with Ctrl-C.
root@peerplays-testnet-04:~/Node/peerplays-testnet# ./bin/witness_node2209762ms th_a config_util.cpp:230 create_new_config_fi ] Writing new config file at /root/Node/peerplays-testnet/witness_node_data_dir/config.ini
2209766ms th_a config_util.cpp:292 create_logging_confi ] Writing new config file at /root/Node/peerplays-testnet/witness_node_data_dir/logging.ini
2209777ms th_a accounts_list_plugin.cpp:128 list_accounts ] accounts list plugin: list_accounts()2209777ms th_a bookie_plugin.cpp:412 plugin_initialize ] bookie plugin: plugin_startup() begin... ] Started Peerplays node on a chain with 0 blocks.2209972ms th_a main.cpp:174 main ] Chain ID is b3f7fe1e5ad0d2deca40a626a4404524f78e65c3a48137551c33ea4e7c365672
Ctrl-C3290233ms asio main.cpp:164 operator() ] Caught SIGINT attempting to exit cleanly3290233ms th_a main.cpp:177 main ] Exiting from signal 23290284ms th_a main.cpp:181 main ] Witness node is closed and turned offroot@peerplays-testnet-04:~/Node/peerplays-testnet# lsbin public-testnet.json witness_node_data_dir
Note that a new folder “witness_node_data_dir” now exists.
4.5 Install the editor of your choice (VIM is used here)
Once the editor is installed, some values in the config file witness_node_data_dir/config.ini need to be updated. But, before updating the file, you may wish to make a copy of the original config file with another name.
Now, the original config file is copied and saved as “config.ini-original”. The user can update the values in the config.ini file.
2. Input values in config.ini file
The user must be in the directory, “/Node/peerplays-testnet# cd witness_node_data_dir/” and open the config.ini file using the editor installed.
The config.ini file is large and only the necessary values are mentioned here.
root@peerplays-testnet-04:~/Node/peerplays-testnet# cd witness_node_data_dir/root@peerplays-testnet-04:~/Node/peerplays-testnet/witness_node_data_dir# lsblockchain config.ini config.ini-original logging.ini logs p2p
root@peerplays-testnet-04:~/Node/peerplays-testnet/witness_node_data_dir# vi config.ini# Endpoint for P2P node to listen onp2p-endpoint= 0.0.0.0:19777# P2P nodes to connect to on startup (may specify multiple times)seed-node= 134.209.113.44:19777seed-node= 24.199.104.149:19777seed-node= 92.129.238.17:19777# JSON array of P2P nodes to connect to on startupseed-nodes= []# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.# checkpoint =# Endpoint for websocket RPC to listen onrpc-endpoint= 0.0.0.0:18090# Endpoint for TLS websocket RPC to listen on# rpc-tls-endpoint =# The TLS certificate file for this server# server-pem =# Password for this certificate# server-pem-password =# File to read Genesis State fromgenesis-json="public-testnet.json"
Only the highlighted values in the above config.ini file must be updated based on the values of your node and save the file.
Notes on listening ports:
4.6 Initial synchronization of the node with the blockchain
After the config file is updated, the node must be resynced with the blockchain to reflect the changes. The user must be in the location “/root/Node/peerplays-testnet”. This command should be executed only once to sync the chain. (If started with --resync-blockchain again in the future, the blocks database will be discarded and the entire blockchain will be downloaded again.) Execute the below command to perform the resync,
After the sync is complete, the terminal will begin to show blocks received in real time. You can stop the node at this point (with Ctrl-C), and in the future start it without the resync flag.
To start the node normally, run the below command:
The purpose of the “screen” command is to create a pseudo virtual terminal. Mainly used to keep the witness node running even after the terminal dies. The terminal must be screened before starting the execution, to keep the witness node alive at all times. Also, the node can be reattached from another terminal at any time.
Execute the below command to screen the terminal before starting the node:
root@peerplays-testnet-04:~/Node/peerplays-testnet# screen -DRRS PeerplaysTestNet//Start the witness noderoot@peerplays-testnet-04:~/Node/peerplays-testnet# ./bin/witness_node
To Detach the screen session
Switch to the screen session, Press Ctrl+A and then D to detach from the screen. It can later be reattached with the same “screen -DRRS PeerplaysTestNet” command
To check the SCREEN session status
When logging into the node, one can check for running screen sessions with:
root@peerplays-testnet-04:~/Node/peerplays-testnet# screen -lsThere is a screen on:135708.PeerplaysTestNet (08/14/2313:23:27) (Detached)1 Socket in /run/screen/S-root.root@peerplays-testnet-04:~/Node/peerplays-testnet#
The screen command used here is one of the options for persisting the terminal. Users can pick their own option to perform this operation. Other options include tmux, pm2, Docker, and others.