MIRAI Masternode guide: Hot / Cold wallet setup with Linux VPS

This guide will take you through the process of setting up your masternode on Linux VPS. It is recommended to use Ubuntu 16.0.4 for the Linux VPS. Once you have completed the guide, you will have your masternode set up as a hot/cold wallet set up.

This is the safest way to run a masternode. The hot wallet is hosted on the linux VPS and actually contains no coins.
It uses an encrypted snapshot of the coins to verify transactions on the network. In the guide we may refer to it as 'hot wallet', 'VPS wallet' or 'Linux wallet'.

The cold wallet is hosted on your local machine. Your coins are held in the cold wallet and once the masternode is activated the cold wallet can be closed without affecting masternode rewards. In the guide we may refer to it as 'cold wallet', 'local wallet' or 'controller wallet'.

Requirements:

  • 1000 MIRAI coins
  • MIRAI wallet on local PC
  • Linux VPS running UBUNTU 16.0.4 for the hot wallet. (note that MIRAI masternodes use a fixed port so you can only run 1 MIRAI masternode per VPS)
Software requirements:

Controller wallet setup:

If you haven't already got the MIRAI QT wallet, download and install the correct version for your local PC operating system.
It's a good idea to run the wallet as administrator: For Windows, right click the mirai-qt.exe, choose Properties>Compatibility tab>Run as Administrator.
Once the wallet is running, let it synchronize. You should also encrypt your wallet with a password. Keep it safe, there is no way to recover it if lost.
When the wallet has fully synchronized, check it against the block explorer to make sure you are on the correct block.
Once you are certain you are on the correct block you will need to transfer the coins for the masternode.

1. Go to: File> Receiving addresses.. Click New. Choose an easy label like MN1, then click OK.

Add receiving address

2. Now send exactly 1000 coins to the new address you created.
You need to wait for 1 confirmation before proceeding.

3. Now go to Tools>Debug Console. Type: masternode genkey

create masternode genkey

4. Copy and paste the results into a text file.
Now back in the debug console,

5. Type: masternode outputs

copy masternode outputs

6. Save the results to the same text file and save the text file.

7. Go to Tools>Open Masternode Configuration File or find it in the AppData folder

Enter the masternode details in the following format:
LABEL VPS-IP:14440 MASTERNODE-GENKEY MASTERNODE-OUTPUTS SINGLE-DIGIT-AFTER-MASTERNODE-OUTPUTS
Here is an example:
MN1 199.299.399.499:14440 4hgFCthisisthegenkeyringtherej4ALV 8e6835thisisthemasternodeoutputsrightthere6bec40a1f 1

create masternode config file

The details should be on one line with a single space between each element.
8. Save the masternode.conf file.
Copy the details to a text document if you haven't already. You will need them later.

Linux Masternode setup:

1. Open Putty and log into your Linux VPS server as Root.

2. Type: apt update && apt upgrade -y

If you are prompted to type, just hit enter.
Once the updates are complete..

3. Type: adduser mymirainode (or whatever you want your username to be)

You will be prompted to add a password. Make sure you remember it. You will need it.
Just hit enter to skip through adding user details

4. Next type: usermod -a -G sudo mymirainode
This gives your new user admin privileges.

5. Close or log out of Putty.


6. Open WinSCP and log into your Linux VPS as mymirainode (or whatever username you chose)

winscp login

7. Use the link in the 'software requirements' section above to download the MIRAI Ubuntu cli (not the qt).

download cli

8. Unzip it and upload the 3 files to your VPS server in the directory that opened by default. (right side window).

mirai winscp transfer

9. Once they are uploaded, select all 3 files, right click and choose properties. Tick execute(X) permissions for owner and group. Hit OK

download cli

Leave WinSCP open.


10. Back in putty log in as mymirainode (not root).

11. Type ./miraid -daemon

daemon error

You will receive an error message, but that is expected.
When the daemon attempted to start, it created the data folder and files, which we need to access.

Back in WinSCP:
12. Click the 'find files' button and search for mirai.conf

winscp find files

13. Open it and add the following information:

rpcuser=ANYUSERNAMEYOULIKE
rpcpassword=ANYPASSWORDYOULIKE
listen=1
server=1
daemon=1
staking=0
logtimestamps=1
rpcallowip=127.0.0.1
externalip=LINUX-IP:14440
bind=LINUX-IP:14440
maxconnections=256
masternode=1
masternodeprivkey=YOURMASTERNODEGENKEY
port=14440

14. Replace everything in capitals with your own information.

mirai-config

15. Save the file.
16. Now right click on mirai.conf and choose properties. Tick execute(X) permissions for owner and group. Then click OK.

mirai-config-permissions

17. Back in Putty, type ./miraid -daemon again. (If you get an error, check you are still logged in as mymirainode and not root)
You should see a message telling you it has started successfully.
18. Next type: ./mirai-cli getinfo
mirai-getinfo

Look for the line showing blocks and also look at number of connections. Blocks may appear as 0 at first, while the VPS is gaining connections.
If it doesn't change it is likely that you need to open ports 14440 and 14445 to allow the connections.

19. Type this to open the ports:
sudo ufw allow 14440 (if prompted enter your password)
Then
sudo ufw allow 14445

20. Then type the getinfo command again.
Check that the block count matches the block count on the explorer. It's ok if it is just a few blocks difference.

Controller Wallet Continued and final steps


Now we need to go back to the cold wallet on your local machine.
The masternode config won't be read for changes until we close and restart the wallet.

1. So make sure it is closed now, then start it.
2. While the wallet is synchronizing, unlock the wallet. Make sure you untick 'for staking only'.
3. Once wallet is synchronized go to the transactions tab and check how many confirmations the 1000 coin transaction has.
While the wallet might tell you it only needs 6 confirmations, it actually needs 16 confirmations before the masternode can be activated.
4. Once the transaction has the 16 confirmations, you can go to the masternodes tab and click 'my masternodes'.
You should see the masternode with the status 'missing'.
5. Right click on the masternode and choose start alias.

start masternode

You should get a message saying it has started successfully and it will appear as enabled, but the active time will show as 0m:00s.
6. Wait 30 seconds, then right click and start alias again.
You should see a negative number appear in the active column. This is actually your sign that the masternode is up and running.

masternode-started-minus

Active time will update after a short time to show correct details.

7. Lastly, go back to Putty and type: ./mirai-cli masternode status.
If all has gone well, you received the reponse that your masternode is running successfully.

putty-masternode-status

And you are finished.


Troubleshooting errors:

MASTERNODE_NOT_PROCESSED: 0
MASTERNODE_IS_CAPABLE: 1
MASTERNODE_NOT_CAPABLE: 2 (usually an issue with privkey or txid, but occasionally a wallet bug where you need to redo transaction to new wallet address and set up masternode again )
MASTERNODE_STOPPED: 3
MASTERNODE_INPUT_TOO_NEW: 4 (not enough confirmations on masternode collateral transaction)
MASTERNODE_PORT_NOT_OPEN: 6 ( allow port in firewall)
MASTERNODE_PORT_OPEN: 7
MASTERNODE_SYNC_IN_PROCESS: 8 (give walllet time to sync or check addnodes)
MASTERNODE_REMOTELY_ENABLED: 9

Most problems can easily be fixed if you understand the steps you went through to start the masternode.

The transaction for the masternode never leaves your controller wallet. It is matched to the vps through the config files.

If your problem relates to a message about ip or port, or if the masternode details appear incomplete, check the masternode.conf file
If the VPS masternode status is 'waiting for remote activation, check that the 1000 coin transaction has over 16 confirmations.
If the masternode is dropping out of the masternode list, check genkey and outputs for errors.

A quick note on wallet updates.
Updating to a newer wallet is quite easy.
In putty, type ./mirai-cli stop
Copy the new files to your VPS using WinSCP and set permissions again.
In putty type ./miraid -daemon
Done.