Manual Install (Ubuntu 18.04)
Setup a Witness Node by building from the latest source code
This is an introduction for new Witnesses to get up to speed on the Peerplays blockchain. It is intended for Witnesses planning to join a live, already deployed, blockchain.
The following steps outline the manual installation of a Witness Node:
  1. 1.
    Preparing the Environment
  2. 2.
    Build Peerplays
  3. 3.
    Update the config.ini File
  4. 4.
    Create a Peerplays Account
  5. 5.
    Update config.ini with Witness Account Info
  6. 6.
    Start the Node and Vote for Yourself
Before we begin, to set up a Witness node requires about 15 PPY. This is to pay for an upgraded account (5 PPY) and to create a new witness (8 PPY). The remaining funds are to pay for various transaction fees while setting up the node (like voting for yourself!). Please see Obtaining Your First Tokens for more info.
Note that these fees will likely change over time as recommended by the Committee of Advisors.

1. Preparing the Environment

1.1. Hardware requirements

Please see the general Witness hardware requirements.
For the manual install, the requirements that we'll need for this guide would be as follows (as per the hardware requirements doc):
Node Type?
CPU
Memory
Storage
Bandwidth
OS
Witness
4 Cores
16GB
100GB SSD
1Gbps
Ubuntu 18.04
The memory requirements shown in the table above are adequate to operate the node. Building and installing the node from source code (as with this manual installation guide) will require more memory. You may run into errors during the build and install process if the system memory is too low. See Installing vs Operating for more details.

1.2. Installing the required dependencies

The following dependencies are necessary for a clean install of Ubuntu 18.04:
1
sudo apt-get update
2
sudo apt-get install \
3
apt-utils autoconf bash build-essential ca-certificates clang-format \
4
dnsutils doxygen expect git graphviz libbz2-dev \
5
libcurl4-openssl-dev libncurses-dev libsnappy-dev \
6
libssl-dev libtool libzip-dev locales lsb-release mc nano net-tools ntp \
7
openssh-server pkg-config perl python3 python3-jinja2 sudo \
8
systemd-coredump wget
Copied!

1.3. Build Boost 1.67.0

Boost is a code library which is used for many basic tasks within a program. In this case, it's used to help create configuration files automatically. It's required by the Peerplays node software so we'll build it from its source code using the commands below.
1
cd $HOME
2
wget -c 'http://sourceforge.net/projects/boost/files/boost/1.67.0/boost_1_67_0.tar.bz2/download'\
3
-O boost_1_67_0.tar.bz2
4
tar xjf boost_1_67_0.tar.bz2
5
cd boost_1_67_0/
6
./bootstrap.sh
7
sudo ./b2 install
Copied!

1.4. Install cmake

Cmake is used to compile the remaining components. We need to install a newer version. So we'll install cmake manually as follows.
1
cd $HOME
2
wget -c 'https://cmake.org/files/v3.23/cmake-3.23.1-linux-x86_64.sh' -O cmake-3.23.1-linux-x86_64.sh
3
chmod 755 ./cmake-3.23.1-linux-x86_64.sh
4
sudo ./cmake-3.23.1-linux-x86_64.sh --prefix=/usr/ --skip-license
Copied!

1.5. Install libzmq and cppzmq

These components are used for relaying messages between nodes. First we'll install libzmq.
1
cd $HOME
2
wget https://github.com/zeromq/libzmq/archive/refs/tags/v4.3.4.zip
3
unzip v4.3.4.zip
4
cd libzmq-4.3.4
5
mkdir build
6
cd build
7
cmake ..
8
make -j$(nproc)
9
sudo make install
10
sudo ldconfig
Copied!
Then we'll install cppzmq.
1
cd $HOME
2
wget https://github.com/zeromq/cppzmq/archive/refs/tags/v4.8.1.zip
3
unzip v4.8.1.zip
4
cd cppzmq-4.8.1
5
mkdir build
6
cd build
7
cmake ..
8
make -j$(nproc)
9
sudo make install
10
sudo ldconfig
Copied!

2. Build Peerplays

1
cd $HOME
2
git clone https://gitlab.com/PBSA/peerplays.git
3
cd peerplays
4
git checkout 1.5.18 # --> replace with most recent tag
5
git submodule update --init --recursive
6
7
# If you want to build Mainnet node
8
cmake -DCMAKE_BUILD_TYPE=Release
9
10
# If you want to build Testnet node
11
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_PEERPLAYS_TESTNET=1
12
13
# the following command will install the executable files under /usr/local
14
sudo make install
15
16
# the following isn't required if you ran the "sudo make install" command above.
17
# If you prefer, the "make -j$(nproc)" command will install the
18
# programs under $HOME/peerplays/programs
19
# Update the -j flag depending on your current system specs:
20
# Recommended 4GB of RAM per 1 CPU core
21
# make -j2 for 8GB RAM
22
# make -j4 for 16GB RAM
23
# make -j8 for 32GB RAM
24
make -j$(nproc)
Copied!

2.1. Starting the Peerplays Witness Node

If we have installed the blockchain following the above steps, the node can be started as follows:
1
witness_node
Copied!
Launching the Witness for the first time creates the directories which contain the configuration files.
Next, stop the Witness node before continuing (Ctrl + c).

3. Update the config.ini File

We need to set the endpoint and seed-node addresses so we can access the cli_wallet and download all the initial blocks from the chain. Within the config.ini file, locate the p2p-endpoint, rpc-endpoint, and seed-node settings and enter the following addresses.
1
nano $HOME/witness_node_data_dir/config.ini
2
3
p2p-endpoint = 0.0.0.0:9777
4
rpc-endpoint = 127.0.0.1:8090
5
seed-node = 213.184.255.234:59500
Copied!
Save the changes and start the node back up.
1
witness_node
Copied!

4. Create a Peerplays Account

We'll need an account as the basis of creating a new Witness. The easiest way to do that is to use the Peerplays DEX & this doesn't need download of an application.

4.1. Download the Peerplays Core GUI Wallet to Make an Account

  1. 1.
    Install, open, and create an account. It's pretty self-explanatory.
    🙂
  2. 2.
    Wait for your node to sync the blocks (about 7.3GB at the time of writing). We need to do this before we can use the CLI wallet.
  3. 3.
    From this point on, please note the results of the following commands as you'll need them later.

4.2. Use the cli_wallet to set a password and unlock the wallet

In a new command line window, we can access the cli_wallet program after all the blocks have been downloaded from the chain. Note that "your-password-here" is a password that you're creating for the cli_wallet and doesn't necessarily have to be the password you used in the GUI wallet earlier.
1
cli_wallet
2
set_password your-password-here
3
unlock your-password-here
Copied!
The CLI wallet will show unlocked >>> when successfully unlocked.
A list of CLI wallet commands is available here: https://devs.peerplays.tech/api-reference/wallet-api/wallet-calls

4.3. Generate OWNER private keys for the cli_wallet and import them

This will return an array with your owner key in the form of ["PPYxxx", "xxxx"]. Note that the "created-username" and "created-password" used here are the username and password from the GUI wallet!
1
get_private_key_from_password created-username owner created-password
Copied!
The second value in the returned array is the private key of your owner key. Now we'll import that into the cli_wallet.
1
import_key "created-username" SECONDVALUEFROMLASTCOMMAND
Copied!

4.4. Generate ACTIVE private keys for the cli_wallet and import them

Once again, this will return an array with your active key in the form of ["PPYxxx", "xxxx"]. Note that the "created-username" and "created-password" used here are the username and password from the GUI wallet!
1
get_private_key_from_password created-username active created-password
Copied!
The second value in the returned array is the private key of your active key. Now we'll import that into the cli_wallet.
1
import_key "created-username" SECONDVALUEFROMLASTCOMMAND
Copied!
The keys that begin with "PPY" are the public keys.

4.5. Upgrade to lifetime membership

You will need some PPY for this command to succeed. The account must have lifetime membership status to create a new Witness.
1
upgrade_account created-username true
Copied!

4.6. Create yourself as a Witness

The URL in this command is your own URL which should point to a page which describes who you are and why you want to become a Peerplays witness. Note your block signing key after you enter this command.
This command will require some PPY as well.
1
create_witness created-username "https://your-url-to-witness-proposal" true
Copied!
The above command will also return YOURBLOCKSIGNINGKEY

4.7. Gather your Witness account info

First we'll get the private key for your block_signing_key.
1
get_private_key YOURBLOCKSIGNINGKEY
Copied!
Then dump your keys to check and compare. One of the returned values from the following command should match your block_signing_key.
1
dump_private_keys
Copied!
Last we'll get your witness ID.
1
get_witness created-username
Copied!

5. Edit config.ini to include your Witness ID and your private key pair

Exit the cli_wallet with the quit command. Back in the first command line window, we'll stop the node (Ctrl + c) and edit the config.ini file once again.
1
nano $HOME/witness_node_data_dir/config.ini
2
3
witness-id = "your_witness_id"
4
private-key = ["block_signing_key", "private_key_for_your_block_signing_key"]
Copied!

6. Start the node and vote for yourself

1
witness_node
Copied!
We need to wait for the node to sync the blocks to use the cli_wallet. After the sync, you can vote for yourself. In the second command line window:
1
cli_wallet
2
unlock your-password-here
3
vote_for_witness created-username created-username true true
Copied!
Now you can check your votes to verify it worked.
1
get_witness your_witness_account
Copied!
Success! You built a Peerplays witness node from the latest source code and now it's up and running.
🎉

7. What's Next?

7.1. Auto-starting your node

Up until this point we have been running the node in the foreground which is fragile and inconvenient. So let's start the node as a service when the system boots up instead.

7.2. Creating a backup node

After that, it would be smart to create a backup server to enable you to make software updates, troubleshoot issues with the node, and otherwise take your node offline without causing service outages.

7.3. Fire up another node
🔥

You've got a Witness node. Now you'll need a BOS node. And since you're in the node making mood, how about a SON too?

7.4. Enable SSL to encrypt your node traffic

If you have a node that is accessible from the internet (for example, an API or Seed node) it would be wise to enable SSL connections to your node.

8. Glossary

Witness: An independent server operator which validates network transactions.
Witness Node: Nodes with a closed RPC port. They don't allow external connections. Instead these nodes focus on processing transactions into blocks.