How to run a TomoChain Masternode in Testnet from A to Z

Karl D. Brillant
TomoChain
Published in
16 min readOct 18, 2018

DISCLAIMER: This how-to was written regarding the Testnet some months ago. For up to date documentation, please take a look at the official documentation.

If you need any further support to set up your node, feel free to contact Alex via telegram @alex_9121

Step by step guide on how to run a masternode on Digital Ocean with tmn. From creating a droplet to the node being elected.

Introduction

What is a Masternode?

A masternode is a computer on a decentralized network that is running 24 hours a day. It powers the blockchain network by processing transactions and signing blocks.

What are the Benefits of a Masternode?

Masternodes help support the network by creating and signing blocks, providing faster transaction times and decentralized operations. Each blockchain project has unique features to their particular masternode architecture. As an incentive for investing in the necessary amount of coins required for a masternode, configuring, setting up your masternode, hosting and running it, masternodes pay their participants in coin or token rewards, based upon their portion of participation for each block completed on the blockchain.

What is a VPS?

VPS stands for Virtual Private Server. Provided by a web hosting company, each VPS runs an independent installation of an operating system (OS), Windows or Linux, and typically provides root access to the OS for advanced management and control.

Why is a VPS Required for Masternodes?

A VPS is recommended (and often required) for masternode setup, as you will need a dedicated static IP and 99.9% uptime to provide a stable and efficient node for the cryptocurrency’s network. Unlike your home or office PC, a masternode VPS serves one purpose, to securely and efficiently run a masternode. A VPS is online 24/7 and provides dedicated resources for the project’s decentralized network. This allows for a more stable and fluid network for the coin or token.

What is the Best VPS for a Masternode?

Each masternode requires different OS, hardware, and throughput specs, so you will want to check the setup guide for a particular masternode coin or token before you purchase a VPS for masternode hosting. Some examples of companies providing VPS that can be used for masternode hosting are as follows:

This guide will use DigitalOcean to set up a Droplet (VPS) to run a Tomochain masternode.

1: Set Up a Droplet using DigitalOcean

We are going to set up a Droplet (a VPS) using DigitalOcean.

Step 1.1: Visit DigitalOcean and Create a New Account.

Step 1.2. Verify your Email account. You have received an email from DigitalOcean. You just need to click the link you will receive on this email.

Step 1.3. Fill your Billing Info: credit/debit card OR PayPal. We choose PayPal and add some credit: $20.

Step 1.4: You will be redirected from PayPal to DigitalOcean. Click Get Started with Droplet to create a new Droplet. A Droplet is just a Virtual Private Server (VPS), a computer always up and running. This will be your Masternode.

You can also click the green Create button, then select Droplet.

Step 1.5. Choose an image: Ubuntu. I choose Ubuntu 18.04 x64

Step 1.6. Check the Hardware Requirements suggested by TomoChain:

Testnet

  • Must be facing internet directly (public IP, no NAT)
  • Must have at least 2 cores (CPUs)
  • Must have at least 8GB of RAM (Memory)
  • Must use an IaaS (“cloud”) provider of your choice (AWS, Digital Ocean, Google Cloud, etc.).
  • Storage must be SSD

Mainnet

  • Must be facing internet directly (public IP, no NAT)
  • Must have at least 16 cores
  • Must have at least 32GB of RAM
  • Must use an IaaS (“cloud”) provider of your choice (AWS, Digital Ocean, Google Cloud, etc.)
  • Storage must be SSD

Testnet: at least 8 GB RAM Memory, 2 vCPUs ($40/mo)
Mainnet: at least 32 GB RAM Memory, 16 vCPUs ($320/mo)

This are just recommended minimum requirements. You can select more powerful options and your masternode will perform better.

Step 1.7. Choose a datacenter region. (I choose London for this example)

For the best performance, choose the datacenter nearest to you and your users.

Step 1.8. Choose a hostname and click the Create button.

Step 1.9. You will see a progress bar. Wait until the Droplet setup is 100% complete. Then the IP address of your Droplet will be displayed.

Your new Droplet (VPS) is ready. You will receive all of the info in your email (username, password and IP address). You can access your Droplet using these credentials received on your email.

Droplet Name: Atlantis
IP Address: 178.62.127.177
Username: root
Password: xxxxxxxxxxxxxxxxxxxx

Step 1.10. Connect to your Server (via Console)

Under Manage > Droplets, find your new Droplet and click More > Access Console.

In the next section 2. Connect to Droplet using SSH we will show another way to access the console. You can skip that part and continue with section 3. First time using your Console.

If you choose to work with the DigitalOcean console and it is slow or something, feel free to use the SSH console.

2. (Optional) Connect to your Droplet using SSH

You have two options for connecting to your Droplet using SSH depending on your PC OS:

NOTE: You can use the Droplet console from DigitalOcean and Skip this section and continue with point 3: ‘First Time using your Server Console’.

About SSH Keys

Secure Shell (SSH) is a cryptographic network protocol which allows users to securely perform network services over an unsecured network. SSH keys provide a more secure way of logging into a server with SSH than using a password alone. While a password can eventually be cracked with a brute force attack, SSH keys are nearly impossible to decipher by brute force alone and most are considered uncrackable by modern computing hardware.

A SSH key pair provides you with two long string of characters: a public and a private key. You can place the public key on the server, and then unlock it by connecting to it with a client that already has the private key. When the two match up, the system unlocks without the need for a password.

How to connect to your server using SSH

  • Windows: you can use any SSH client. For our example we will use Putty (an open-source client you can download here: download Putty)
  • MAC OS: open Terminal (go to your Mac’s Applications folder => click on the Utilities folder => then click on Terminal).
  • Linux: depending on your distribution, you can usually also open it by pressing a combination of “Ctrl + Alt + T” keys.

For terminal in Linux / MAC OS you can connect with this command:

ssh user@<server-ip>

example for our instance of server in Linux / MAC OS would be:

ssh root@178.62.127.177

For our guide we will use Putty (Windows) — start it up:

Under Host Name (or IP address) input the IP your server provided in the email and click on Open. The default Port is: 22.

Next, in the Connection subheading in the Data configuration section, enter your server’s username in the Auto-login username field. For the initial setup, this should be the root user, which is the administrative user of your server.

Finally, you can save these preferences to avoid typing them manually in the future. Add a name in the text box under Saved Sessions like “tomo-testnet” and click Save on the right.

You have now saved all of the configuration data needed to connect to your new server.

When first connecting to this server from your computer, you will see a security alert (rsa2 key fingerprint). Click on Yes to continue. This will be shown only the first time, after that it will be stored for future sessions.

3. First Time using your Server Console

Step 3.1. Log in as root. The command line will be shown in the console, the username must be: root. You will be prompted for your password*. Enter the one sent in your email and press ENTER to connect to your server.

  • When you write a password it won’t show any characters, but it has been recorded.
  • As a useful tip, you can copy your password to the clipboard and then paste it in your Putty session. Simply right click and it will paste the data you have in your clipboard.

Step 3.2. Change the root password (only the first time). As a security feature, many providers have a mandatory change of the password the first time you log in with your root user. In this case, you will be asked to input your current password (from the email), and enter a new one (it is strongly recommended a 16+ char password with a mix of letters, numbers, special characters).

If you are not asked to change your password on the first connection, you can initiate this yourself (it is highly recommended that you change the default password with a new one) by entering the command passwd followed by ENTER.

You will be prompted to enter a new password and then retype the same password to confirm.

Save your root password as you can get locked out of your own server if you forget it.

You are now logged in as root. The root user is the administrative user in a Linux environment that has very broad privileges. Because of the heightened privileges of the root account, you are discouraged from using it on a regular basis. This is because part of the power inherent with the root account is the ability to make very destructive changes, even by accident.

The next step is to set up an alternative user account with a reduced scope of influence for day-to-day work.

Step 3.3. Create a new user. Use the following command to add a new user account that we will use to log in from now on. Our user is called michael, you can replace it with any username that you like:

adduser michael

You will be asked a few questions, starting with the account password. Enter a strong password. Optionally, fill in any of the additional information if you want or ignore it. This is not required and you can just hit ENTER in any field you wish to skip.

Step 3.4. Grant the user administrative privileges. Now, we have a new user account with regular account privileges. However, we may sometimes need to do administrative tasks from our normal account.

To add these privileges to our new user, we need to add the new user to the sudo group. This will allow our normal user to run commands with administrative privileges by putting the word sudo before each command.

As root, run this command to add your new user to the sudo group (substitute the highlighted word with your new user):

usermod -aG sudo michael

Now, when logged in as your regular user, you can type sudo before commands to perform actions with superuser privileges.

Step 3.5. You can switch to the new user by typing:

su - michael

4. Prerequisites (before ‘tmn’)

We will now prepare the prerequisites for tmn. You need Python 3.6 and Docker installed.

Step 4.1. First, we are going to install Python.

Type these two commands on the console with an ENTER after each:

apt updateapt install python3-pip

NOTE: If during the installation you are asked “Do you want to continue? [Y/n]”, just type Y and then press ENTER.

Check if you have installed the right Python version (must be newer than 3.5)

python3 --version

Step 4.2. Set Up Docker Repository:

Now we are going to install Docker:

  1. Update the apt package index. Then Install packages to allow apt to use a repository over HTTPS. The third line adds Docker’s official GPG key.
sudo apt updatesudo apt install apt-transport-https ca-certificates curl software-properties-commoncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

(NOTE: Be careful with DigitalOcean console. It may not paste the ‘|’ symbol correctly. If this is replaced with another char the command won’t work. To solve this you can manually try to input the ASCII character ‘|’ (Alt + 124) — or try using the SSH -like PuTTY- console)

2. Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.

apt-key fingerprint 0EBFCD88

pub 4096R/0EBFCD88 2017–02–22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <docker@docker.com>
sub 4096R/F273FCD8 2017–02–22

3. Use the following command to set up the stable repository.

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Step 4.3. Install Docker CE:

  1. Update the apt package index. Then install the latest version of Docker CE:
sudo apt updatesudo apt install docker-ce

2. Once installed, add your current user to the Docker group.

usermod -aG docker michael

3. Verify that Docker CE is installed correctly by running the hello-world image.

sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

Docker CE is installed and running. The docker group is created and we have or user added to it.

If you are seeing the screen below, congratulations! You have already installed Python and Docker. You have the prerequisites ready to run TomoChain’s tmn.

********************

TROUBLESHOOTING

error: could not access the docker daemon

If you have installed Docker, and get this error, you probably forgot to add your user to the docker group. Please run this, close your session and open it again.

usermod -aG docker $your_user_name

********************

5. Create a Tomo Wallet (testnet)

To run a masternode you need a TOMO Wallet.

For security reasons, it is recommended to use two TOMO Wallets.

  • One wallet is the public ‘Coinbase Address’.
  • The other wallet is your private Wallet from where you deposit the 50k TOMO and where you receive the rewards.

We are going to create the ‘public’ Tomo Wallet. This is not the account that will receive the rewards. The rewards are sent to the account that will make the 50k TOMO initial deposit.

Follow these steps to create a Tomo Wallet:

Step 5.1. Go to MyEtherWallet, select TOMO testnet on the top right corner.

Step 5.2. Enter a password and then Create a new wallet. Write down your private key.

You can use this TOMO Wallet (only testnet!) to vote for masternodes, send and receive coins.

Note: Those TOMO are only usable in testnet, they have absolutely no trading value

This wallet’s public address will be your “Coinbase Address” (the public key of the account that your masternode is using).

Repeat the same steps and create a second wallet, your private Wallet from where you will deposit the 50k TOMO and where you will receive the rewards.

6. Run a node in testnet (using ‘tmn’)

Tmn is a simple interface created by TomoChain developers to help you quickstart your masternode.

“We made a simple command line interface called tmn to easily and quickly start a TomoChain masternode. It takes care of starting the necessary docker containers with the proper settings for you. It will really suit you if you don’t already have a big infrastructure running. Spin up a machine in your favorite cloud and get your masternode running in a few minutes!”

Step 6.1. Follow the TomoChain guide to install tmn:

Installation (from pip)

pip3 install --user tmn

Update (from pip)

pip3 install -U tmn

To check that ‘tmn’ has been correctly installed, use the following command to show some tmn info:

pip3 show tmn

Name: tmn
Version: 0.2.5
Summary: Quickstart your masternode
Home-page:
https://tomochain.com
Author: Etienne Napoleone
Author-email: etienne@tomochain.com
License: GPL-3.0+
Location: /root/.local/lib/python3.6/site-packages
Requires: clint, pastel, python-slugify, docker, click

Step 6.2. First Start

When you first start your full node with tmn, you need to give some information.

--name: The name of your full node. It should be formatted as a slug string. Slug format authorize all letters and numbers, dashes ("-") and underscores ("_"). You can name it to reflect your identity, company name, etc.--net: The network your full node will connect to. You can choose here to connect it to the TomoChain Testnet or Mainnet (once launched).--pkey: The private key of the account that your full node will use. A TomoChain full node uses an account to be uniquely identified and to receive transaction fee. Important note: we advise for security measures to use a fresh new account for your masternode. This is not the account who will receive the rewards. The rewards are sent to the account who will make the 50k TOMO initial deposit.

It could look like this:

tmn start --name [YOUR_NODE_NAME] --net testnet --pkey [YOUR_COINBASE_PRIVATE_KEY]

We used the following command for our node (copy your own name & private key):

tmn start --name Atlantis --net testnet --pkey cf03cb58************

Once started, you should see your node on the stats page!

Note: it can take up to one hour (or more) to properly sync the entire blockchain.

********************

TROUBLESHOOTING

tmn: command not found

It might happen that your PATH is not set by default to include the default user binary directory. You can add it by adding it to your shell $PATH:

On GNU/Linux:

echo "export PATH=$PATH:$HOME/.local/bin" >> $HOME/.bashrc

*******************

Step 6.3. Your node should appear on the Stats page.

The blockchain is currently on block 1,737,568. The most updated nodes are on top of the list (green). Our recently created node is the last on the list, with only a few thousands blocks synced.

7. Apply Your Node (Become a Masternode)

Now that your node is up and running, you can go to TomoMaster and Apply your node to become a masternode.

Step 7.1. Getting suficient TOMO

To run a Masternode you need 50’000 TOMO.

For the testnet, you must fill out the following form and TomoChain team will send 50’000 TOMO-testnet to your wallet.

TomoChain team will review your request and send you the required funds.

Note: Those TOMO are only usable in testnet, they have absolutely no trading value

The 50’000 TOMO coins are in your wallet.

Step 7.2. Applying to become a masternode

You can apply now by going on the TomoMaster page. Login with the wallet that contains your newly received 50'000 TOMO.

We are logging using the TomoChain Testnet option and the private key.

On the top right corner, click on Become a Candidate.

Enter the amount of TOMO you want to deposit (minimum 50'000).

Enter your coinbase address. This is the public key of the account that your masternode is using. If your are running your node with tmn, you can simply run tmn inspect to get it.

Confirm with apply and proceed to make the payment.

Your full node will now be listed on TomoMaster. People can view its details and vote for it.

If your node is in the top 150 most voted nodes, it will be promoted as a masternode and will start producing blocks at the next epoch.

Congratulations! You have completed your TomoChain masternode!

For technical support and discussion, please join our Gitter.

About Security

What’s next? Now you have your masternode up and running. It is very important to secure your masternode from malicious attacks. Take some time to learn and complete some security measures, like: 2FA, SSH, firewalls, etc.

DigitalOcean has an article with 7 Security Measures to protect your servers.

Appendix: Resize Masternode

You can resize your masternode hardware, increasing the RAM or the number of cores or the SSD to improve the performance and power of your masternode.

Step 1. Go to the console and stop tmn

tmn stop

Step 2. Go to DigitalOcean and Turn Off the Droplet.

The node is OFF now.

Step 3. Find your Droplet and select Resize Droplet.

Select the new Size. More cores (vCPUs) and RAM are better.

We choose to increase from old: 8 GB RAM, 4 vCPUs to new: 32 GB RAM, 16 vCPUs.

Then click Resize.

Go grab a coffee. This may take some minutes…

The Droplet has been resized (in this example, from 8 GB to 32 GB RAM).

Step 4. Switch ON the Droplet.

Step 5. Open the console and re-start tmn!

tmn start

We are back to life! Now the node is synchronizing the blockchain…

Congratulations. You have successfully resized your Droplet.

TomoChain contact

Follow us on TomoChain Announcement Channel | Twitter | Facebook | LinkedIn | Reddit | Github | Sign up for our newsletter on Website

For General support: TomoChain Chat

For Technical support: Gitter

--

--