Manual Install
Set up a Sidechain Operator Node (SON) by building the source code
The process of manually installing a SON is similar to installing a Witness Node. This is an introduction for new SONs to get up to speed on the Peerplays blockchain. It is intended for SONs planning to join a live, already deployed, blockchain.
This tutorial will take you through the steps required to have an operating SON. Since SONs serve the purpose of facilitating transfers of assets between the Peerplays blockchain and other blockchains, we'll need to connect to another chain to be of any use...
Please review the Requirements for setting up a SON before continuing to run a manual install following this guide.
The following steps outline the manual installation of a (Bitcoin enabled) SON.
Preparing the Environment
Build Peerplays
Connect to the Bitcoin Network and Generate an Address
Create a SON Account
Configure the SON
Start the SON
(Optional) Automatically Start the Node as a Service
Before we begin, to set up a SON node requires about 110 PPY. This is to pay for an upgraded account (5 PPY) and to fund two vesting balances (50 PPY each). The remaining funds are to pay for various transaction fees while setting up the node. 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 SON hardware requirements.
For the manual install, we'll be using a self-hosted Bitcoin node. The requirements that we'll need for this guide would be as follows (as per the hardware requirements doc):
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 on Ubuntu 18.04 LTS:
1.3. Build Boost 1.67.0
Boost is a C++ library that handles common program functions like generating config files and basic file system i/o. Peerplays uses Boost to handle such functions. Since Boost is a dependency, we must build it here.
2. Build Peerplays
Now we build Peerplays with the official source code from GitHub.
Note: "1.5.18" can be replaced with the most recent release tag. For example: git checkout 1.5.18
where 1.5.18 is the latest production release tag as of July 2022. The list of releases is located here.
2.1. Start the node to generate the config.ini file
We start the SON Node with the witness_node
command although we are only intending to set up this node as a SON. This is because the same program is used to operate different types of nodes depending on how we configure the program. For more information on this, see Peerplays Node Types.
If we have installed the blockchain following the above steps, the node can be started as follows:
Running the witness_node program will create a config.ini
file with some default settings. We'll need to edit the config file so we'll stop the program for now. Stop the program with ctrl + c
.
3. Connect to Bitcoin Network and Generate an Address
There are two options available to connect to the Bitcoin network.
Run a Bitcoin node yourself
Find an open Bitcoin node to connect to
For the purposes of this guide, I'll discuss how to run a node yourself as that will be a more reliable connection for now. Either way you go, you'll need to collect the following information to use in the config.ini
file:
The IP address of a Bitcoin node you can connect to (127.0.0.1 if self-hosting)
ZMQ port of the Bitcoin node (default is 1111)
RPC port of the Bitcoin node (default is 8332)
Bitcoin RPC connection username (default is 1)
Bitcoin RPC connection password (default is 1)
Bitcoin wallet label (default is son-wallet)
Bitcoin wallet password
A new Bitcoin address
The Public key of the Bitcoin address
The Private key of the Bitcoin address
3.1. Install Bitcoin-core
First we'll download and install one of the official Bitcoin Core binaries:
The official Bitcoin Core binaries can be found here: https://bitcoincore.org/en/download/
The latest supported version is 22.0 as of July 2022.
Then we make a config file to manage the settings of our new Bitcoin node.
in the Vim text editor we'll set the following:
Save and quit the Vim editor.
The settings in the config file above are set to reduce the requirements of the server. Block pruning and setting the node to Blocks Only save network and storage resources. For more information, see https://bitcoin.org/en/full-node#reduce-storage.
Lastly we'll set a Cron job to ensure the Bitcoin node starts up every time the server starts.
At the bottom of the crontab file, add the following:
Save and quit the crontab file. Now we're ready to fire up the Bitcoin node!
If successful, you'll see Bitcoin Core starting
. As an extra check to see if everything is working, try the bitcoin-cli -version
or bitcoin-cli getblockchaininfo
commands.
Your Bitcoin node should now be downloading the Bitcoin blockchain data from other nodes. This might take a few hours to complete even though we cut down the requirements with block pruning. It's a lot of data after all.
3.2. Use the bitcoin-cli program to make a new wallet and Bitcoin address
We'll need a wallet to store the new Bitcoin address.
Now we will create a Bitcoin address.
Then we'll use this address to get its keys.
Now we get the private key.
3.3. A quick recap
That was a lot to go over. Let's collect our data.
Keep this tuple handy. We'll need it in the Peerplays config file.
4. Use the CLI Wallet to Create a Peerplays SON Account
4.1. Becoming a SON
Becoming a SON is very similar to becoming a witness. You will need:
An active user account, upgraded to lifetime member, which will be the owner of the SON account
Create two vesting balances (types "son" and "normal") of 50 PPY, and get their IDs
The Bitcoin address created for the SON account
Create the SON account, and get its ID
Set the signing key for the SON account (usually, its a signing key of the owner account)
Set the Bitcoin address as a sidechain address for the SON account
4.2. Running the cli_wallet program
We can run the Peerplays cli wallet connecting to the Peerplays node we have set up so far. Before we can do that we'll need to make a quick edit to the config.ini file.
in the first section of the config.ini file is the rpc-endpoint setting. We have to open our rpc-endpoint so we can use the Peerplays cli wallet. We'll enter the following:
Save the file and quit.
Our Peerplays node will have to be completely in sync with the blockchain before we can use the cli wallet so we'll start the node and wait for it to download all the data.
downloading all the transaction and block data will take hours. Unfortunately this is unavoidable the first time the node syncs with the blockchain. You might want to let this run overnight.
If you just can't wait for your node to sync, you can run the cli_wallet program on someone else's node. Simply pass the IP address of the other node like so. (In another command line window)
A good resource for server-rpc-endpoints is https://beta.eifos.org/status. They will be listed as API nodes and use the wss:// protocol.
4.3. Using the cli_wallet
Now that we have the cli_wallet running, you'll notice a new prompt.
This means we're in a cli_wallet session. First we'll make a new wallet and unlock it.
A list of CLI wallet commands is available here: https://devs.peerplays.tech/api-reference/wallet-api/wallet-calls
Assuming we're starting without any account, it's easiest to create an account with the Peerplays GUI Wallet. The latest release is located here https://github.com/peerplays-network/peerplays-core-gui/releases/latest. When you create an account with the GUI wallet, you should have a username and password. We'll need those for the next steps. First we'll get the private key for the new account.
The key beginning with "PPY" is the public key. The other key is the private key. We'll need to import this private key into the cli_wallet.
Next we'll upgrade the account to a lifetime membership.
At the time of writing this guide, this costs 5 PPY to perform this operation. You'll need that in your account first! To this end, see Obtaining Your First Tokens.
Next we'll create the vesting balances.
Now we have all the info we need to create a SON account.
To get the SON ID:
We'll set the signing key using the active key from the owning account:
Now we have our SON account ID and the public and private keys for the SON account. We'll need this for the config.ini
file.
5. Peerplays SON Configuration
The generated config.ini
file will be located at /home/ubuntu/witness_node_data_dir/config.ini
. We'll begin by editing this config file.
This file will be rather large so let's focus on the important part for configuring a SON node:
This section contains all the SON related configuration. Ensure the following config settings are in the config.ini
file under the peerplays_sidechain plugin options.
We're almost done, we also have to make sure the peerplays_sidechain plugin is listed in the plugins. Find the plugins
setting in the first section of the config.ini
file. If it's not already there, add the peerplays_sidechain
plugin to the list. Like so:
6. Start the SON
After setting up the config.ini
file for SON operation, we'll start the node back up.
Your SON is born! (pun intended)
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. Configure more sidechains
Why stop at Bitcoin?
Now you have a SON, but have you thought about becoming a Witness? It will be a piece of cake for you since you've already set up a SON.
7.5. 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
SON: Sidechain Operator Node - An independent server operator which facilitates the transfer of off-chain assets (like Bitcoin or Ethereum tokens) between the Peerplays chain and the asset's native chain.
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.
Vim: A text editing program available for Ubuntu 18.04. See vim.org
Last updated