Skip to content

Instantly share code, notes, and snippets.

@mikeytown2 mikeytown2/Energi.md Secret
Last active Jul 1, 2019

Embed
What would you like to do?

Table of Contents

  1. Quick Guide
  2. Masternode Guide
  3. Linux QT Wallet Install
  4. Troubleshooting / FAQ
  5. Appendix
  6. Energi Tip Address


Quick Guide

On your VPS run this to get the full line for masternode.conf on your desktop.

bash -ic "$(wget -4qO- -o- raw.githubusercontent.com/mikeytown2/masternode/master/energid.sh)" ; source ~/.bashrc

O and o are both the letter and not the number if you are typing this out.
Bitvise is highly recommended in order to use copy/paste (for windows).
You can view the script here https://raw.githubusercontent.com/mikeytown2/masternode/master/energid.sh. At the prompts press enter to use the defaults (recommended). You can run the script mutiple times using a different IP address ($2 extra per month) to have mutiple masternodes running on the same box.



Masternode Guide

What you need:

  • A Ubuntu 16.04 OR 18.04 Virtual Private Server (VPS) for running the masternode
  • A way to use SSH (Bitvise for windows or Terminal for Mac)
  • Energi Wallet (Windows, Mac, Linux)
  • 10,000.1 NRG Coins (the extra 0.1 is for fees)
  • A single VPs can run mutiple masternodes if it has mutiple IPs.
  • Help can be found on the Discord chat. BE CAREFULL; only trust help via the ticket support system. Usernames are not unique on discord so only trust green, yellow, blue, and red users (people with roles) in the Energi Discord server.
Info needed from VPS masternode:

bash -ic "$(wget -4qO- -o- raw.githubusercontent.com/mikeytown2/masternode/master/energid.sh)" ; source ~/.bashrc
Run this on a VPS to generate the following values.
Or if you already ran the script run this to get the values and you forgot to copy the values.
enrg_mn1 masternode.conf

  • alias
  • IP:port
  • masternodeprivkey
Info needed from Energi wallet:

Help -> Debug Window -> Console from the toolbar and type in masternode outputs at the bottom

  • txhash
  • outputidx

Open up a text editor like notepad; this will be used to copy various bits of text to.

1.0 Wallet Prep.

Enable coin control features and Show Masternodes Tab. In the desktop wallet go to Settings -> Options -> Wallet (Energi -> Preferences -> Wallet on Mac) and make sure Enable coin control features and Show Masternodes Tab is checked and click OK.

2.0 Send Collateral.

Make sure your wallet contains atleast 10,000.1 Energi Coins (the extra 0.1 is for any fees).
In your wallet go Settings -> Unlock Wallet (if you haven't encrypted you wallet you can skip this step). Create a new Address called mn1 by going to File -> Receiving addresses -> + New -> Type in mn1.

Copy the mn1 address and go to send tab. In "Pay To:" paste in the address and send exactly 10000 in a single transaction; no more, no less; exactly 10000.

2.5 Get txhash.

Go to the Transactions tab and right click on the transaction and select Copy transaction ID

You cab also get the transaction ID by going to Tools -> Debug Console and typing in masternode outputs and press enter.

Paste this value (txhash, it's long) to the top of notepad. At this stage notepad should look like this.

x64xcharxlongxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

3.0 Next you'll need a VPS.

Any VPS provider will work; in this example vultr will be used. Get a VPS from here https://www.vultr.com/?ref=7876413-4F

Once signed up go here https://my.vultr.com/deploy/

  1. Choose Server
  2. Select a location
  3. Select Ubuntu 18.04
  4. Select $3.50
  5. Click deploy now button

Once deployed (wait 2 minutes)

3.4 Get vps IP.

Click the Cloud Instance link on the left or the Manage link on the right

Under IP click the copy icon copy icon

3.5 Connect to the VPS.

Windows

Click here to read Windows SSH instructions


Open up Bitvise and paste in the IP of your VPS into the Host field under Server on the left side. To the right of that in the Username field put in root and change Initial method to password Go back to the vultr Server Information page and under password click the copy icon copy icon

Then in the Bitvise SSH client program under Password paste in the password from vultr. Finally click the login button

Click Accept and Save for host key verification


Mac

Click here to read Mac SSH instructions

Finder -> Menubar (top of screen) -> Go -> Utilities. Open Terminal. Type in
ssh root@ and then go to the menu bar and select edit -> paste (the IP address).
The authenticity of host 'x.x.x.x (x.x.x.x)' can't be established. ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxx. Are you sure you want to continue connecting (yes/no)? yes Type in yes here
root@x.x.x.x's password:
Go back to the vultr manage webpage and under password click the copy icon copy icon

Back on the Terminal screen paste in the password and press enter.


4.0 VPS Steps

Copy the following line and paste into your remote terminal and press enter (right click to paste in Bitvise) (How to connecto to your VPS (3.5)).

bash -ic "$(wget -4qO- -o- raw.githubusercontent.com/mikeytown2/masternode/master/energid.sh)" ; source ~/.bashrc  

O and o are both the letter and not the number if you are typing this out.
Bitvise is highly recommended in order to use copy/paste (on windows).
You can view the script here https://raw.githubusercontent.com/mikeytown2/masternode/master/energid.sh

Paste in your txid from notepad (right click to paste in Bitvise) when it asks How to get the txhash (2.5)

Press Enter at the prompts to use the defaults.

If setting up more than one master node, simply re-run the script if you have a 2nd IP; or get a new VPS and run the script on your second one.

4.1 Script will end with
  • Auto starting energid daemon running under the newly created user
  • The long string to paste into your masternode.conf file.


(Highlight to copy in Bitvise)

If you messed up and want to start over with a fresh VPS instance go to https://my.vultr.com/ click on the three dots to the right ... and select Server Reinstall.

5.0 Add string to masternode.conf

the script will output the full string to paste into the masternode.conf file. Go to Tools -> Open Masternode Configuration File and paste in the big string on a new line in the masternode.conf file. This is an example; there are only 4 spaces total, this is important.

enrg_mn1_vultr.guest 1.2.3.4:9797 X51xCHARSxLONGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX x64xcharxlongxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0

Save and close masternode.conf.

6.0 Start Masternode

Restart the desktop wallet. Go to Masternodes tab (enable it here 1.0 wallet prep). Unlock wallet if it is locked. Select the new masternode and press the start alias button.

You can also run masternode start-alias enrg_mn1_vultr.guest in the desktop console to start the masternode; replace the ending alias with the name of the masternode alias. Get the list of aliases by running masternode list-conf.

Make sure the status says "Enabled"; on the vps you should see Masternode enrg_mn1 successfully started!. If you just transferred to the mn1 address you'll need to wait for it to be confirmed before you can start the Masternode; this is 16 blocks. If you get a minus uptime restart the daemon on the VPS by typing in enrg_mn1 restart, and then start the masternode alias again. If the negative uptime continues try restarting the vps; note that minus time will happen if 16 blocks have not passed. The masternode active timer in the wallet will start after 15 minutes.

Click here for an explanation of the values used to create a masternode

The first 3 values come directly from the Virtual Private Server. The Alias is a value used to let you know what this masternode should be called in your wallet; this can be set to anything as long as there are no spaces in it. The Address is the IP and Port of the VPS. masternodeprivkey is how the masternode running on the VPS knows instructions given to it are valid; it's like a password for the masternode software running on the VPS. The txhash & outputidx come from the blockchain. It's the transaction ID from the transfer of required collateral to the mn1 address.



Linux QT Wallet Install

Get the latest Ubuntu release https://github.com/energicryptocurrency/energi/releases/latest

Install required libraries

if ! grep -Fxq "deb http://archive.ubuntu.com/ubuntu/ xenial main restricted" /etc/apt/sources.list
then
  echo "deb http://archive.ubuntu.com/ubuntu/ xenial main restricted" | sudo tee -a /etc/apt/sources.list >/dev/null
fi
if ! grep -Fxq "deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted" /etc/apt/sources.list
then
  echo "deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted" | sudo tee -a /etc/apt/sources.list >/dev/null
fi
if ! grep -Fxq "deb http://archive.ubuntu.com/ubuntu/ xenial universe" /etc/apt/sources.list
then
  echo "deb http://archive.ubuntu.com/ubuntu/ xenial universe" | sudo tee -a /etc/apt/sources.list >/dev/null
fi
if [[ $( grep -r '/etc/apt' -e 'bitcoin' | wc -l ) -eq 0 ]]
then
  echo | sudo add-apt-repository ppa:bitcoin/bitcoin
fi
sudo DEBIAN_FRONTEND=noninteractive apt-get update -yq

sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq \
  libboost-system1.58.0 \
  libboost-filesystem1.58.0 \
  libboost-program-options1.58.0 \
  libboost-thread1.58.0 \
  libboost-chrono1.58.0 \
  libevent-2.0-5 \
  libevent-core-2.0-5 \
  libevent-extra-2.0-5 \
  libevent-openssl-2.0-5 \
  libevent-pthreads-2.0-5 \
  libminiupnpc10 \
  libzmq5 \
  libdb4.8-dev \
  libdb4.8++-dev \
  libprotobuf9v5 \
  libqrencode3 \
  libqt5core5a \
  libqt5network5 \
  libqt5gui5 \
  libqt5widgets5

Then run energi-qt



Troubleshooting / FAQ

Do I need multiple IPs to run multiple masternodes on a single VPS?

You will need multiple IPs; rerun the script to setup a another masternode on your VPS once you've followed the directions on how to add another IP to your VPS.

How do I add an IP to vultr?

Click here to see how to do so

Login to Vultr and go to the server's infromation page

Go to the settings page and click on "Add Another IPv4 Address"

Once done go to the networking configuration page

Login to VPS and edit the /etc/netplan/10-ens3.yaml file using nano
nano /etc/netplan/10-ens3.yaml

Remove all lines from this file using ctrl + k

Copy the configuration and paste it into the nano text editor (right click is paste in Bitvise)


Press ctrl + x to exit

press y and enter to save

Run netplan apply to apply the changes to the vps

You can verify that the new IP has been added by looking for the new IP in the output of this command
ip -o addr show

Can I run a masternode on my home computer?

Technically yes. You need a static IP from your ISP as well as a way to open up the port that your masternode is running on in your router. A VPS is easier to setup and run.

How do I backup my wallet?

Make sure it's been encrypted with a password and then store the wallet.dat file on Dropbox or Google Drive. Make sure the cloud backup provider has 2 factor authentication enabled (Google, Dropbox). On windows the wallet can be found in the %appdata%/energicore directory (windows key + r %appdata%/energicore and if that doesn't work try %userprofile%\AppData\Roaming\energicore). On Mac it can be found in the ~/Library/Application Support/EnergiCore directory; Finder -> Menubar (top of screen) -> Go -> Utilities, open Terminal, type in open ~/Library/Application\ Support/EnergiCore.

You can also backup via dumpprivkey. Go to tools -> debug console and type in listaccounts; then for each address name type in getaddressesbyaccount ""; then do dumpprivkey on that address like so dumpprivkey Exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. The output from this can be used to steal your coins, and also used for backup purposes. Be careful!

You can also backup via dumpwallet. Go to tools -> debug console and type in dumpwallet enrg.txt. enrg.txt is usually put in the same folder as the energi wallet executable.

How do I recover a deleted wallet.dat

Download Recuva: https://www.ccleaner.com/recuva/download/standard
Once you install run it and select all files

Search in the
C:\Users\username\AppData\Roaming\EnergiCore
folder replaceing username with the correct path.

Check enable deep scan

Wait for it to scan your harddrive and then look for any files with wallet.dat in the name.

My VPS got restarted and now my masternode is not running.

You need to start the Masternode again. Unlock the Wallet. Energi - Wallet -> Masternodes -> Start MISSING. It should be running again.

Wrong amout is shown in coin control features.

Send all coins from addreses that have a wrong amount so that the value in thoese are zero. Restart wallet.

Edit masternode.conf

Tools -> Open masternode configuration file.

If the above doesn't work you can do this:
Windows:
windows key + r
nodepad %appdata%/energicore/masternode.conf
Copy Paste the above line into the run dialog box.
and if that doesn't work try
windows key + r
nodepad %userprofile%\AppData\Roaming\energicore\masternode.conf

Mac:
go to Finder -> Menubar (top of screen) -> Go -> Utilities, open Terminal, type in
open -a TextEdit ~/Library/Application\ Support/EnergiCore/masternode.conf
If you already have a terminal window open and want another one, go to the Menubar (top of screen) -> new window -> new windows with profile - basic. Then paste in the above command.

Edit energi.conf

Tools -> Open wallet configuration file.

If the above doesn't work you can do this:
Windows:
windows key + r
nodepad %appdata%/energicore/energi.conf
Copy Paste the above line into the run dialog box.

Mac:
go to Finder -> Menubar (top of screen) -> Go -> Utilities, open Terminal, type in
open -a TextEdit ~/Library/Application\ Support/EnergiCore/energi.conf
If you already have a terminal window open and want another one go to the Menubar (top of screen) -> new window -> new windows with profile - basic. Then paste in the above command.

How to double check all details of the masternode

Close and open your desktop wallet. Tools -> Debug Console and type in masternode outputs at the bottom. Also go to Tools -> Open Masternode Configuration File. Connect to your VPS and run these commands as the root user. Replace enrg_mn1 with the username used for the masternode if needed.
enrg_mn1 masternode.conf

Carefully comapre the IP, the masternodeprivkey, as well as the transaction id and output index.

Remove user from VPS

The following example uses the username enrg_mn9.

enrg_mn9 remove_daemon

I've been locked out of the VPS

You get one of these errors when trying to login via Bitvise:
"Network error: Connection timed out"
"Network error: Software caused a connection abort"

Go here to get your IP address: http://ipinfo.io/ip. Then you'll need to login to the box via the "view console" button on the vultr manage page. once logged in type this in

denyhosts_unblock YOUR.DESKTOP.IP.ADDRESS

Replace "YOUR.DESKTOP.IP.ADDRESS" with the nubers found on http://ipinfo.io/ip

Energi Website

https://www.energi.world/

Coinmarketcap

https://coinmarketcap.com/currencies/energi/

Block Explorer

https://explore.energi.network/

3rd party Monitoring service

https://masternodes.online/monitoring/
https://masternodeonline.com/

List of very cheap VPS - Use at your own risk!

https://www.arubacloud.com/vps/virtual-private-server-range.aspx - €1 a month.
https://vrtz.net/type/yearly/ - List of cheap providers.
https://aws.amazon.com/free/ - 1 year of free hosting; EC2 is hard to setup.



Appendix

Useful commands to run as root on your VPS:

Check mn status:
enrg_mn1 masternode status

View config file:
enrg_mn1 conf

Get string to put into masternode.conf:
enrg_mn1 masternode.conf

Check version:
enrg_mn1 getinfo

Check the mnsync status:
enrg_mn1 mnsync status

Check if mn has been started remotely:
enrg_mn1 masternode debug

Verify the block count of your masternode and the explorer are the same:
enrg_mn1 blockcheck

Daemon status:
enrg_mn1 status

Start daemon:
enrg_mn1 start

Stop daemon:
enrg_mn1 stop

Restasrt daemon:
enrg_mn1 restart

Get connection count:
enrg_mn1 getconnectioncount

Get block count:
enrg_mn1 getblockcount

Get blockchain info:
enrg_mn1 getblockchaininfo

Rename the daemon on the VPS:
enrg_mn1 rename enrg_mn3

Check system log of the daemon on the VPS:
enrg_mn1 system_log

Check daemon log on the VPS:
enrg_mn1 daemon_log

Reindex daemon block db:
enrg_mn1 reindex

Run the same command on all masternodes:
all_mn_run blockcheck
all_mn_run masternode debug

Get all the pubkey's for https://masternodes.online/monitoring/
all_mn_run masternode status | grep '"addr"' | awk '{print $2'} | tr -d '",'

How to watch a command:
watch -x bash -ic '. ~/.bashrc; enrg_mn1 getinfo'
watch -x bash -ic '. ~/.bashrc; enrg_mn1 daemon_log | tail'
watch -x bash -ic '. ~/.bashrc; enrg_mn1 mnsync status'
watch -n 0.4 -x bash -ic '. /root/.bashrc; enrg_mn1 getblockchaininfo'



NRG Tip Address

EfQZJxx86Xa2DqzP9Hdgv7HQe1MtYzQpDC



@ramlalchavan

This comment has been minimized.

Copy link

commented Dec 25, 2018

Nice airdrop

@kiranpawar1

This comment has been minimized.

Copy link

commented Dec 25, 2018

Good project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.