Multiple masternode setup on one VPS

This is a guide to setting up multiple TWINS masternodes on one VPS with the Nodemaster script.

1. Get a VPS server with IPv6 support

You need a VPS server with IPv6 support to run several masternodes on it. You can get it from any VPS provider. Some are listed below:

Choose a VPS server with the following specifications:

  • at least 1 GB of ram

  • Ubuntu 16.04 LTS as the operating system

  • IPv6 support (some providers offer it by default, with others you have to opt for it)

Choose a strong password for your default "root" VPS user (24 characters or more) and save it.

Choose a name for your VPS server.

You will get a choice to deploy the VPS in one of the regions the provider offers - choose a region you like. That should take a few minutes.

Save the IP address of your VPS server.

Another important step is to find out which IPv6 addresses are assigned to your server. The VPS providers will assign you a range of IPv6 addresses.

You only need to save the first IPv6 address since we will be using consecutive addresses.

An IPv6 address looks like this:

2a00:6d40:0040:5C0b:0000:0000:0000:0001

and consecutive IPv6 addresses look like this:

2a00:6d40:0040:5C0b:0000:0000:0000:0002
2a00:6d40:0040:5C0b:0000:0000:0000:0003
etc.

2. Logging in and system setup

Download PuTTY, a SSH client we will use to access our VPS from here. Choose a version appropriate for your operating sytem (64 or 32 bit).

Install PuTTY and run it. You will see this screen:

Enter your VPS IP address into the "Host name (or IP address)" field.

Leave other settings as they are, enter a name for your session in the "Saved Sessions" field and click "Save". This will save your VPS information and you will only have to double-click on the name of the session to connect to your VPS in the future.

Connect to your VPS, by either clicking "Open" or double-clicking your session name in the list.

When you connect for the first time PuTTY will display an alert window:

Click "Yes" to proceed with connecting and keep this window from appearing in the future.

You will see the PuTTY terminal screen asking you to login:

Enter your VPS username "root" and press enter. Afterwards you will be asked for your password. Enter it and press enter again. You will now see a screen similar to this one:

Updating your VPS server: Your VPS requires an update. You can initiate it with the following command:

apt-get update -y && apt-get upgrade -y

You can paste commands into the PuTTY terminal window by right-clicking. Just position your cursor where you want the pasted text to go and right-click.

You can copy text from the PuTTY terminal window by selecting it with your mouse cursor.

Wait for the update process to finish and you will be returned to the command prompt:

3. Setting up networking for your masternodes

Some VPS providers let you configure IPv6 addresses through a control panel so this step is not needed and you can skip to part 4 - Nodemaster script installation.

Just make sure to configure enough IPv6 addresses for your masternodes!

Other VPS providers don't have fully automatic IPv6 configuration but do let you enable IPv6 during the VPS configuration procedure. In that case there will already be an entry for the first IPv6 address in the interfaces file so you need to skip the first IPv6 address in the configuration process below and just add the missing ones.

Now it's time to set up the networking for your masternodes. We will do this with Linux' built-in text editor Nano.

Type the following:

nano /etc/network/interfaces

Nano will open the interfaces file which contains your network configuration:

Now it's time to decide how many masternodes you want to run because you have to configure enough IPv6 addresses for them.

You will need your IPv6 address that was assigned to you by the VPS provider and which I told you to save earlier.

Copy the following text into a text editor (Notepad will do) and replace the "YourIPv6address" part with your IPv6 address:

up ip addr add YourIPv6address/64 dev eth0

Now it should look similar to this:

up ip addr add 2a01:6e60:0010:23fd:0000:0000:0000:0001/64 dev eth0

Copy the text with your IPv6 address into the clipboard.

Now switch to PuTTY and move your cursor one line past the end of the text in the file.

Make sure it is at the start of the line, and paste the text by right-clicking. Press enter to move into the next row and paste the text again. Repeat as many times as needed.

Now your terminal screen should look similar to this one:

Note that this VPS did not have any IPv6 addreses configured by the VPS provider so I had to configure them myself.

To exit Nano press CTRL + X, followed by Y and Enter to confirm and write the changes into the file. You will be returned to the command prompt.

Now it's time to reboot your VPS. To do so type:

reboot

and press Enter. You will be disconnected from the VPS so close this terminal window, start PuTTY and login again.

Do NOT skip the rebooting step as it is crucial to set up your IPv6 addresses!

Now we need to test if the IPv6 addresses are active, so type:

ping6 <your IPv6 address>

If the address is active, you will get a response from it:

Cancel the pinging by pressing CTRL+C.

Repeat the process for all your masternode IPv6 addresses. If all of them respond to your pinging then you are ready to install the Nodemaster script.

4. Nodemaster script installation

To copy the script to your VPS type:

git clone https://github.com/NewCapital/nodemaster MNVPS && cd MNVPS

This will clone the Nodemaster script to the MNVPS directory on your VPS.

A successful cloning should give you this response and return you to the command prompt:

You can actually set up your VPS for more masternodes than you can currently have and start them later when you get enough collateral for them.

To start the actual installation, type (in this example, 4 is the number of masternodes we want to install):

./install.sh -p twins -n 6 -c 4

The script will start setting up your masternodes and compiling the TWINS source files.

Be patient as that will take awhile (it took 18 minutes in my case).

This is the screen you see when the script finished setting up your VPS and compiling the TWINS source code:

DO NOT run the command listed on the screen because you have to edit the individual masternode configuration files on your VPS first!

Now we need to edit the masternode configuration files. They are located in the /etc/masternodes directory, so move to that directory by typing:

cd /etc/masternodes

To get a list of the configuration files type

ls

We need to edit the configuration files with nano and fill in some information. To do that, type:

nano twins_nX.conf

Replace the X with the appropriate number of the configuration file.

There is one field of interest: the Masternode private key field. I marked it on the picture:

Delete the text after the = sign in the Masternode private key field and paste your masternode private key.

Now save the file by pressing CTRL + X, followed by Y and ENTER.

Repeat this step as many times as you have masternodes to configure.

5. Starting your masternodes

Now you are ready to start your masternode daemons:

If you configured ALL masternodes which the script set up, you can just type

activate_masternodes_twins

and your masternodes will be started.

If you only configured SOME of the masternodes the script set up, you have to enter 3 commands for each masternode:

systemctl daemon-reload
systemctl enable twins_nX
systemctl restart twins_nX

Replace X with the number of the masternode you configured.

Now you want to verify that your daemons are running by typing:

systemctl status twins_nX.service

Replace X with the number of the masternode you want to check.

A successfully running masternode will give you this response:

Type CTRL + C to exit, and repeat the process for all your masternodes.

That's it, you're done. Now you just need to start your masternodes from your controller wallet.

6. Check your Masternodes

We can now check the status of every masternode

Replace X with the number of the masternode you configured

twins-cli -conf=/etc/masternodes/twins_nX.conf masternode status

and see if the masternode has been started successfully.

You should see something like:{ “txhash” : “334545645643534534324238908f36ff4456454dfffff51311”, “outputidx” : 0, “netaddr” : “45.11.111.111:37817”, “addr” : “WmXhHCV6PjXjxJdSXPeC8e4PrY8qTQMBFg”, “status” : 4, “message” : “Masternode successfully started” }

You also need to check the masternode explorer after starting the masternode in your wallet.

To do so, copy your masternode wallet address from your terminal window by selecting it with your mouse (WmXhHCV6PjXjxJdSXPeC8e4PrY8qTQMBFg in the above example), visit the masternode section of the TWINS explorer, and paste it in the lower right search box to find your masternode.

Your masternode status should appear as "ACTIVE".

After starting a masternode its status changes in the following order:

"ACTIVE" --> for around 2 - 3 hours after starting it

"EXPIRED" --> It will be just for a couple of minutes

"REMOVED" --> for just a couple minutes

"ENABLED" --> Eventually the masternode will remain in this status and the "Active" time will start increasing.

NOTE: if the masternode status is "MISSING" in your local wallet, check its status in the masternode explorer, it might be EXPIRED/REMOVED there which is fine.

Do not be impatient! The first masternode reward takes 2x or 3x longer to come than regular rewards later. If you start the masternode again from the wallet, this timer will reset to zero.

That's it! You've succesfully started several masternodes!