Masternode Setup Guide
Launching VPS & Updating Once you purchased a fresh VPS with Ubuntu 16.04, and you are connected to it with ssh or similar software: We will be copy-pasting commands one by one in the VPS console (if you are root – you can exclude all instances of sudo, just run commands without the word sudo in front. To make file browsing and editing configuration files easier we suggest you install winSCP https://winscp.net/eng/download.php
sudo apt-get update
sudo apt-get upgrade
If you want more security you can create a new user (optional but recommended):
- Open a shell prompt.
- If you are not logged in as root, type the command
su -
and enter the root password. - Type
useradd
followed by a space and the username for the new account you are creating at the command line (for example, useradd jsmith). Press [Enter]. Often, usernames are variations on the user’s name, such as jsmith for John Smith. User account names can be anything from the user’s name, initials, or birthplace to something more creative. - Type
passwd
followed by a space and the username again (for example, passwd jsmith). - At the New password: prompt enter a password for the new user and press [Enter].
- At the Retype new password: prompt, enter the same password to confirm your selection.
- After this command is run, exit and return to your ssh client and log in again with this new user.
Making swapfile (Only Required When RAM is <1024MB on the VPS):
sudo dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
sudo mkswap /var/swap.img
sudo swapon /var/swap.img
To make the swap file persist after reboots, use these commands:
sudo chmod 0600 /var/swap.img
sudo chown root:root /var/swap.img
sudo nano /etc/fstab
This last command opens a Command Line text editor, append the following line to the end of the file:
/var/swap.img none swap sw 0 0
Save the file and exit – to exit and save, hit CTRL X
Firewall
You can do this step at anytime, or use alternative firewall software, etc – if not working, skip.
sudo apt-get install ufw
sudo ufw allow OpenSSH
sudo ufw allow 44144
sudo ufw allow 44145
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable
Compiling the wallet
sudo apt-get install git
cd ~
git clone https://github.com/MoneyByte/MoneyByte
sudo apt-get -y install build-essential libssl-dev libdb++-dev libboost-all-dev libcrypto++-dev libqrencode-dev libminiupnpc-dev libgmp-dev libgmp3-dev autoconf autogen automake libtool
cd ~/MoneyByte/src
make -f makefile.unix
(this step takes a while, make sure it does not give you an error message at the end). Now let’s go to the local wallet.
Preparing local wallet.
While we are waiting for the VPS to compile the wallet we are going to setup the local wallet. Make sure the wallet is already synced before you start.
- Open the wallet and click on RECEIVE.
- Click on NEW ADDRESS at the bottom and name it something like MN1
- Right click on the new address and copy it.
- Click SEND.
- Paste the wallet address in PAY TO, the LABEL should change into the one you create on point 2. If not, you paste a wrong address. Re-check it.
- Enter 50.000 into AMOUNT. No more, no less.
- Before you click on SEND make sure your wallet is full unlocked (by clearing the FOR STAKING ONLY option when you unlock it. If you dont have your password for your wallet, you can do that later.
- Now click SEND. Accept the fee.
- Now lock back your wallet. If your wallet does not have password, now is the time. Locking your wallet is to ensure safety of your wallet and the 50.000 MON you sent won’t be staking.
I suggest you activate the coin control feature and lock the TX for collateral to prevent it being spent.
Now we need to acquire masternode key and txID that identify your collateral. These to pair your local wallet with remote wallet (VPS) beside the VPS IP and masternode port.
- At the top of wallet click on Help -> Debug Window.
- Type
masternode genkey
- You will be given a random alphanumeric characters. Copy it and paste into temporary text file.Example: 5dTjd1QpbisUWgtQhXAQbGDJBi6qDew1ask3lkfnvjdjH3h
- Type
masternode outputs
- You will be given the txID with an extra number which usually 0 or 1. Copy it and paste into the temporary text file. Example: 45e5fb9086ded1efbd5523aa25fe08ebb23yh67c7283e78d87b3bf4f2bd29dbd 1
If you don’t get anything from point 4 command check on the TRANSACTIONS tab if the 50.000 MON transaction already has at least 1 confirmation.
Now click on the tab MASTERNODES then CREATE.
- ALIAS= the name of your masternode, maybe MN1 same as the address label.
- ADDRESS= your VPS IP and for port has to be 44144. Example: 2.3.4.5:44144
- PRIVKEY= the result from masternode genkey
- TXHASH= the 1st part of masternode outputs
- OUTPUTINDEX= the 2nd part of masternode outputs
Click OK. Restart wallet.
This will create a file masternode.conf in your app data folder (press Win Logo + R then enter %appdata%) with with sequence;
_vpsIP:MNport privkey TxHash index
Back to the MASTERNODES tab you should see the entry you have just created. If not you can try click update at the bottom.
Back to the VPS setup.
Once completed, to see if the wallet is ready you can type:
cd ~/MoneyByte/bin/
ls
See if there is a file moneybyted. Or you can use winSCP to browse into that folder and edit the later MoneyByte.conf. Then type…
./moneybyted -daemon
It should say – It is recommended you use the following random password: etc… And exit normally, it wants you to set a user and password in the configuration file – To do this, type these commands:
cd ~/.MoneyByte
nano MoneyByte.conf
Then paste this into it:
rpcuser=yourUsername
rpcpassword=yourPassword
rpcallowip=127.0.0.1
rpcport=77778
port=77777
daemon=1
server=1
listen=1
masternode=1
masternodeprivkey=result from masternode genkey
masternodeaddr=vpsIP:77777
addnode=145.133.187.166
addnode=207.154.225.242
addnode=46.101.205.47
addnode=207.154.229.18
addnode=46.101.203.85
addnode=139.59.208.102
(Save And Exit) to save use CTL+O, to exit CTL+X
Now restart the wallet again.
cd ~/MoneyByte/bin/
./moneybyted -daemon
You should see server starting, and let it sync for a while. To check the status of your masternode, press enter to get command line:
./moneybyted getinfo
Once the block number is the same a what you can see in the help-debug window information of your synced local wallet or on the block explorer, it means your vps wallet is synced.
Starting the Masternode.
After you are sure both wallet are synced open the local wallet.
- Open MASTERNODES tab.
- Full unlock your wallet.
Select the masternode you want to start then while you have it highlighted click START at the bottom. If you received message other than masternode started successfully (or anything like that) check on the troubleshooting at the bottom.
After you receive message masternode started successfully back to your VPS and run:
cd ~/MoneyByte/bin/
./moneybyted masternode status
Check on the “status” it should said/wrote 9. Other than 9 means the masternode has not been started successfully no matter what your local wallet status said.
In hotcold setup, only what in VPS matters because VPS is your masternode, local wallet it just your switch. You can ignore the “notCapableReason” message.
Your local wallet now should be locked again now. You can unlock for staking if you want to stake the rewards or the remain of your coins. Or else, you can exit your local wallet.
TROUBLESHOOTING
If you can’t start the masternode in your local wallet and got message something like “could not allocate VIN” please check this:
- Was your wallet fully unlocked ?
- If you activate coin control features in local wallet and locked the collaterall transaction make sure you also “unlock unspent” it before starting masternode.
- Open the masternode.conf in your local wallet and Ignition.conf in your VPS and compare to see if the entry for IP and privkey is same.
- Run again masternode outputs and compare in with entry in masternode.conf
If you don’t get “status” : 9 in your VPS;
- Check all entry are correct wait for 5 minutes and check the status again.
- If after 5 minutes status still the same, start masternode again from local wallet.
TIPS
- To automatically lock your masternode collateral you can add mnconflock=1 entry in your local Ignition.conf
- This is what every “status” code means when you type “./ignitiond masternode status”0 – MASTERNODE NOT PROCESSED1 – MASTERNODE IS CAPABLE2 – MASTERNODE NOT CAPABLE
3 – MASTERNODE STOPPED
4 – MASTERNODE INPUT TOO NEW
6 – MASTERNODE PORT NOT OPEN
7 – MASTERNODE PORT OPEN
8 – MASTERNODE SYNC IN PROCESS
9 – MASTERNODE REMOTELY ENABLED