Masternode concept is a great alternative to Proof-of-Stake and Proof-of-Work mining. It allows to take part in the blockchain verification process without wasting tons of energy or hoarding thousands of coins.
There are two main bases of Masternode code – DASH and PIVX. Each Masternode coin developers add code parts specific for the coin but principles and main console commands stay the same. Also local wallets are very similar visually. Once you understand the idea of one coin, you can easily navigate in another ecosystem.
Usually, Masternode install assumes that single VPS (Virtual Private Server) will handle single node. This way it can be run on very low specs server so the cost it brought to minimum. However, it turns out that is more cost efficient to have slightly more powerful VPS and host multiple nodes (even different coins) at once.
There’s one trick though. Most of the VPS providers allow multiple IPs in ipv6 notation while limiting ipv4. It brings additional level of complexity to Masternode setup process as majority of the automatic install script does not use ipv6 notation.
This tutorial is written using SAPP Masternode which is PIVX variation. SAPP coin is one of best performing Masternode coin. Currently, development is being led by the new dynamic developers team with some great ideas like SAPP shop allowing you to use SAPP coins earned using Masternode on Amazon.
More information about this coin can be found here: https://sappcoin.com/ and on the discord channel here: https://discordapp.com/channels/572468246754754600
Getting job done
First thing is to get yourself a VPS. I personally use Contabo.com as it’s very reliable and with great cost to power ratio.
Disclaimer: By all means I am not a Unix/Linux systems specialist so I am aware that there are more efficient ways to achieve the same output. This steps are noted down from multiple tries and errors and proved to work for me.
Cover the basics
As we are setting up our Masternode usign ipv6 we need to make additonal step comparing to standard procedure. It is making sure that our VPS can handle ipv6 traffic to our masternode.
/etc/network/interfaces and make sure that you have lines like this. The
address line is your ip received from the VPS provider. Standard ipv4
gateway should be the same but with .1 ending.
The real fun starts with
up commands. Those allows you to route the traffic from different ports to a Masternode. Obfuscated part is the ipv6 you should receive from the VPS provider. Add couple of entries so you can use them later (2-11 in my case). When you change the
interfaces file, save it and restart VPS. You should be able to ping those
up‘ed IPs from other machine.
Installing first Masternode
I assume that you already know how collateral works and you have proper outputs written down together with Masternode wallet address. So this tutorial will not cover that. Let me know in comments if you would like to have this step here as well.
To install first Masternode instance just follow the normal procedure. In SAPP case what you really have to do is after login to VPS using Putty, or any other tool of choice, you have to run
bash <( curl -sL https://raw.githubusercontent.com/sappcoin-com/MasternodeSetup/master/masternodeinstall.sh)
This should install first Masternode. Make sure copy all your keys and information provided on the screen. It’s safe to generate masternode key during install process. Go ahead and start Masternode in local wallet.
Right now, first SAPP Masternode should be working fine. You should check it using:
sap-cli -datadir=/root/.sap getmasternodestatus and
sap-cli -datadir=/root/.sap getinfo
Duplicating Masternode Services
Each of the Masternode instance must run on the separate service in Linux environment. They will share cli library but service must be a separate one, pointing to proper directory. Let’s start with duplicating
/etc/systemd/system and call it
sap2.service. Edit this
sap2.service and alter directories do they refer to .sap2 instead to .sap
Installing second Masternode
When you make sure that first Masternode is working, we can proceed with the second one. Instead of going through the standard install process, we just copy the existing node.
First, stop the existing Masternode using
systemctl stop sap.service.
Secondly, duplicate existing .sap folder using
cd /root cp -R .sap .sap2
Lastly, go to local wallet and generate Masternode key with
createmasternodekey. You will need it in a moment.
Now it’s time to connect all the pieces. Go to
.sap and edit
Note what is going on here:
- user to login to local server – input some random, you will not need that
- random password for user above
- this port should be random but you can’t use the already taken one. Usually it’s ok to user couple numbers below or above the standard one
- here comes one of the ips we setup in Cover the Basics step
- here comes the private key you received during install process
- basically the same as 4 but without port number
When you finished with
.sap/sap.conf we need to do the same with
Note couple differences here:
- Masternode address last part before the port is different
- Masternode private key is the one you created in local wallet. Don’t use the same you have in first Masternode!
- this IP is also consistend with address here not in the first Masternode
- Watch out for this setting. Sometimes, when starting Masternode it fails due to this not being set to 0
- Watch out for this setting as well. When you use the same IP as in the first Masternode, you may get error Cannot connect to server
Fire it up!
So we have everything ready. Let’s start services for both nodes and hope it goes well. Run
systemctl start sap.service and
systemctl start sap2.service. Last step is to start both Masternodes in local wallet. Remember to update masternode.conf with ipv6 (including [brackets]).
Confirm that everything works fine on the VPS side using
sap-cli -datadir=/root/.sap getmasternodestatus and
sap-cli -datadir=/root/.sap2 getmasternodestatus. Note that from now on, you will have to user
datadir parameter everytime you run cli commands for Masternode.