Masternode Setup

Configuring the Control Wallet

1. First, Download, Install, and Launch the Energi Core client.

The downloads can be found here: https://www.energi.world/downloads/

Launch the Energi client. You’ll then want to navigate to Settings > Options, and click the Wallet tab. Check the box for “Show Masternodes Tab”

You will need 10,000 NRG to set up a masternode. To do so, follow these steps:

Creating an Energi node Virtual Private Server

2. Create an Amazon Web Services Account

Sign up for a free account at aws.amazon.com

3. Start a virtual machine

You will need to start a t2.micro Ubuntu 16.04 instance in Amazon Web Services. This will be your virtual machine that hosts the masternode. To do this:

4. Create your Security Groups

In the EC2 Management Console, on the left, under the “Network & Security” dropdown, click Security Groups. We will be creating 2 separate security groups. For each security group, click “Create Security Group” and add two rules on the inbound tab.

One security group will open port 9797, and the other will open port 22.

Your security groups should look something like this:

and this:

Once you have your security group filled out correctly, click Create. Do this for both security groups.

5. Assign these security groups to your virtual machine instance.

On the Instances page, select your instance, then click the “Actions” dropdown menu and select Networking > Change Security Groups.

Make sure the Energi and SSH security groups you created are selected, and uncheck the default selection. Then click “Assign Security Groups”

You may then go back to the Security Groups page and delete the default security group that you unchecked.

6. Download SSH and SFTP software

Download Moba Terminal Software

This software will let you ssh and sftp to your virtual machine from your local computer.

Launch the software!

7. Click the session button and add a New SSH session.

The remote host should be your IPv4 Public IP (found in the description menu of your instance, in the instances tab in the Amazon EC2 Management Console).

The username is “ubuntu”, port is 22. Under the “Advanced SSH settings” tab, click “Use Private Key” and load the .pem file you saved in step 3 when you first set up the virtual machine. Then, click OK.

8. Click the session button and add a new SFTP session. Same settings as the SSH session.

9. Install the latest Ubuntu updates

In your SSH session, enter the following commands:
sudo apt update
sudo apt upgrade

10. Download the Linux version of the Energi wallet to your local computer.

Downloads Page

You should end up with a file named energi.tar.gz

11. In your SFTP session, drag and drop energi.tar.gz to your home directory on the virtual machine.

12. In your SSH session, enter this command to unpack the wallet:

tar -xvzf energi.tar.gz

13. In your SFTP session, edit the .bashrc file with MobaTextEditor.

At the very end of the file add this line:export PATH="${PATH}:${HOME}/energi/bin"

save and exit.

14. Log out of your SSH session, and log back in.

This will update the environment variables you just specified in the .bashrc file. To log out type exit, and then hit the R key to restart your session.

15. Test to see if everything is correct so far

To test if you’ve done everything correctly so far, enter this command: energi-cli

You should get an error message about shared libraries. We will install these next.

16. Install required dependencies to run a node

enter these commands:

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:bitcoin/bitcoin

sudo apt-get update

sudo apt install libboost-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libevent-pthreads-2.0-5 libminiupnpc10 libzmq5 libdb4.8 libdb4.8++

17. As a test, once again, enter this command:

energi-cli

This time, you should get a help menu, and no errors about missing dependencies. There will be a “Too Few Arguments” error after the help menu displays, this is normal.

Navigate back to your home directory. To do this, type the following command:

cd ~

Configuring your Masternode

18. Create the .energicore directory

in your home directory (/home/ubuntu), enter this command:

mkdir .energicore

19. Create the energi.conf file

Navigate to the .energicore directory in your SFTP session. In the .energicore directory, right click, and select “New empty file”. Name it energi.conf. Then, open the file with MobaTextEditor:

Enter these lines in your new energi.conf file:


rpcuser=[invent a energi rpc user name]

rpcpassword=[put a password here]

rpcallowip=127.0.0.1

listen=1

server=1

daemon=1

maxconnections=24

externalip=[your ec2 instance public ip]

masternode=1

masternodeprivkey=[your masternode private key]

20. Fill out the required fields in the energi.conf file

The rpcuser and rpcpassword fields can be anything you want. Make sure there are no brackets. Your externalip is the same public IP of your instance that you used to SSH and SFTP to. Once again, no brackets.

21. Obtain your Masternode private key

For your masternodeprivkey field, open up the debug console in your Energi wallet. Type in:

masternode genkey

Put the resulting key in the masternodeprivkey field (without brackets!) in the energi.conf file. You will also want to save and backup this key somewhere secure.

22. Obtain your account address

In the debug console of your Energi wallet, type in:

getaccountaddress 0

Save and backup this address somewhere.

Then, send exactly 10,000 NRG to this address.

23. Get your Masternode collateral transaction

Once again, in the debug console of your Energi wallet, type in:

masternode outputs

You will need to add the resulting information to your masternode.conf file in the next step

24. Edit your masternode.conf file

In your local wallet, edit C:\Users\YourUserName\AppData\Roaming
\EnergiCore\masternode.conf

Alias is any name you want, be creative!

IP:Port is your AWS instance public IP, and the port is 9797.

masternodeprivkey is your master node’s private key (obviously), the same key you used in the .energicore/energi.conf file, which you also should have saved from step 22.

For the collateral_output_txid and collateral_output_index, enter the information you got from the masternode outputs command in the previous step.

It should look similar to the example!

As you can see I have two masternodes listed. The masternode we are setting up for this tutorial is labeled brilla_masternode2

25. Start the Energi Core server

In your SSH session, from your home folder, enter the command:

energid

26. Restart your local Energi wallet.

Starting your Masternode

27. Wait for your Masternode to sync.

You can check the status by running this command in SSH: energi-cli mnsync status

When it’s syncing it will look something like this:

When it’s finished, it will look something like this:

28. Check the Masternode sync status in the control wallet

In the debug console on your local Energi wallet, run this command: mnsync status

You should see the same results.

Once you have 15+ confirmations on your collateral transaction, you’re ready to start your masternode.

29. In your SSH session, make sure your working directory is .energicore

30. Start your masternode!

Go to your local Energi wallet, and on the Masternodes tab, right click your masternode and select “Start Alias”

Feel the excitement.

31. Install Sentinel

Sentinel lets the network know that your masternode is still online and functioning correctly

Run the following commands:


git clone https://github.com/
energicryptocurrency/sentinel.git

cd sentinel

sudo apt install -y virtualenv

sudo apt install -y python-virtualenv

virtualenv venv

venv/bin/pip install -r requirements.txt

venv/bin/python bin/sentinel.py

32. Add a crontab

A masternode is required to be online for a minimum amount of time per day to be considered a masternode. This crontab will let the Energi network know about the status of your masternode every minute

in your SSH session, type:


crontab -e

select a text editor, and on the last line of the file, paste this:

* * * * * cd /home/ubuntu/.energicore/sentinel && ./venv/bin/python bin/sentinel.py 2>&1 >> sentinel-cron.log

press ctrl + X to save the file

33. Congratulations, you now have a working Masternode! To check the status, go to the Masternodes tab in your local Energi wallet.