In this guide you will learn how to run a dual node (peer and API) on centos 8
Note that this guide is work-in-progress, it will likely change over time
Requirements
Hardware
Hardware requirements are taken from Running a Symbol node — Symbol Documentation
Requirement | Minimum | Recommended |
---|---|---|
CPU | 4 Cores | 8 Cores |
RAM | 16 GB | 32 GB |
Disk Size | 750 GB | 750 GB |
Disk Speed | 1500 IOPS SSD | 1500 IOPS SSD |
Environment
- docker
- docker-compose
- node.js
- VIM texteditor
Ports
- Port
7900
is used by catapult-server to communicate between nodes - Port
3000
is used by the REST Gateway to expose the endpoints to interact with the node.
Installation
In this guide we assume that you are running a freshly deployed server with centos 8.
Creating a new user account
Although it works, it is not recommended to use the root
user account for installing/running your node. Thus we will create a new user account. We will name it symbolnode
Log into your server with the root
user account.
Use following command to create the user account symbolnode
:
adduser symbolnode
Set the password for the freshly created user account with the following command:
passwd symbolnode
[enter new password twice]
Add the user to the sudo-enabled usergroup (we need the sudo command for installation later) and switch to the symbolnode useraccount:
usermod -aG wheel symbolnode
su - symbolnode
Install environment requirements
Install and configure docker with the following commands:
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io -y
sudo usermod -aG docker symbolnode
sudo systemctl start docker
sudo systemctl enable docker
Install docker-compose with the following commands:
sudo dnf install curl
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Install node.js with the following commands:
sudo dnf module list nodejs
sudo dnf install nodejs -y
Install VIM with following command:
sudo yum install vim-enhanced -y
Reboot your server and login with the symbolnode
user account we have created earlier.
Verify environment requirements
To verify that the environment installations were successful, we can run following commands:
For docker, run:
docker run hello-world
The output should be similar to:
Hello from Docker!
This message shows that your installation appears to be working correctly.
[...]
For more examples and ideas, visit:
https://docs.docker.com/get-started/
For docker-compose, run:
docker-compose version
The output should be similar to:
docker-compose version 1.28.5, build c4eb3a1f
docker-py version: 4.4.4
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
For node.js, run:
node --version
The output should be similar to:
v10.24.0
Once you have verified the installation, you can continue to with the installation of symbol-bootstrap
.
Install and configure symbol-bootstrap
Use the following command to install symbol-bootstrap
:
sudo npm install -g symbol-bootstrap
Before we will run it, we will create a custom configration file custom.yml
with VIM.
The custom file should look like this:
nodes:
- friendlyName: 'NameOfYourNode'
host: IP
beneficiaryAddress: YourNEMAccount
friendlyName is the name of your node
host is the IP address of your node (can also be a DNS name)
BeneficiaryAddress is the Symbol Account which will get the node operator fee.
For more configuration properties, check Configuring node properties — Symbol Documentation
Use the following command to create and open the custom.yml
:
vim custom.yml
Press i
to change to insert mode.
Paste your config, for example:
nodes:
- friendlyName: 'MySymbolNode'
host: 123.123.123.123
beneficiaryAddress: NBUTOBVT5JQDCV6UEPCPFHWWOAOPOCLA5AY5FLI
Close insert mode with Esc
and save the file with:
:wq
Now we are finally ready to run symbol-bootstrap
with custom.yml
for the first time!
To do so, use the following command:
symbol-bootstrap start -p mainnet -a dual -c custom.yml
[enter password]
enter a strong password, this password will be used to encypt files on your node, including the private keys of the node accounts
Let it run for 2-3 minutes, then stop it by pressing ctrl + c
.
Before we run it again, we want to save our node accounts (including private keys).
To do so, decrypt the addresses.yml
file with the following command:
symbol-bootstrap decrypt --source target/addresses.yml --destination plain-addresses.yml
[enter the password you have just used to encrypt the files]
This will create a new file plain-addresses.yml
which is readable.
Open the plain-addresses.yml
with following command:
vim plain-addresses.yml
Write down the privatekeys of every account, you can use them to restore the accounts in case you have to.
After you have all information written down, close it with following command:
:q
We are going to remove this file from the server with following command:
rm plain-addresses.yml
We are not going to cover howto setup harvesting in this guide as it would push the boundaries. To activate remote harvesting, please follow Activating remote harvesting — Symbol Documentation
Running the node
After installation and configuration you are ready to run your node
Use following command:
symbol-bootstrap start -p mainnet -a dual -c custom.yml -d
[enter the password you have used to encrypt the files]
-p mainnet states that we are using the mainnet
-a dual states that we are running a dual (peer and API) node
-c custom states that we are using a custom configuration file
-d detached mode, symbol bootstrap will run it the background
To get a full list of different presets, check Using Symbol Bootstrap — Symbol Documentation
Validate the setup
Connect to your node via web, check that the following URLs return valid data.
http://YourNodesIP:3000/node/info for node health.
http://YourNodesIP:3000/chain/info for node connection to the mainnet.
Updateing symbol-bootstrap
To update the version of symbol-bootstrap, use following commands:
symbol-bootstrap stop
cp -r target target_backup
sudo npm install -g symbol-bootstrap
symbol-bootstrap start -p mainnet -a dual -c custom.yml --upgrade -d
Check the version by running:
symbol-bootstrap --help
If update was successfull, remove backup of target folder:
rm -r target_backup
Useful commands
To stop your node use:
symbol-bootstrap stop
To check if symbol-bootstrap
runs without problems use:
symbol-bootstrap healthCheck
To update your config, use:
(it’s recommended to backup the target
folder before you do this)
(edit your custom.yml config file)
symbol-bootstrap stop
symbol-bootstrap start -p mainnet -a dual -c custom.yml --upgrade -d
To start fresh with symbol-bootstrap
, for example if you experience problems with the config, use following commands:
symbol-bootstrap stop
docker system prune -a
sudo rm -r target
Selecting your node for harvesting in the desktop wallet
At the time of writing, the symbol desktop wallet doesnt let you enter custom node’s for harvesting. I guess this will be corrected in a newer release, until then, there is a workaround.
The wallet generates the harvesting node list based on peer’s of the node to which the wallet is connected to. To be able to see your own node in the list, you have to connect the wallet to a peer of your node.
Your account needs an importance score of > 0 to activate harvesting. You can check the importance score in the wallet or blockexplorer. When you send XYM to a new acount it needs about 12h to get importance.
- Open http://YourNodesIP:3000/node/peers in a webbrowser.
- Write down any of the peers.
- Open the symbol desktop wallet, login to the profile with your harvesting account.
- Go to wallet settings in the top right corner.
- Go to network settings and add the peer node from step 2 in “Node Url” field and press the “add node” button.
- After adding, close the settings, click on “Node” in the left bottom and choose the peer node we have just added in step 5.
- Close the wallet, open it again and login to your profile with the harvesting account again.
- Go to harvesting, your node should now appear in the “Node Url” list.
- Press “Link all keys” on the bottom, once done, activate it.
- Done