Tragocoin Guide Setting Up Masternode

Setup Masternode

This guide assumes you are setting up a single mainnet masternode for the first time. You will need:

  • 20.000 TRAGO
  • A Tragocoin core wallet to store your TRAGO
  • A Linux server, preferably a Virtual Private Server (VPS)

Set up your VPS

A VPS, more commonly known as a cloud server, is fully functional installation of an operating system (usually Linux) operating within a virtual machine. The virtual machine allows the VPS provider to run multiple systems on one physical server, making it more efficient and much cheaper than having a single operating system running on the “bare metal” of each server. A VPS is ideal for hosting a Tragocoin masternode because they typically offer guaranteed uptime, redundancy in the case of hardware failure and a static IP address that is required to ensure you remain in the masternode payment queue. While running a masternode from home on a desktop computer is technically possible, it will most likely not work reliably because most ISPs allocate dynamic IP addresses to home users.

We will use Vultr hosting as an example of a VPS, although DigitalOcean, Amazon EC2, Google Cloud, Choopa and OVH are also popular choices. First create an account and add credit. Then go to the Servers menu item on the left and click + to add a new server. Select a location for your new server on the following screen:

mn

Select Ubuntu 18.04 x64 as the server type. We use this LTS release of Ubuntu instead of the latest version because LTS releases are supported with security updates for 5 years, instead of the usual 9 months.

mn

Select a server size offering at least 2GB of memory.

mn

Enter a hostname and label for your server. In this example we will use tragomn1 as the hostname.

mn

Vultr will now install your server. This process may take a few minutes.

mn

Click Manage when installation is complete and take note of the IP address, username and password.

mn

Set up your operating system

We will begin by connecting to your newly provisioned server. On Windows, we will first download an app called PuTTY to connect to the server. Go to the PuTTY download page and select the appropriate MSI installer for your system. On Mac or Linux you can ssh directly from the terminal - simply type ssh root@ and enter your password when prompted.

mn

Double-click the downloaded file to install PuTTY, then run the app from your Start menu. Enter the IP address of the server in the Host Name field and click Open. You may see a certificate warning, since this is the first time you are connecting to this server. You can safely click Yes to trust this server in the future.

mn

You are now connected to your server and should see a terminal window. Begin by logging in to your server with the user root and password supplied by your hosting provider.

mn

You should immediately change the root password and store it in a safe place for security. You can copy and paste any of the following commands by selecting them in your browser, pressing Ctrl + C, then switching to the PuTTY window and right-clicking in the window. The text will paste at the current cursor location:

  • passwd root

Enter and confirm a new password (preferably long and randomly generated). Next we will create a new user with the following command, replacing with a username of your choice:

  • adduser username

You will be prompted for a password. Enter and confirm using a new password (different to your root password) and store it in a safe place. You will also see prompts for user information, but this can be left blank. Once the user has been created, we will add them to the sudo group so they can perform commands as root:

  • usermod -aG sudo username

Now, while still as root, we will update the system from the Ubuntu package repository:

  • apt update
  • apt upgrade

The system will show a list of upgradable packages. Press Y and Enter to install the packages. We will now install a firewall (and some other packages we will use later), add swap memory and reboot the server to apply any necessary kernel updates, and then login to our newly secured environment as the new user:

  • apt install ufw python virtualenv git unzip pv -y
  • fallocate -l 4G /swapfile
  • chmod 600 /swapfile
  • mkswap /swapfile
  • swapon /swapfile
  • nano /etc/fstab

Add the following line at the end of the file (press tab to separate each word/number), then press Ctrl + X to close the editor, then Y and Enter save the file.

  • /swapfile none swap sw 0 0

Finally, in order to prevent brute force password hacking attacks, we will install fail2ban. These steps are optional, but highly recommended. Start with fail2ban:

  • apt install fail2ban
  • ufw allow ssh
  • ufw enable

Create a new configuration file and paste in the following configuration:

  • cp /etc/fail2ban/fail2ban.conf /etc/fail2ban/fail2ban.local
  • cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
  • nano /etc/fail2ban/jail.local
  • [sshd]
    enabled = true
    port = 22
    filter = sshd
    logpath = /var/log/auth.log
    maxretry = 3

Then press Ctrl + X to close the editor, then Y and Enter save the file. Retart and enable the fail2ban service:

  • systemctl restart fail2ban
  • systemctl enable fail2ban

Then reboot the server:

  • reboot now

PuTTY will disconnect when the server reboots. While this setup includes basic steps to protect your server against attacks, much more can be done. In particular, authenticating with a public key instead of a username/password combination and enabling automatic security updates is advisable. However, since the masternode does not actually store the keys to any TRAGO, these steps are considered beyond the scope of this guide.

Install Tragocoin Core On VPS

Tragocoin Core is the software behind both the Tragocoin Core GUI wallet and Tragocoin masternodes. If not displaying a GUI, it runs as a daemon on your VPS (tragocoind), controlled by a simple command interface (tragocoin-cli).

Open PuTTY or a console again and connect using the username and password you just created for your new, non-root user.

Download and install the components of your Tragocoin masternode, visit the GitHub releases page and copy the link to the latest x86_64-linux version. Go back to your terminal window and enter the following command, pasting in the address to the latest version of Tragocoin Core by right clicking or pressing Ctrl + V:

  • wget https://github.com/trago-project/tragocoin/releases/download/v0.10.0.2/tragocoincore-x86_64-linux.tar.gz

Create a working directory for Tragocoin, extract the compressed archive and copy the necessary files to the directory:

  • tar xfv tragocoincore-x86_64-linux.tar.gz

Create a configuration file using the following command:

  • nano ~/.tragocoincore/tragocoin.conf

An editor window will appear. We now need to create a configuration file specifying several variables. Copy and paste the following text to get started, then replace the variables specific to your configuration as follows:

  • rpcuser=XXXXXXXXXXXXX
    rpcpassword=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
    rpcallowip=127.0.0.1
    #----
    listen=1
    server=1
    daemon=1
    maxconnections=64
    #----
    #masternode=1
    #masternodeprivkey=XXXXXXX
    #externalip=VPS_IP:9420

Leave the masternode and masternodeprivkey fields commented out for now. The result should look something like this: mn

Press Ctrl + X to close the editor and Y and Enter save the file. You can now start running Tragocoin on the masternode to begin synchronization with the blockchain:

  • ~/.tragocoincore/tragocoind

You will see a message reading tragocoin Core server starting.

Type the following command to generate a new Tragocoin address for the collateral:

  • ~/.tragocoincore/tragocoin-cli getnewaddress
  • TiFfzbwiN9oneftd7cEfr3kQLRwQ4kp7ue

Now send exactly 20000 TRAGO in a single transaction to the new address you generated in the previous step. This may be sent from another wallet, or from funds already held in your current wallet. Once the transaction is complete, view the transaction in a blockchain explorer by searching for the address. You will need 15 confirmations before you can register the masternode, but you can continue with the next step at this point already: generating your masternode operator key.

Continue with the next step to construct the TxId transaction required to enable your masternode.

Register your masternode

Identify the funding transaction
If you used an address in Tragocoin Core wallet for your collateral transaction, you now need to find the txid of the transaction. Click Tools > Debug console and enter the following command:

  • ~/.tragocoincore/tragocoin-cli masternode outputs

This should return a string of characters similar to the following:

  • {
    "16347a28f4e5edf39f4dceac60e2327931a25fdee1fb4b94b63eeacf0d5879e3" : "1",
    }

The first long string is your collateralHash, while the last number is the collateralIndex.

Generate a Masternode key
A private Masternode key is required to operate a masternode. The private key is specified on the masternode itself, and allows it to be included in the deterministic masternode list once a provider registration transaction with the corresponding public key has been created. Generate masternode key by entering the following command:

  • ~/.tragocoincore/tragocoin-cli masternode genkey
    {
    "764f9e37e7e1b29536519b74af2e5ff7b62122e62c2fffab35e"
    }

These keys are NOT stored by the wallet and must be kept secure, similar to the value provided in the past by the masternode genkey command.

We now need to stop the tragocoin core daemon, to shut down:

  • ~/.tragocoincore/tragocoin-cli stop

Add the private key to your masternode configuration
The public key will be used in following steps. The private key must be entered in the tragocoin.conf and masternode.conf file on the masternode. This allows the masternode to watch the blockchain for relevant Tx transactions, and will cause it to start serving as a masternode when the signed Tx is broadcast by the owner (final step below). Log in to your masternode using ssh or PuTTY and edit the configuration file as follows:

  • nano ~/.tragocoincore/tragocoin.conf

The editor appears with the existing masternode configuration. Add or uncomment these lines in the file, replacing the key with your Masternode private key generated above:

  • rpcuser=XXXXXXXXXXXXX
    rpcpassword=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
    rpcallowip=127.0.0.1
    #----
    listen=1
    server=1
    daemon=1
    maxconnections=64
    #----
    masternode=1
    masternodeprivkey=764f9e37e7e1b29536519b74af2e5ff7b62122e62c2fffab35e
    externalip=VPS_IP:9420

Replace the fields marked with XXXXXXX as follows:
- rpcuser: enter any string of numbers or letters, no special characters allowed
- rpcpassword: enter any string of numbers or letters, no special characters allowed
- externalip: this is the IP address of your VPS

Press enter to make sure there is a blank line at the end of the file, then press Ctrl + X to close the editor and Y and Enter save the file.

  • nano ~/.tragocoincore/masternode.conf
  • mnalias VPS_IP:9420 MN_PRIVATE_KEY TRANSACTION_TXID INDEX_TXID
Press enter to make sure there is a blank line at the end of the file, then press Ctrl + X to close the editor and Y and Enter save the file.

Now start the tragocoin core daemon:

    ~/.tragocoincore/tragocoind

Start Masternode
Now we need to wait until 15 confirmations on this collateral transaction,after reached 15 confirmationa masternode will start automatic.
and for monitor your masternode using:

  • ~/.tragocoincore/tragocoin-cli masternode status

At this point you can safely log out of your server. Congratulations! Your masternode is now running.