How to setup a Neutron NTRN Masternode on Ubuntu Linux

in #altcoin7 years ago (edited)

Neutron has been around for some time and recently i found myself drawn to it being that it had a low barrier to entry for a masternode unlike all other masternode coins at the moment. The community didn't have a guide for setting up a linux masternode so here is a breakdown of the steps i took to get my masternode up and running on a Ubuntu Linux droplet at Digital Ocean.


Word of Warning: Always test you can use a linux wallet before committing all your 25000 coins to it, if you have never used a CLI/Non GUI wallet it is YOUR responsibility to learn what you need to know.. This guide will show you some basic things but you should install a test wallet in a sandbox , send it a coin or two and play with it first before proceeding, don't rush, you don't want to lose it all with a rookie mistake.


Assumptions:  Ubuntu 16.04 installed on your VPS and can SSH into it and you are accessing via SSH with a username and password.

VPS Security: if you do not setup access to your VPS using ssh keys and a firewall then i suggest that you make sure you have at least enabled the firewall on your VPS and only allow the required TCP ports incoming for the Neutron Masternode and SSH, you should also define only a single IP as the source address for TCP Port 22/SSH access be it your work or home IP. When you are not accessing the server for maintenance you should block port 22/SSH in your firewall at the VPS console so it is only open for the time required. Also enable 2FA at your VPS if available.


----VPS Setup---

If you need a VPS provider thats only ~$5/month then signup at Digital Ocean and get $10 free credit here when you join (approx 2 months free with a basic VPS).

Create a new droplet, ideally you will use the $10 option as it will allow for longer lifespan but the $5 should be sufficient for some time.


Lets roll.....

---Create a non root user---

Now login to your droplet/VPS host as your root user

Let's add a new non root user :

adduser neutronuser

Create a Password and fill in all other info when asked (you can press enter through all this) and then Y to confirm

Add this user to the sudo group 

usermod -aG sudo neutronuser

Logout of the server and log in as this new user 


---Setup Swap Space---

This is needed to compile Neutrond if you skip this it will fail  if you have low RAM.

sudo dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
sudo mkswap /var/swap.img
sudo swapon /var/swap.img


--Install Dependencies---

Some may be unnecessary sorry but it works :)

sudo apt-get update && sudo apt-get install automake libdb++-dev build-essential libtool autotools-dev autoconf pkg-config libssl-dev libboost-all-dev libminiupnpc-dev git software-properties-common python-software-properties g++ qt5-default


---Download source from the git repo and compile---

cd ~/
git clone https://github.com/audiotopix/Neutron.git


---Compile---

cd ./Neutron
cd ./src
sudo make -f makefile.unix
cp ./Neutrond ~/
mkdir ~/.Neutron
touch ~/.Neutron/Neutro
cd ~/


---Run Neutrond and create the config---

run neutrond and let it generate the rpc user and password to use in the Neutron.conf 

./Neutrond

setup the Neutron.conf

nano ~/.Neutron/Neutron.conf

copy in the following lines, please note you can get an updated addnode list at http://www.presstab.pw/phpexplorer/NTRN/nodes.php if this presents any issues.


daemon=1
server=1
rpcuser=(username created above)
rpcpassword=(password created above)
addnode=136.243.60.19:32001
addnode=212.73.150.46:32001
addnode=45.63.71.221:32001
addnode=108.45.164.191:32001
addnode=45.32.82.27:32001
addnode=45.76.134.160:32001
addnode=31.28.195.7:32001
addnode=94.156.35.222:32001
addnode=61.68.165.64:32001
addnode=149.202.98.160:3589
addnode=62.194.83.30:56355
addnode=85.175.216.200:37359
addnode=64.228.184.247:32001
addnode=84.200.7.221:58466
addnode=185.204.0.118:32001
addnode=108.61.205.103:32001
addnode=45.77.62.184:38222
addnode=45.32.130.166:55402
addnode=108.61.220.171:34766
addnode=104.238.184.213:41622
addnode=185.188.183.177:32001
addnode=52.62.73.64:62625
addnode=37.228.232.210:17060
addnode=107.167.226.44:62295
addnode=79.98.220.209:61554
addnode=69.172.182.66:59356
addnode=108.61.205.72:50180
addnode=49.3.203.75:34310
addnode=173.69.43.203:58451
addnode=45.76.91.140:42678
addnode=67.188.76.36:44189
addnode=24.211.254.63:55327
addnode=91.64.97.73:58513
addnode=45.32.114.128:42290
addnode=84.162.242.84:49488
addnode=114.144.15.106:43168
addnode=60.240.49.38:65528
addnode=85.236.191.153:55910
addnode=188.77.220.250:32001
addnode=84.200.92.232:46907
addnode=198.166.33.154:50749
addnode=76.64.87.241:52196
addnode=185.189.12.134:33752
addnode=50.71.170.246:55468
addnode=158.69.222.87:52659
addnode=84.200.7.221:34380
addnode=79.98.220.209:43847
addnode=162.219.178.82:59962
addnode=86.126.215.101:57422
addnode=185.204.0.39:34486
addnode=45.32.220.10:33600
addnode=45.63.79.156:54944
addnode=84.162.242.84:65293
addnode=84.200.92.232:46926
addnode=185.204.0.39:34778
addnode=54.166.168.230:32001
addnode=89.210.190.237:58709
addnode=54.252.235.217:49360
addnode=45.76.81.189:50931
addnode=84.200.92.232:46945
addnode=185.177.59.145:32001
addnode=81.162.194.236:39068
addnode=79.133.21.53:4217
addnode=130.255.12.3:65232
addnode=65.185.45.133:59789
addnode=130.255.12.2:11982
addnode=24.20.170.241:60506
addnode=23.120.208.254:53577
addnode=84.200.7.221:42440
addnode=190.131.157.225:49784
addnode=84.106.207.209:55473
addnode=110.175.30.212:62336
addnode=42.61.151.207:49630

run Neutrond again and wait for blockchain to sync

./Neutrond

you can basically check on the status of the sync by checking the size of blk0001.dat it is approx  563MB at the time of writing this. So check the filesize with the below command until you are convinced that the file size hasn't changed. Allow a few minutes between checks of the file as sometimes sync can stop for a while.

ls -la ~/.Neutron/Neutron.conf


---Some safety tips---

check bash history is not saving your commands when you type anything with a space preceding the command

nano ~/.bashrc

look inside the ~/.bashrc file for 

HISTCONTROL=ignoredups:ignorespace

if it exists then that's great otherwise you can add it anywhere in the file and Ctrl+x to save, you will need to reload bashrc with the following command:

. ~/.bashrc

So now this means that if you start typing a command that contains a password and just put a space in the front of the command as the first character then it will not save to history. i.e 

neutronuser@ubuntu:~/#ls -la            #this will save to history
neutronuser@ubuntu:~/# ls -la           #this will not save to history


---Wallet Security---

Encrypt Your Wallet

./Neutrond encryptwallet [SUPERSECRETPASSPHRASE]

Restart Neutrond as this will exit the wallet

./Neutrond

Unlock Wallet if you need to use any wallet functions

./Neutrond walletpassphrase [SUPERSECRETPASSPHRASE] 120

Get your Public Key/Payment Address

./Neutrond getaccountaddress 0

Backup your Private Key, either take a copy of ~/.Neutron/wallet.dat and storing it somewhere safe. You can also take your private key to keep somewhere, if you want the actual private key then do the following:

./Neutrond dumpprivkey [ACCOUNT-ADDRESS]

Download your wallet.dat using SCP from the command line or windows SCP GUI App. Below is how to download the wallet.dat from the VPS to your home directory on OSX:

 scp neutronuser@[VPS-PUBLIC-IP-ADDRESS]:~/.Neutron/wallet.dat ~/wallet.dat 

So the blockchain sync has completed? Lets move on.


---Generate a Masternode Key---

./Neutrond masternode genkey

copy this into the below [MASTERNODEKEY] field

the default port for the masternode is 32001 so use that or any other you like, just remember the firewall needs to be setup to allow TCP/32001 through

rpcallowip=127.0.0.1   
port=32001  
masternode=1  
masternodeaddr=[YOUR-PUBLIC-IP]:32001
masternodeprivkey=[MASTERNODEKEY]

add the above to Neutron.conf

nano ./.Neutron/Neutron.conf

 copy in the content above into this file with your substituted details and when you are done press CTRL+X then Y to save.


---Send your 25000 coins to the wallet address---

This MUST be in one transaction, if you store your funds on a desktop wallet it should add the fee on top of the amount you send, from an exchange you may beed to test with a small amount like 1NTRN to another address just to confirm how their fees work but more than likely from an exchange you need to add 0.01 to the total amount you want to send.

after you send your coins you can check on the server that they have been recieved by 

./Neutrond getbalance

you can check the transaction list by

./Neutrond listtransactions

Move on once you see your 25000 coins in the balance


---Start up the masternode---

Stop the daemon

./Neutrond stop

Restart the daemon

./Neutrond

Start the Masternode, if you encrypted your wallet then you will need to unlock it with

./Neutrond walletpassphrase [YOURSUPERSECRETPASSWORD] 120

Start up the masternode 

./Neutrond masternode start

if you did good then you should get a message "successfully started masternode"

to check your node is on the masternode list run the following.

./Neutrond masternode list

And..... You're done.

Note: I'll update this as i refine the process or if you have suggestions please let me know and ill update the guide.

Sort:  

Thank you for creating this resource for Neutron! NTRN's Future is bright...

Awesome! the neutrond is now underscore but other than that it was extremely helpful!