Managing Masternodes on a Single Ubuntu Server

in #smart-contracts6 years ago (edited)

                                          

 This is a guide for those who want to establish several Giant masternodes on a single server to manage them more efficiently. Please note that this guide is for Ubuntu LTS 16.04 users.

The Giant environment supports IPv6 - the latest version of the Internet Protocol. Since it only became an Internet Standard in 2017, it is still somewhat of a frontier technology, which is the primary reason why older cryptocurrencies like DASH do not support it. While most Internet service providers (ISP) support both IPv4 and IPv6, some may not. The management method described in the following guide will only work if your ISP supports IPv6. 

Step 1: Checking IPv6  

It is vital that you check to make sure your ISP allows IPv6 connections before you begin the installation processes described below. To do this, open up your computer’s command line interface (CLI) and input the command below that corresponds with your operating system.

Windows: ping -6 google.com
Mac: ping6 -I en0 IP_ADDRESS
Linux: ping6 google.com

As long as you see one of the following results, or something similar, your ISP supports the IPv6 standard:

$ ping6 google.com
PING google.com(fra16s18-in-x0e.1e100.net) 56 data bytes
64 bytes from fra16s18-in-x0e.1e100.net: icmp_seq=1 ttl=57 time=4.85 ms

Pinging google.com [172.217.11.78] with 32 bytes of data:
Reply from 172.217.11.78: bytes=32 time=11ms TTL=54
Reply from 172.217.11.78: bytes=32 time=11ms TTL=54
Reply from 172.217.11.78: bytes=32 time=9ms TTL=54
Reply from 172.217.11.78: bytes=32 time=13ms TTL=54

If you see a result with the term “Network is unreachable” or “Could not find host”, as shown below, this means that your ISP does not support IPv6.

$ ping6 google.com
connect: Network is unreachable

Ping request could not find host google.com

It has come to our attention that on Mac devices, this command sometimes does not work as intended. In that case, please, use the utility program ifconfig.
You may be able to contact your ISP via one of their support channels and ask about activating IPv6. If this is not possible, you can use a remote Virtual Private Server (VPS) that supports IPv6. As a last resort, you can also choose to switch to another ISP that does support the IPv6 Internet Standard.  

If you will be using a VPS to host your masternode, you must also check for IPv6 support there. You can do so by following the same method described above. Only this time you will be entering the command into your VPS CLI. Do not move on to the next step until you have checked both your ISP and VPS for IPv6 support. 

Step 2: Masternodes Installation 

Input the following script, which can also be found on our GitHub page, into your VPS command line interface:
git clone https://github.com/GiantPay/MasternodeVPS && cd MasternodeVPS It allows you to install multiple masternodes at one time. If you plan on running more masternodes in the future, it can be helpful to create the additional masternodes during this initial setup process, and only configure the ones you plan on activating now. You can then configure each of the masternodes you add in the future when you are ready to activate them. This will save you time when you adding new masternodes at a later date.

As mentioned in the IPv6 documents, “a single interface may also have multiple IPv6 addresses of any type (unicast, anycast, and multicast) or scope". In practice this means that you can create 100+ masternodes on a single IPv6 interface, as long as your server’s CPU can support the load. For example, let’s see how to install 50 masternodes:

./install.sh -p gic -c 50

This script is going to use the most recent stable version from our repository, assemble it on your server, and create several masternodes - in this case 50. After the installation procedure is complete, there will be multiple new additions on your server.

1.  50 structures named gic_n1, gic_n2, …, gic_n50. Regular Ubuntu tools can be used to manage them, for example:
·       systemctl status gic_n1 - see the status of the 1st masternode
·       systemctl start gic_n2 - launch the 2nd masternode
·       systemctl stop gic_n45 - stop the 45th masternode

2.  Masternode configuration files in /etc/masternodes folder are named in reference to the server names:
·       /etc/masternodes/gic_n1.conf
·       /etc/masternodes/gic_n2.conf
·       /etc/masternodes/gic_n50.conf

3.  Masternode folders (the blockchain data of each masternode is stored separately):
·       /var/lib/masternodes/gic_n1
·       /var/lib/masternodes/gic_n2
·      /var/lib/masternodes/gic_n50

4.  GiantD and Giant-CLI executable files in /usr/local/bin 

Step 3: Masternodes Configuration 

At this point, we have installed the masternodes on our server. Now we must also configure them. To do so, we must first generate a private key. To generate a private key, open up your local wallet and go to Tools, then click on Debug console. Enter the following command into the debug console CLI:

masternode genkey  

After generating a unique key, you must copy it and insert it into the configuration file of your node of choice.

Example. Bob wants to generate a private key for the 42nd masternode. After using the masternode genkey command, he should then copy the key and insert it in the /etc/masternodes/gic_n45.conf folder in the following field: 

Step 4: Final Activation 

OK, that was fast! Now the only thing remaining is to launch the masternode service and connect it to your local wallet. Begin by typing the following command in your server’s CLI.  

systemctl start gic_n1

The last number correlates to the node you want to launch. For example:  

systemctl start gic_n42   (will start node number 42)
systemctl start gic_n50   (will start node number 50)

Do this for every node you want to launch.

To connect it to your Giant wallet, launch the Giant wallet program on your computer. Open the Masternodes section and activate it in the same method as used during the usual single masternode VPS installation process. You can go to Section 4 (‘Activate Masternode’) in this document for more details on how to do this.  

Congratulations, you have installed a masternode on a VPS server yet you have room for a 49 more!  

Annex: useful commands 

Call Giant-CLI for a masternode

You can call Giant-CLI for a certain masternode by using this simple command (in this case, for the first node, insert the required number if you need a different one):

$ giant-cli -conf=/etc/masternodes/gic_n1.conf -datadir=/var/lib/masternodes/gic1 getinfo

Group operations

You can perform operations on several masternodes at the same time in bash. For example, here is a script that stops all masternodes:

#!/bin/bash

counter=1
while [ $counter -le 50 ]
do
echo $counter
systemctl stop gic_n$counter
((counter++))
done 

 Links

Official website
Discord
Twitter 

Sort:  

2017? Are you f*cking kidding me?
https://tools.ietf.org/html/rfc2460

Glad to see you're supporting IPv6 anyway, it'll save a lot of heartache in the future.

This command:

$ ping6 google.com

should never ever give this result:

Reply from 172.217.11.78: bytes=32 time=11ms TTL=54

SMH 🤦

Coin Marketplace

STEEM 0.22
TRX 0.20
JST 0.034
BTC 99006.74
ETH 3331.65
USDT 1.00
SBD 3.09