Connect with us

How to Set Up a Masternode: A Beginner’s Guide

what is a masternode

Masternodes can be an excellent way to earn passive income in the crypto markets. Learn how to set up a masternode in this guide.

What Are Masternodes?

A masternode is a special type of node that perform particular functions within a crypto network. As an incentive to run a masternode and provide advanced functionalities to the chain, operators typically receive a larger share of the block reward.

The concept of masternodes was pioneered by Dash. In the case of Dash, a masternode comprises second-tier blockchain features including instant send (instant transactions), private send (financial privacy), a budget system, and decentralised governance.

The setup of most masternodes is similar despite them coming in various sizes and shapes. Anyone can set up and run a masternode and receive regular payment. 

For the purpose of illustration, you will learn how to set up a Dash Masternode. It’s among the most masternodes in the market. 

How to Set Up Dash Masternode

Masternodes

Set Up Your VPS

A virtual private server (VPS) is a cloud-based operating system that runs within a virtual machine. To start a masternode, the VPS has to operate on Linux and most people are using Ubuntu 18.04 LTS. The VPS helps to run various systems from one server making it cheaper and more efficient than doing it from a desktop computer.

The market has various cloud hosting services including Google Cloud, Amazon EC2. For this guide, we will go for Vultr. Vultr is considered to be more reliable, affordable, and has a better user experience. It provides various options for storage capacity, memory, and server location. To start, create an account on Vultr, add credit, then proceed to select the location of your server.

Since the server runs on Linux, you can go for Ubuntu 18.04 x64 as your server type. Ensure you choose the correct server size and it is recommended that you have 2GB of memory. Thereafter, enter the server label and hostname then wait for a few minutes for Vultr to finish installing the server. After all that is done, click on the manage icon and save the username, password, and IP address. 

Set Up The Operating System

DashThis is where you connect the server to your computer. The process varies from Linux to Windows and MacOS. On a Windows computer, download PuTTY and make sure you choose an installer that will match with your system. You can directly install it on a Mac or Linux computer from the terminal by typing the following;

ssh root@<server_ip>

After successfully installing PuTTY, run it from your start menu. You will enter the saved IP address where you’re required to fill in a hostname then click open. If a certificate warning pops up, just click yes since it is your first time connecting to the server. Thereafter, log in to the server using the user root and password given by the hosting service. For security purposes, change the root password as soon as you can. 

On the PuTTY window paste the command below then put your new password.

passwd root

Once done, use the command below to create a new user. This will replace the default username with the one you choose.

adduser <username>

The system will prompt you to enter your password. Enter the new password and make sure you save it. While you are still at root, use the commands below to update the system using the Ubuntu package repository.

apt update

apt upgrade

A list of upgradable packages will be shown by the system. Press Y then enter to install them then enter the following command 

apt install ufw python virtualenv git unzip pv

Press Y then enter and input;

ufw allow ssh/tcp

ufw limit ssh/tcp

ufw allow 9999/tcp

ufw logging on

ufw enable

Press Y then enter and input 

fallocate -l 4G /swapfile

chmod 600 /swapfile

mkswap /swapfile

swapon /swapfile

nano /etc/fstab

At the end, add this line (press tab to separate each word/number), then press Ctrl+X for the editor to close. Press Y then enter to save the file.

/swapfile none swap sw 0 0

To be secure, install fail2an then disable login over ssh

apt install fail2ban

Create a new configuration by inputting the following 

nano /etc/fail2ban/jail.local

Paste the configuration below

[sshd]

enabled = true

port = 22

filter = sshd

logpath = /var/log/auth.log

maxretry = 3

Hit Ctrl + X to close your editor, and press Y then Enter to save it. Restart it and then enal fail2ban service by entering the following;

systemctl restart fail2ban

systemctl enable fail2ban

Thereafter, open your SSH configuration file and disable root login

nano /etc/ssh/sshd_config

Look for the line reading PermitRootLogin yes then set it to PermitRootLogin no. Right below this, add the following AllowUsers <username>, to replace <username> with the one you selected above. After that hit Ctrl + X to close your editor and Y then enter to save it.

Reboot your server by entering the following reboot now

Send the Collateral

You need to have 1000 Dash to run a Dash masternode and you can have it registered with the official Dash Core wallet. To have enhanced security, you can use a hardware wallet. For this guide, we will use the more commonly used Dash Core wallet. After downloading it, wait for it to synchronise. 

Hit Tools > Debug console for the console to open. Input the command below in the console to get a new Dash address for your collateral. 

getnewaddress

yiFfzbwiN9oneftd7cEfr3kQLRwQ4kp7ue

You will need the collateral address later therefore save it.

Encrypt your wallet for security reasons by selecting Settings > Encrypt wallet. Save your password and make sure no one knows about it.

To back up your files, select File > Backup Wallet. Use an external hard drive to save the files away from your computer. This is to ensure that you will have access to your money if the computer has a problem.

In one transaction send 1000 Dash to the collateral address you created in the previous step. Once done, see the transaction through a blockchain explorer by searching that address.

15 verifications will be needed before registering the masternode however you can now go to the next step which is developing your masternode key.

Install Dash Core

Dash Core software is responsible for operating the graphic user interface wallet of Dash Core and also Dash masternodes. It is as well attached to the Dash blockchain.

Again open PuTTY and connect by using the username & password for the new non-root user. You can easily install Dash Core by using Dashman – an automated installation method. Enter the following commands to install using Dashman after you have logged in.

cd ~

git clone https://github.com/moocowmoo/dashman

~/dashman/dashman install

Press Y then Enter to confirm.

The latest Dash Core version will e downloaded for your system and an initial snapshot of the blockchain to hasten the process of bootstrapping. Download and install Sentinel after this because it is a requirement for masternodes whose version is 0.12.1 or higher.

~/dashman/dashman install sentinel

Now the system should be running like a standard Dash node as well as finishing to synchronise with the blockchain. When there’s a system error, Dashman cannot reboot the masternode therefore add a check function on the crontab. This is to ensure it checks every minute to e sure that the masternode is running.

crontab -e

Select nano as your editor then enter the following command at the end of the file;

 * * * * * pidof dashd || ~/.dashcore/dashd

Ensure there is a blank space at the end of the file y pressing enter then hit Ctrl + X to close the editor and Y then Enter to save the file. Thereafter, wait for the 15 configurations and the blockchain sync to be complete.

~/dashman/dashman status

Register Your Masternode

This is the final step in setting up your Dash masternode. This can be done in different ways as shown below.

  • Identify the funding transaction

Find the transactions txid (transaction ID). Click on Tools > Debug console then enter the command below

masternode outputs

 A string of characters similar to the following should appear;

{

“16347a28f4e5edf39f4dceac60e2327931a25fdee1fb4b94b63eeacf0d5879e3” : “1”,

}

The initial long string is your collateral Hash and the collateral index is the last number on the string.

  • Generate a BLS key repair

To operate a masternode, you need a public/private BLS key repair. You can skip this step if you’re using a hosting service because they provide you with their public key. If hosting your own masternode, Use Dash Core to develop a BLS public/private keypair y clicking Tools > Debug console then enter the command below;

bls generate

{

  “secret”: “395555d67d884364f9e37e7e1b29536519b74af2e5ff7b62122e62c2fffab35e”,

  “public”: “99f20ed1538e28259ff80044982372519a2e6e4cdedb01c96f8f22e755b2b3124fbeebdf6de3587189cf44b3c6e7670e”

}

Save the keys and keep them safe

  • Add the private key to your masternode configuration

The public key is used in the steps that follow. You must enter the private key in the masternode’s dash.conf file. Using PuTTY or ssh login to your masternode and edit the configuration as follows

 nano ~/.dashcore/dash.con

The editor displays the current masternode’s configuration. Uncomment or add these lines in the file, replacing the key with your BLS private key you created above

masternode=1

masternodeblsprivkey=395555d67d884364f9e37e7e1b29536519b74af2e5ff7

Ensure there’s a blank space at the end of the file by pressing enter, then hit Ctrl + X to close the editor and Y then Enter to save the file. For this change to take effect, restart the masternode.

Enter the commands below waiting for a few seconds in between to allow Dash Core to shut down.

~/.dashcore/dash-cli stop

sleep 15

~/.dashcore/dashd

  • Prepare a ProRegTx transaction

In the step above, we had already developed pair of BLS keys and entered the private key on the masternode. In this transaction, the public key is used as the operatorPubKey.

Initially, we must get a new and unused address from the wallet to work as the owner key address (ownerKeyAddr). It is not similar to the collateral address that holds 1000 Dash. Create the new address as follows 

getnewaddress

yfgxFhqrdDG15ZWKJAN6dQvn6dZdgBPAip

This is the same address that can be used as a voting key address (votingKeyAddr). You can as well use the address given to you by your voting delegate or create a new voting key address as below.

getnewaddress

yfRaZN8c3Erpqj9iKnmQ9QDBeUuRhWV3Mg

You can also develop or select an existing address for receiving the owner’s masternode payouts (payoutAddress). As well you can use an address that is external to your wallet;

getnewaddress

yjZVt49WsQd6XSrPVAUGXtJccxviH9ZQpN

Alternatively, you can create and fund a different address as a source of the transaction fee (feeSourceAddress). To choose an external address for payouts, you have to specify a fee source address. The address you choose (fee source or payout address) must have enough funds to pay the transaction fee. Without enough funds, the register_submit transaction will not go through.

Both private keys and fee source addresses of the owner must be in the wallet that submits the transaction to the network. Your wallet must be unlocked if password protected so as to perform the commands below. Leave your wallet unlocked for 5 minutes:

walletpassphrase yourSecretPassword 300

Now prepare an unsigned ProRegTx special transaction with the protx register_prepare command. The syntax of this command is as follows

protx register_prepare collateralHash collateralIndex ipAndPort ownerKeyAddr

  operatorPubKey votingKeyAddr operatorReward payoutAddress (feeSourceAddress)

Open a notepad or text editor to prepare this command. Each argument to the command should be replaced as follows:

collateralHash: The txid of the 1000 Dash collateral funding transaction

collateralIndex: The output index of the 1000 Dash funding transaction

ipAndPort: Masternode IP address and port, in the format x.x.x.x:yyyy

ownerKeyAddr: The new Dash address created above for the owner/voting address

operatorPubKey: The BLS public key earlier generated (or given y your hosting service)

votingKeyAddr: The new Dash address created above, or a delegate’s address used for proposal voting.

operatorReward: The percentage of the block reward given to the operator as payment.

payoutAddress: AN existing or new Dash address for receiving the owner’s masternode rewards.

feeSourceAddress: An (alternative address used for funding ProTx fee. payoutAddress will be used if not specified.

It is the operator’s responsibility to specify their own reward in a different update_service transaction if they specify non-zero operatorReward. The masternode collateral’s owner doesn’t specify the operator’s payout address. 

The Stake-Away

Setting up a masternode is a good alternative method of earning passive income therefore it is vital to know how to set up a masternode. The steps mentioned above will help you set up and run it and earn passively.

BitCasino