Masternode setup guide (manual)

🚧

Disclaimer

We've added the NodeValet scripts: https://www.heliumlabs.org/v1.0/docs/masternodes-with-nodevalet (with GUI) or https://www.heliumlabs.org/v1.0/docs/masternodes-with-the-one-master-script (without GUI) that fully automate everything and are especially useful if you want to set up multiple masternodes in one server. This guide is for those who want to understand more details about the technical side of things.

This is a guide for setting up a Helium masternode using the so called hot-cold set up. We will use a VPS with Ubuntu 16.04 for the remote masternode while keeping the collateral coins safely in your local wallet. You can set a masternode up on your local machine but this is less convenient, less economical and less secure, and therefor not recommended. This guide was written using a 1GB Ubuntu 16.04 VPS on IPv4.

You can of course also use an install script or have a 3rd party host your node (see Resources at the bottom of this guide) but doing it yourself is fun and teaches you a lot about what's going on.

For installing multiple Masternodes on one VPS we recommend you use the Nodemaster script instead.

Step 1: prepare your local wallet

For the purpose of this guide we'll assume you downloaded the Helium wallet from an official source (website, github or OP on bitcointalk) and succesfully installed it. Find a guide on how to do this here: link TBA

A Helium masternode requires 1000 coins as collateral. These coins need to be in a single transaction for it to work. In your local wallet, click Tools and click Debug Console.

In the Debug console, enter masternode genkey and it will return, for example:

892WPpkqbr7sr6Si4fdsfssjjapuFzAXwETCrpPJubnrmU6aKzh.

This is your masternodeprivkey and you will need this later. So save it.

Still in the debug console enter getaccountaddress "masternode_alias" You can replace "masternode_alias" with anything you like. I'll call mine MN1 for the purpose of this tutorial. So: getaccountaddress MN1, in my case, returns: SNWvmLg8rn5wCmPCed7LwaCN5iKAiTye2J and that is the collateral address for my masternode.

Now we'll need to send exactly 1000 Helium to the address we just created. If you are withdrawing from an exchange, make sure to take any fees into account. This transaction will some confirmations before we can continue so we'll use that time to set up our VPS.

Step 2: prepare the VPS and install the software

For the purpose of this guide we'll also assume you'll figure out how to make an account with a VPS provider such as DigitalOcean, Linode or Vultr. You will not need anything fancy. A 1GB VPS with Ubuntu 16.04 will do the trick. If your VPS provider allows you to set up SSH keys with installing, do it. SSH login is far more secure and convenient than using a password.

If you do use a root password. Make sure it is long and random. A 24 character password from random.org does the trick. If you don't set a difficult password your VPS will be hacked within hours and added to a botnet. While nobody can steal your coins your VPS will be used for all kinds of nefarious activities and you'll run into a bill for excess bandwidth from your VPS provider.

Check Slack for referral links for free credit with VPS providers.

Now that your VPS is on line you'll need to access it. For Linux and Mac users this can be done through the terminal. Windows users need Putty, enable an extra feature in Windows or another SSH client.

Assuming you successfully logged in to your VPS we'll first make sure everything is up to date, make a new user, double check, set up the firewall and add some virtual memory.

Update everything:

apt-get update -y && apt-get upgrade -y

Add a new user, give it privileges and change user. Choose your own username and set a secure password. You can accept defaults and confirm with y:

adduser bruno
adduser bruno sudo
su bruno
cd

Make sure git, autogen and ssh are installed:

sudo apt-get install git autogen openssh-server -y

Set up the firewall and answer y at the prompt:

sudo ufw default allow outgoing
sudo ufw default deny incoming
sudo ufw allow 9009
sudo ufw allow 22
sudo ufw enable

Add virtual memory (only needed on a <2GB VPS):

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Your VPS is now ready and secure. However, there are a lot more things you can do to harden it and make it more resistant to DDOS attempts. Check RzeroD's guide on how to do that here.

There are two ways to install Helium. By building it from source (A) or by downloading the binaries (B). Choose either one.

A: Build Helium from source

sudo git clone
cd helium/
sudo add-apt-repository ppa:bitcoin/bitcoin -y
sudo apt-get update

sudo apt-get install build-essential libtool automake autotools-dev autoconf pkg-config libssl-dev libevent-dev libboost-all-dev libprotobuf-dev protobuf-compiler libdb4.8-dev libdb4.8++-dev -y

sudo ./autogen.sh
sudo ./configure --disable-tests --with-unsupported-ssl
sudo make
sudo make install

The sudo make part can take up to half an hour. If you are installing on a multi-core machine you can try sudo make -j4 (for 4 cores) instead which will significantly speed everything up. You can continue with step 3 while it is working as long as you don't forget to run the sudo make install command before you proceed to step 4. Else just grab a coffee and wait for it to finish.

B: Download the binaries:

wget

Step 3: configure your local wallet

For your masternode to communicate with your wallet and vice versa we will need to make some changes to their respective configuration files.

We'll assume you still have your local wallet open and by now the 1000 Helium transaction we made earlier should have enough confirmations.

Open your Debug console and enter:

masternode outputs

The return will look like this:

"txhash": "8ba8caae2670bb38d43fb609e31a337d4d7b4fd4544f93b8cc3b8b3426409",

We will need these two values so save them.

Now open the masternode.conf file in a text editor. It is located in the client's data directory:

Linux: ~/.helium
OSX: ~/Library/Application Support/Helium or ~/.helium
Win: %Appdata%/Helium

You can also edit it through the client. Click Tools then Open Masternode Configuration File

There is an example in there which you can remove. Everything should be on a single line and the file should be made to look exactly like this:

MN1

-The name (masternode_alias) you gave your masternode
-The IP and port of the VPS
-The masternodeprivkey from step 1
-The first value from masternode outputs
-The second value from masternode outputs

So:

<masternode_alias> <VPS_ip_adress:port>

Save the file and open the helium.conf file which is conveniently located in the same folder. You can also open it from the client by clicking Tools and Open Wallet Configuration File.

Make it look like this:

rpcuser=long random username
rpcpassword=longer random password
rpcallowip=127.0.0.1
listen=0
server=1
daemon=1
logtimestamps=1
maxconnections=256

Save this file too. Close your client and restart it.

Step 4: configure the masternode

Assuming the sudo make and sudo make install from step 2 were succesful, we will now change the helium.conf file on the masternode as well. On your VPS, enter:

sudo mkdir ~/.helium
cd ~/.helium
sudo nano helium.conf

This will bring up a text editor. Make the file look like this:

rpcuser=long random username
rpcpassword=long random password
rpcallowip=127.0.0.1
listen=1
server=1
daemon=1
logtimestamps=1
maxconnections=256
masternode=1
externalip=31.14.135.27
bind=31.14.135.27
masternodeaddr=31.14.135.27:9009
masternodeprivkey=892WPpkqbr7sr6Si4fdsfssjjapuFzAXwETCrpPJubnrmU6aKzh

Change the IP addresses after externalip= ,bind= and masternodeaddr= to the IP of your VPS. Change the value after masternodeprivkey= to your own masternodeprivkey from step 1.
This guide assumes your masternode is directly internet facing. If it is behind a router the IP after bind= should be the internal IP.

Press Ctrl+X to exit and press y and Enter to save.

Step 5: start the masternode

We'll now start up the Helium client on the VPS and start the masternode:

sudo heliumd -daemon

This will start the client. Give it a minute to boot up properly before checking if its working:

helium-cli getinfo

This will return a long list of random information. Before continuing we need to make sure we are synced so check if the value of blocks: (blockheight) is the same as in your wallet. If it isn't: wait.

When the masternode is properly synced on the VPS. leave it open and go to your local wallet. Make sure your wallet is unlocked. Click the Masternodes tab and click Start alias. Click Yes on the pop-up and another pop-up will appear that says Sucessfully started masternode., in the overview you'll see status: ENABLED

To make sure we'll check on the masternode itself too. On your VPS, enter:

./helium-cli masternode status

This should return something along the lines of:

{

If all of this worked: awesome.

If it didn't: join us in #masternodes and we will help you fix it.

I did something wrong and now I'm confused

At pretty much any point in this tutorial you can retrace your steps. If all else fails: reboot will restart your VPS. You can log back in after a few minutes and with su USERNAME and cd you'll be in the home directory and you can pick up from there.

Multiple masternodes

You can set up multiple remote masternodes using the same local controller wallet. The steps for every extra masternode are virtually identical to what is described above. Mind you that when using this guide you will need 1 VPS instance per Masternode. It is easier and more cost efficient to use the Nodemaster install script.

For every new masternode you will to make a new collateral address with getaccountaddress and make a new masternodeprivkey with masternode genkey

After you send the next 1000 HLM to your new collateral address you will notice that masternode outputs now shows a list. The most recent output should be on top so just pick the txhash and outputidx that you haven't already used.

For every masternode make a new entry on a new line in masternode.conf

You will see every masternode you create this way show up in the Masternodes tab.

When making multiple 1000HLM transactions to yourself to serve as collateral. The wallet might reuse the one transaction to make the next. You can prevent this from happening by either setting up the nodes 1 by 1 or by locking the coins in coin control:

Settings>Options>Wallet>Enable coin control features. Access it under the Send tab

Stop the masternode

The 1000 Helium used as collateral for your masternode is locked by the wallet. You can still make transactions from the wallet but it will not let you send the 1000 Helium used as collateral.

To stop your masternode (and unlock the coins) login to your VPS. Change user, go to your Helium folder with cd and cd ~/helium/src and stop the masternode with ./helium-cli stop. Then, on your local machine, open the masternode.conf file, empty it, and save it. After you restart the wallet your coins will be available.

Testnet

You can use this guide to set up a masternode on testnet also. But there are a few minor things that need to be changed.

Add testnet=1 to both the local helium.conf file and the remote helium.conf file. Also, use port 19009 (testnet port) rather than 9009 (mainnet port) when configuring the firewall on the VPS and in the local and remote helium.conf files.

On your local machine: use the masternode.conf file located in the /testnet4 folder in your data directory rather than the 'normal' one.

Resources

Helium website: www.heliumchain.org

Community website: www.heliumlabs.org

Helium community on Discord: TBA (#help for technical support)

Since most Dash/PIVX based masternodes work more or less the same you can find answers to common questions, problems and errors by googling. Please do this first before asking for help :)

Cryptotron's install script for Helium masternodes: https://github.com/cryptotronxyz/heliumnode

Nodemaster install script for Helium masternodes (allows multiple nodes on single VPS with IPv6): https://github.com/heliumchain/vps (with big thanks to Moonshot)

3rd party Helium masternode hosting providers: https://nodesupply.com, https://www.node-vps.com and www.manohosting.com offer hosted Masternodes for Helium

Helium github: https://github.com/heliumchain/helium

The Digital Ocean Community has an enormous amount of information and tutorials regarding VPS' and Ubuntu in general.

@RzeroD was kind enough to write a comprehensive guide for hardening Linux servers. You can find it here. If someone wants to take out your masternode they will. But the harder you make it the more likely it is they'll pick a easy target instead.