Complete Masternode setup guide
By Rafał - 2019-07-01
What is a masternode?
A masternode is a full node or a cryptocurrency wallet that is fully synced on the blockchain of whatever coin you choose with MN function availability and is always running 24/7 , also called Hot Wallet. The masternodes increase privacy of transactions (especially instant transactions), allows to participate in the future of projects through governance and votes and enable budgeting and treasury system in cryptos. Masternodes are a mean of passive crypto income when most people lack time to do active trading. It also allows users to be completely actor of a project and its ecosystem by improving the network every day.
Table of Contents
Pros and Cons of using a VPS hosting for masternodes
Masternode needs a static IP address and they need to run without any interruptions. Most home computers are connected to dynamic IP address and most home broadband connection are not as stable as data centers. If the IP address changes or if the network connection goes down then your node needs to start over which as a result you lose payments. This is one main reason why you need to setup and host masternode on a VPS. By hosting a masternode locally the IP address of your computer gets exposed to all over the Internet. By exposing your network you are not only putting your coins at risk but you are risking other personal data that are in that system. By using a VPS solution, you ensure your coins are safe and secured if you use the hot/cold configuration.
When choosing a VPS, you have full root access to the server you picked. With root access, you have complete control over the server environment to tweak it precisely for your needs. If you need a custom software package installed or port opened, you can do so without having to wait for your hosting provider to support it. In case of a self-installation at home ,the possibilities are the same but the security issues are still present and put your datas at risk. The biggest risk at home is if someone gain access to your personal network and then your root access to the masternodes.
Ecology and Resources:
With a VPS hosting solution, a large dedicated server is sliced or divided into different virtual environments. This way, more people share the resources of that physical server and allow the resources to be optimally used. In that way , users carbon footprint is as little as possible and ensure the minimum impact on our planet.
Setting up a masternode at home can consume a lot of energy and resources which could be optimized and limited with a professional VPS provider.
A scaling configuration:
When you host a masternode with a VPS your environment is hosted within what is called a container. This container is allocated a certain amount of resources depending on the package you purchased. The great thing about how these containers work is that they can easily and quickly be allocated more or less resources as you need them. This is done really quickly by the provider, ensuring the minimum downtime possible and limiting losses for your income.
If you need to upgrade your ram or CPU quickly when you feel the need, you can simply add more resources to your container in a few clicks. If you were using a home hosting, you would have to physically install the new equipment into your server – which would result in a downtime and then less rewards.
VPS hosting solutions are much less expensive now than they were only a few years ago. With advances in virtualization technologies, the prices are only expecting to decrease. It is now easy to afford for a VPS solution instead of a local installation. The electricity used to run a server 24/24 7/7 is less important and more optimized with a VPS provider than at home. The cost for maintaining the masternode up in case of a failure can be expensive if you must change the entire system yourself. The professional services of a VPS provider guarantee the minimum downtime and an efficient user-support.
The main drawback
While using a VPS system is the best solution for your masternode hosting, the main drawback of both VPS and local installations is the technical knowledge required.
Masternodes are blockchain-based nodes and require a minimal technical knowledge to setup and successfully run one. For non-techies or beginners, it might be tense or hard to learn basic information to setup a masternode easily. By chance, many project teams are now building one-click-scripts which install all the components needed and only require owners to input the correct data such as external IP, masternode private key and outputs etc.
How-to setup a masternode (complete technical guide)
This document is a guide for setting up a general masternode using the so called hot-cold set up. For compatibility reasons, we will use a VPS with Ubuntu 16.04 for the remote masternode while keeping the collateral coins safely in the local wallet (The local wallet can be stored on a VPS too or directly on your computer). The Ubuntu 16.04 version is stable and includes all the elements to run a basic masternode properly. You can set a masternode on your local machine, but this is less convenient, less economical and less secure, and therefore not recommended in any way (You can find more information on the pros and cons in the previous part) .
This guide was written using a system with 1GB RAM based on Ubuntu 16.04 VPS on IPv4. This detailed guide shows how to install a masternode manually. It is still possible to use install scripts to avoid learning some technical knowledge or use a 3rd party to completely manage and host your node. These scripts are often made available by the different teams and simplify the complete process of masternode setup from scratch. In the guide , we will be using “ProjectCoin” as a generic term to replace possible real projects names and the files associated.
Step 1: VPS Server Deployment (Hot Wallet)
This first part presents how to run a Linux Ubuntu 16.04 virtual private server (VPS) that will function as a masternode. This part is called the hot wallet because it must stay online & process transactions 24/7. The best way to do this is by using an existing VPS provider. In the current crypto market, there is a lot of competitors with different offers. The two most affordable and reliable are Vultr & DigitalOcean , offering basic offers and features from 2,50$ /month. The Ubuntu distribution with version 16.04 is the most reliable and easy to use for the current masternode market. The technical possibilities fit with the need related the masternodes setup.
A) Ubuntu Server Acquisition
The process to buy a VPS to host a masternode is simple. You’ll need to put in payment information, but you won’t actually be charged until you deploy your first server. The servers have a monthly fee around 2,5$-$5/month. After finishing the registration process on your chosen platform, go on your general VPS dashboard. For the technical part, we need a server based on IPV4 (not IPV6) with 1GB Ram and Ubuntu 16.04 installed on it. The storage space must be enough to handle backups if you wish to do some automatically with your provider or the data that will be stored on the server later on.
You can select any Server Location you want. For the server type, select Ubuntu 16.04 x64. The smallest server $5/mo. will work but, in some cases, we might need to setup a memory swap to avoid excessive resources consumption. Once the server is fully prepared by the provider, you’ll be able to launch it for the first time. You can set a label to recognize a specific MN/Server in case you have several MN installed on the same provider. You can keep the server information page open as we’ll need it to set up the server with the root access and the external IP address.
B) Server deployment
We need to login to our new VPS server and download the wallet, but first we need to access it. There are various programs to access Linux VPS machines through SSH, but we will be using Putty for ease of use. Go to the Putty website and download and install the latest client. Install and run Putty. Now we need to enter the VPS credentials to login. The default username is root. The password will be often made available directly on the VPS overview or sometimes sent by mail after the server purchase.
Download Putty: https://www.putty.org
Masternodes setup can be tricky without technical knowledge. In fact, the basic server configuration to host a node is the same and can be replicated (with snapshot) and used by different masternodes. Usually, the changing part is the configuration associated to a specific currency which could require some changes.
For the following, we consider that the masternode’s owner is logged in root on the VPS. In our case, using a low memory server, we need to set up a swap file. For reminder, a Swap is a space on a disk that is used when the amount of physical RAM memory is full. When a Linux system runs out of RAM, inactive pages are moved from the RAM to the swap space. ... In most cases when running Linux on a virtual machine a swap partition is not present, so our only option is to create a swap file.
The following commands must be entered in the exact same order and one line at a time. These commands are used to prepare the server with the needs associated to the future masternode installation.
Swap File Creation:
sudo dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
sudo mkswap /var/swap.img
sudo swapon /var/swap.img
We need to make the swap file persistent in case the server is rebooted (rare on a VPS, mainly done to install updates)
sudo chmod 0600 /var/swap.img
sudo chown root:root /var/swap.img
sudo nano /etc/fstab
Finally, add this line:
/var/swap.img none swap sw 0 0
To the end of the file and save it (Ctrl + s).
Before going further into the masternode setup, we need to install all the dependencies that might be required once you start to compile a new masternode on the server.
sudo apt-get update
sudo apt-get install automake
sudo apt-get install libdb++-dev
sudo apt-get install build-essential libtool autotools-dev
sudo apt-get install autoconf pkg-config libssl-dev
sudo apt-get install libboost-all-dev
sudo apt-get install libminiupnpc-dev
sudo apt-get install git
sudo apt-get install software-properties-common
sudo apt-get install python-software-properties
sudo apt-get install g++
We will now need a database to save and secure our data on the server. The most used database in the masternode market is Berkeley DB.
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb*.*-dev libdb*.*++-dev –y
The * need to be changed with the latest version of the Berkeley DB used for your configuration. (e.g. libdb4.8-dev libdb4.8++-dev -y)
At this point, you can make a snapshot of that configuration and reuse it with different masternodes. That configuration is basically the minimum needed to successfully run and install 90% of the masternodes in the crypto market.
The following commands cover the source download from an official repository and the basic preparation for the masternode configuration.
git clone https://github.com/”ProjectCoin”/”ProjectCoin”.git
After downloading the sources, we need to compile the masternode using the DB vX.X and no gui.
sudo make install
Finally, the last part of the setup on the Linux VPS is to edit and prepare the masternode configuration file directly on the server.
Go to the configuration folder:
If the folder doesn’t exist, you can create it with
and then use
to go directly into the folder
List the contents and look for ProjectCoin.conf with the command ls
If the file doesn’t exist, you can create it with:
then edit it with
Then we need to fill the requested information in order to successfully bind our VPS and our local wallet for the masternode setup.
Each line must be filled with the right information
rpcuser=(create a username)
rpcpassword=(enter a strong password)
externalip=(VPS IP Address)
bind=(VPS IP Address)
masternodeaddr=(VPS IP Address):Port defined by project configuration
masternodeprivkey=(masternode genkey results)
After this step, your masternode is ready to be launched from the VPS. Run the “ProjectCoinD” ( The daemon) and wait for it to sync. This may take a lot of time as it needs to download a lot of data with the blockchain.
Step 2: Local Wallet Preparation (Cold Wallet)
A cold wallet is used to hold your coins, activate your masternode collateral, receive rewards, and serve as the “controller” to start your hot wallet.
Downloading and Installing the latest QT-Wallet version
For the preparation of this part, we take into consideration that you downloaded the project’s wallet directly from an official source (website, github or bitcointalk). In most cases, the releases are available directly on GitHub. Be careful when choosing the version as it must be the same as the one used on your VPS operating system (Often 64 bits for Windows Systems). It is still possible to use MacOSX and Linux based systems depending on the end-user habits (rarer). The different extensions correspond to the type of operating system used: zip for Windows, tar.gz for Unix/Linux and osx.dmg for Mac. Extract the corresponding file to your Desktop then launch the QT as administrator (Right click and choose “Run as Administrator). The wallet can be ran on a Windows VPS or locally, depending on the users preferences.
When the wallet opens for the first time, the wallet should connect and start synchronizing with the blockchain. The process time depends on the duration since the genesis block was mined. The progress bar in the interface provides an overview and the status of the progress of synchronization. You can place your mouse over the bar or the icons in the lower right corner for more detailed information. It is important not to make any transactions until the synchronization is complete.
By default, the wallet files are divided in 2 locations:
The folder with the QT executable that you previously extracted and the configuration folder in C:UsersAdministratorAppDataRoamingProjectName.
How to encrypt wallet
Once the wallet is fully synchronized, it is necessary to secure it for future uses. The wallet’s encryption method is based on password/passphrase. To encrypt your crypto wallet using a password, click the settings drop down and click on “Encrypt Wallet”. The next step will ask you to enter a password. Do not ever lose or forget this password, or you will lose all of your coins definitely. Create a secure personal backup of this password so you can remember / retrieve later when needed.
Your wallet will now close to complete the encryption process. Now, your wallet file is encrypted. You will need to unlock your wallet for staking or to send coins each time you reopen it. For our future case, you have to unlock the wallet only once at the first start.
Important note: This wallet does not need to stay online (in contrast to hot wallet) or connected to the internet in order to receive masternode rewards.
How to back up the local wallet.dat (Wallet Data)
Each wallet has a built-in feature to backup the data. You can either do it via the wallet menu or directly manually from the storage folder. Click the File drop down and click “Backup Wallet…”.
With a masternode setup based on a VPS, make sure to send your wallet file to external storage.
This file will be the only way to recover your coins if something goes wrong with your VPS or computer. If you’re running locally on Windows, the directory for the wallet file is located in: C:UsersAdministratorAppDataRoamingProjectName. Anyway , make sure to do a new backup each time you receive new coins on the wallet .
To restore a wallet from a backup, rename the backup file to wallet.dat and place it in the ProjetName folder. This file ensures your coins are completely safe and secured, whatever happens and whenever you are.
How to create wallet addresses
Creating one of multiple wallet addresses is easy and accessible for everyone. From your wallet, you can create as many unique addresses as you’d like. Any address generated from your wallet can be used to receive coins, and it is very helpful to generate new addresses for specific payments using labels to differentiate them.
You can create an address from the “Receive Tab” or directly from the file drop down menu and by choosing “Receiving Addresses”. You can assign a label, amount, or message to go with the address. These fields are for your personal records and organization only. Each address will function the same way regardless of what you define. One specific address will be needed for the setup and will be used to receive the funds generated by the masternode. You can also directly create a new address using command lines:
From the local wallet, you can enter the debug console (Tools > Debug console) and type the following command:
getaccountaddress “MasternodeName”(MN1 as example)
Masternode Collateral Transaction
For each node, an amount of coins, called collateral is needed to start the masternode. That amount will be “locked” all the time the masternode is active and depends on the minimum requested by the project. It is nevertheless possible to withdraw this amount as soon as you wish.
It should be noted that the node will be automatically stopped if the collateral amount is lower than the minimum required. You must send yourself a transaction for exactly the number of coins required for masternode collateral. Sending a lower of amount won’t be enough to start the node. Be careful when sending the transaction as fees might be deducted from the total amount. Make sure to NOT check “Substract fee from amount” to avoid that problem.
To start, switch to the receive tab and create a new wallet address. Enter “MN1” in the Label field to name this address (or another name you wish to use). You don’t need to enter an amount yet. Click “Request Payment” or “Receive” to generate the new wallet address. You will need to send the collateral amount to that newly created address. Click on “Copy Address”.
Finally, switch to the send tab of your wallet. Paste your new address in the Pay to field and send a transaction with the corresponding collateral amount. Then click on “Send”. You will be requested to enter your password (created in the part “How to encrypt wallet”). Once the transaction is submitted and fully confirmed on the network (the number of confirmations depends on the coin’s network) , your coins will be eligible to function as a masternode collateral.
Masternode Configuration File Edition
In order to be able to run a masternode and link it with your local wallet, it is needed to edit the masternode configuration file with the right information. You can access directly the file from the %APPDATA% directory or through wallet. In case the file doesn’t exist in the repertory, you can create one using Notepad or Textedit. These datas will be used by the network to recognize your masternode and the associated wallet.
Each masternode requires a unique line of code in a very specific format. In order to complete this line of code, we’ll need to do 3 things:
- Paste the VPS IP Address
- Generate a masternode private key
- Determine the collateral output transaction ID and index number
The format used in the configuration file is:
#alias IP:port masternodeprivatekey collateral_output_txid collateral_output_index
Example : MN1 184.108.40.206:5353 93HaYBjEOFDQfIosaDfljsPEO8XgsURIUBFC1ikieaop 2sfsofuiancca84587aeaeagdf44541 0
Each item is separated by a space.
Alias: The alias is just a name for ease of use. In the example, we will use MN1
IP/Port: This will be the IP address of your VPS server and the port is defined by the basic configuration and the project’s team.
Masternode Private Key: This is the unique key to generate for each masternode by using the command masternode genkey. To set up more masternodes, each one requires a unique private key.
TXID Collateral: This is the transaction id for the collateral transaction you sent on the address.
TX Output Index: Value ranges from 0 to 1.
To generate a private key, click “Tools” and open the Debug console.
In the Debug console, you’ll need to type the following command to generate a masternodeprivkey:
Command: masternode genkey.
Copy your masternodeprivkey and paste it into the masternode configuration file. Keep the Debug console window open as we will need it in the next part.
Finally, we’ll need to find the collateral_output_txid and collateral_output_index from the masternode collateral transaction we made earlier. To do so , go back to the wallet’s Debug console, and type the following:
The “txhash” is the collateral_output_txid and “outputidx” is the collateral_output_index. You can now add these 2 elements into the masternode configuration file.
Finally, save the masternode configuration file and make a copy of the configuration in a safe place. Close and reopen your crypto wallet. Switch to the Masternodes tab and you will see your node in the controller list. The masternodes tab offers the possibility to interact with the masternodes and also get the masternode status in real time.
Step 3: Start the masternode
Go to your Windows wallet and open the RPC console by going to Tools -> Debug Console
Enter the following command into the RPC console masternode:
start-many “wallet password” or
masternode start-alias “aliasoftheMN”
You should see a message like this in the console:
“overall” : “Successfully started masternode, failed to start 0, total 1”,
“alias” : “mn1”,
“result” : “successful”
You can also directly launch the masternode via the dedicated tab by clicking on “Start-Alias”. If you want to find and use more commands about masternodes, such as a complete count or how to stop your masternode, you can use the command:
masternode list to see a full list of available commands.
File & Directory Commands on Ubuntu
1. The tilde (~) symbol stands for your home directory. If you are user, then the tilde (~) stands for /home/user
2. pwd: The pwd command will allow you to know in which directory you're located (pwd stands for "print working directory"). Example: "pwd" in the Desktop directory will show "~/Desktop". Note that the GNOME Terminal also displays this information in the title bar of its window. A useful gnemonic is "present working directory."
3. ls: The ls command will show you ('list') the files in your current directory. Used with certain options, you can see sizes of files, when files were made, and permissions of files. Example: "ls ~" will show you the files that are in your home directory.
4. cd: The cd command will allow you to change directories. When you open a terminal you will be in your home directory. To move around the file system you will use cd. Examples:
1. To navigate into the root directory, use "cd /"
2. To navigate to your home directory, use "cd" or "cd ~"
3. To navigate up one directory level, use "cd .."
4. To navigate to the previous directory (or back), use "cd -"
5. To navigate through multiple levels of directory at once, specify the full directory path that you want to go to. For example, use, "cd /var/www" to go directly to the /www subdirectory of /var/. As another example, "cd ~/Desktop"will move you to the Desktop subdirectory inside your home directory.
5. cp: The cp command will make a copy of a file for you. Example: "cp file foo" will make an exact copy of "file" and name it "foo", but the file "file" will still be there. If you are copying a directory, you must use "cp -r directory foo" (copy recursively). (To understand what "recursively" means, think of it this way: to copy the directory and all its files and subdirectories and all their files and subdirectories of the subdirectories and all their files, and on and on, "recursively")
6. mv: The mv command will move a file to a different location or will rename a file. Examples are as follows: "mv file foo"will rename the file "file" to "foo". "mv foo ~/Desktop" will move the file "foo" to your Desktop directory, but it will not rename it. You must specify a new file name to rename a file.
1. To save on typing, you can substitute '~' in place of the home directory.
2. Note that if you are using mv with sudo you can use the ~ shortcut, because the terminal expands the ~ to your home directory. However, when you open a root shell with sudo -i or sudo -s, ~ will refer to the root account's home directory, not your own.
7. rm: Use this command to remove or delete a file in your directory.
8. rmdir: The rmdir command will delete an empty directory. To delete a directory and all of its contents recursively, use rm -r instead.
9. mkdir: The mkdir command will allow you to create directories. Example: "mkdir music" will create a directory called "music".