Smartnode Setup With Docker (Recommended)

Docker is an open platform that allows you to quickly and easily deploy apps running in containers on OS level virtualization. All dependencies and the app itself are ready to run inside the container, so all you need to do is install Docker and Docker-compose, create a config file, and start the container.

The Docker image in this guide is built and maintained by Raptoreums lead developer Tri Nguyen. Tri has also created an improved health check script that checks to make sure your Smartnodes daemon (raptoreumd) is healthy and running. If it is not, it will attempt to restart it, it will even re-bootstrap the blockchain data for you if needed.

The ease of setup and improved health check make this the recommended way to setup and run a Raptoreum Smartnode.

Note: This guide assumes you are running Ubuntu 20 / 22, if you are running another OS you may need to adjust the commands.


What You Need #

  • A good VPS with a minimum of 4GB Ram, two CPU cores, and 50GB disk space. Contabo is not recommended as their unstable, and slow performance often causes Smartnodes to get banned. Hetzner also is not recommended, as they are anti-blockchain and may suspend your service if they find you are running blockchain related software.
  • Ubuntu 20 / 22 is recommended as the OS for your VPS.
  • A way to login to your VPS with SSH, such as Putty.
  • 1.8 Million RTM for collateral. You can see where to buy RTM on the How to Buy RTM page.
  • A local fully synchronized Raptoreumcore wallet.
  • About a 1/2 hour of your time.


Note: If you run into issues and need help, do not hesitate to hop on the Raptoreum Discord server and ask for help in the #smartnode channel.


VPS Preparation #

There are a few steps we need to take to prepare the VPS for running a Smartnode, time to login with SSH! You should be logged in as root, if your provider only gives you a sudo user you can change to root once logged in by doing:

sudo su

Once logged in follow these steps:

Update the OS #

Run this command:

apt update && apt upgrade -y

Install requirements:

apt install docker docker-compose fail2ban iptables-persistent -y

Add SWAP: (if your VPS runs out of RAM the OS can use SWAP as a fallback and stop raptoreumd from being killed).

dd if=/dev/zero of=/swapfile bs=1k count=4096k
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile       swap    swap    auto      0       0" | tee -a /etc/fstab
sysctl -w vm.swappiness=10
echo vm.swappiness = 10 | tee -a /etc/sysctl.conf

What’s happening in this block of commands line by line:

  • 4GB Swapfile space is created using dd.
  • Correct permissions are set.
  • Swapfile is setup.
  • swapfile is activated as swap
  • swap is added to /etc/fstab so it is available after reboots.
  • OS is told to use SWAP only if necessary (current session and removed on reboot).
  • OS is told to use SWAP only if necessary (even after reboot).

Check for UFW and Configure IPtables #

UFW is a simplified IPtables management system. We need to remove it if it is active as Docker does not play well with it. Instead we will us iptables directly. Check if UFW is installed:

ufw status

If that command returns active or inactive uninstall UFW:

apt remove ufw

Configure iptables rules:

iptables -I INPUT -p tcp --dport 22 -j ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -I INPUT -p tcp --dport 10226 -j ACCEPT
netfilter-persistent save

Key parts of these commands:

  • Port 22 is allowed, needed for your SSH connections.
  • Port 10226 is allowed, needed for raptoreumd.
  • iptables rules saved and persist through reboots.

Configure Fail2Ban #

Fail2Ban monitors login attempts and bans IPs that fail X amount of times, we will set it to ban after 3 failed attempts. This is needed to stop bruteforce attacks on your SSH service.

nano /etc/fail2ban/jail.local

Copy and paste in this block:

enabled = true
port = 22
filter = sshd
logpath = /var/log/auth.log
maxretry = 3

Setup Docker-Compose #

We need to create a docker-compose directory and configuration file, this sets both the container and raptoreum.conf configurations:

cd ~
mkdir docker-rtm

You will edit the docker-compose.yml file later on in this document. Reboot your VPS:



Setting Up Collateral And ProTX Command #


This section assumes you have already installed and synchronized Raptoreumcore as per the things needed at the start of this guide.
  • Create a new receiving address – Receive tab > Request payment. It is a good idea to also label it so you know it is your node collateral address. Example: smartnode-01.
  • Send 1.8 million RTM to the address you just created, it must all be in one single send.
  • Go to the Transactions tab, double click the transaction and record the Transaction ID and Output index:


Build The protx quick_setup Command #

The protx quick_setup command will register your node on the network.

Here is an example protx quick_setup command:
protx quick_setup "c4bbcde9771668fa640c263d4b964f688b0f039f7b684e715d92e4012369fea6" "1" "" "RFbWv94ZfueciwVVpHLMdqFayaXAS4sBxP"
The structure from left to right is:

  • Transaction Id – Replace it with yours.
  • Collateral index – Change if needed.
  • Your smartnode server IP and port – Replace example IP with your Smartnode server IP, leave port as is.
  • Fee address – This is any address in your wallet which contains enough RTM to pay the fee (cannot be the address which you sent the 1.8 million RTM to). When you enter the protx quick_setup command it is a transaction and needs to be paid for. It is a very small amount 1/2 an RTM is more than enough. In Debug console do “listaddressbalances” to show all addresses with a balance, choose one and replace address in example command.

This command is issued in Tools > Debug Console. Go ahead and issue the command, if successful you will see it return a block of data. There two things you need to record here:

1.) The “Operator Secret”.

2.) The Protx transaction hash.

Complete The Setup On Your VPS #

You need to make four changes in the docker-compose.yml file, login with SSH and do:

cd docker-rtm && nano docker-compose.yml

Edit the following lines:

1.) PROTX_HASH: “add protx hash here”

2.) rpcuser=changeme (change it)

3.)rpcpassword=changeme (change it)

4.) externalip= (put your VPS IP here)

5.) image: npq7721/raptoreum: Change this to: image: npq7721/raptoreum:latest

Once done save and exit (cntrl + x). Now start docker-compose:

docker-compose up -d

That’s just about it, docker takes care of bootstrapping and starting the node. Depending on how recent the bootstrap is it can take anywhere from 10 minutes to an hour to synchronize and start working. As raptoreumd lives inside docker you cannot “talk” to it with raptoreum-cli directly. Instead your commands will look like:

docker exec -it smart_raptoreum_node raptoreum-cli --conf=/raptoreum/.raptoreumcore/raptoreum.conf smartnode status

Once your Smartnode is synchronized the above command will return:

Ready Ready