Staking on VPS


VPS Staking



WARNING! Be extremely cautious in asking for help setting up a VPS to stake your Energi. Do NOT install TeamViewer or any screen sharing software. Do NOT respond to messages or e-mails from anyone offering support, even if they appear to be legitimate. Scammers can appear indistinguishable from our moderators, community leaders, and Energi Core staff. Do NOT run any “dump” commands in the debug console for anyone! Energi Core staff and moderators will NEVER ask for your personal info, passwords, private keys, or instruct you to run any “dump” commands. Your coins are YOUR responsibility. BE CAREFUL!



With your Energi wallet on your home computer or laptop, you must leave it on all of the time in order to receive the maximum amount of staking rewards. In this guide we will learn how to set up a VPS (Virtual Private Server) to ensure your wallet will always be staking. That way you will be able to access your funds and spend them via your local wallet on your computer, but also have that same wallet on the cloud 24/7 for staking purposes.

Note: It’s technically possible to earn NRG with staking just 1 NRG but currently, it will take 2.6 years to get 1 NRG.

1. Edit your local energi.conf



Since you will be staking your NRG on a cloud server 24/7, there is no need to have staking enabled on your local wallet. Also, it is impossible to stake the same wallet more than once, so before we begin we will have to disable staking for your local wallet. To do this, navigate to your EnergiCore folder on your local machine, and add staking=0 to your energi.conf file.

On Windows, it’s in C:\Users\username\AppData\Roaming\EnergiCore

On Mac, it’s in /Users/username/Library/Application Support/EnergiCore

On Linux, it’s in /home/username/.energicore





2. Encrypt your wallet.dat file



Next, once your wallet software is up and running you will want to make sure it is encrypted with a strong password or pass phrase. Click Settings on the menu bar at the top of the wallet, and select Encrypt Wallet...



Some dialogue boxes will pop up asking you to confirm your choice. Once you’ve confirmed, the software will shut down and encrypt the wallet.



3. Relaunch the wallet



You should notice in the lower right corner there is a small green lock icon indicating your wallet is encrypted. This step is very important for the security of your funds, as you will be copying your wallet.dat file to the cloud server.





4. Setup a VPS cloud server



There are many options available. I prefer Vultr.

NOTE: If you do not have a Vultr account, please use my referral link to sign up: Vultr.com/?ref=7513475

Choose a server location closest to you for less latency:



For this guide we will be using 64-bit Ubuntu version 18.04, so select the 64-bit version of Ubuntu 18.04.

Choose the server size with 1024 MB (1 GB) of Memory. On Vultr this comes with 25 GB of storage, 1 CPU and 1000GB bandwidth, for $5 per month, which is more than enough for our needs.



Leave the additional features section blank. Also, this guide will not use any startup scripts, so leave that alone as well.

OPTIONAL: You can choose to set up an SSH key to make it easier to securely log into your server. Click add new and follow the tutorial for creating an SSH key. This step is optional, but recommended. Using an SSH key to login is not only easier than using a password, but much more secure.

Enter a hostname and label for your server and click Deploy Now



Wait for your server to install. It should only take a few minutes.



You will receive an e-mail confirming that your server has been created, with information on how to access it remotely.





5. Connect to your server



You can open a console window within Vultr or use any SSH (secure shell) software to connect. If you’re using Windows, I recommend PuTTY. Download psftp.exe while you’re there as you will need an SFTP client to upload your wallet.dat file to the server.



On Mac and Linux both ssh and sftp already come with the system: just open a terminal and type ssh [vultr server ip address].

ssh 144.202.73.194

If you are using PuTTY, enter your server’s IP address, make sure SSH and Port 22 are selected and click “Open”:



You may get a security alert about the server’s rsa2 key fingerprint. Just click yes to trust the server and connect via SSH.



Enter your username (root) and password found on your server information page on my.vultr.com



Once you log on, you should change your password:

type passwd





6. Create a new user account



Now, you will want to make a non-root sudo user to run your Energi software.

Type adduser [newusername] The adduser program will walk you through the process of setting up a new user account.

then, type usermod -aG sudo newusername to add that user to the sudo group:



Type exit to end your SSH session, and then reconnect as your new user:





7. Update your server



In the console, type the following commands to update your server:

sudo apt update
sudo apt upgrade


Enter “Y” for yes to continue with the system update. It may take a few minutes to install everything.





7. Install the required dependencies



In the console, type the following commands to install the dependencies:

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:bitcoin/bitcoin

Press [ENTER] to continue adding the packages

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.1-6 libminiupnpc10 libzmq5 libdb4.8 libdb4.8++

Enter “Y” for yes to continue…



8. Install Energi



Download and install the Energi software on your server

Make sure to copy the link to the most recent Linux version found here: energi.world/downloads. This tutorial was written using version 2.1.2

Then, in your console run the wget command followed by the link to the file:

wget https://s3-us-west-2.amazonaws.com/download.energi.software/releases/energi/v2.1.2/energicore-2.1.2-linux.tar.gz



Once downloaded, enter this command to unpack the wallet:

tar -xvzf energicore-2.1.2-linux.tar.gz

TIP: On the command line, you can type a partial filename, and then hit the [TAB] key to autocomplete. This comes in handy for long filenames. If there is more than one option, it will display them in a list.

Then, move/rename the wallet directory to energi

type mv energicore-2.1.2 energi

TIP: use the ls command to list the contents of the directory you’re currently working in. Here, you can observe that the archive file energicore-2.1.2-linux.tar.gz was unpacked into a directory named energicore-2.1.2, and then we used the mv command to move it to energi, effectively renaming it:





9. Update your Environment Variables



Open your ~/.bashrc file with nano, a text editor:

nano ~/.bashrc

Use your arrow keys to arrow down to the end of the file, and add these 2 lines:

export PATH="${PATH}:${HOME}/energi/bin"

unset HISTFILE

Press ctrl X (or command X on Mac) to save. Enter “Y” and press [ENTER] to confirm.



Then, type exit to log out of the console. Log back in via SSH to update your environment variables that you’ve just specified in .bashrc

In the console, type the following command:

rm ~/.bash_history

Test that the Energi Core software has been installed correctly. In the console, type the following command:

energi-cli

If everything is installed correctly, you should get a help menu, and no errors about missing dependencies. There will be a too few parameters error after the help menu displays. This is normal.



10. Create the .energicore directory and energi.conf file



From your home folder (/home/username), create the .energicore directory:

mkdir .energicore

cd .energicore/

nano energi.conf

Then, add these lines to your energi.conf file:

daemon=1
rpcallowip=127.0.0.1
rpcuser=user (alphanumeric only)
rpcpassword=password (alphanumeric only)



Once again, press ctrl X (or command X on Mac) to save. Enter “Y” and press [ENTER] to confirm.



11. Copy your encrypted wallet.dat file to the server



Use sftp to copy your local wallet.dat file (containing the NRG you want to stake) to the server. Make sure you have encrypted the wallet before doing this!



NOTE: You will need to specify the exact location, or absolute path of your wallet.dat file, unless you first navigate to the directory where that file resides. Make sure to replace username with your actual user name.

On Windows, type put C:\Users\username\AppData\Roaming\EnergiCore\wallet.dat

On Mac, type put /Users/username/Library/Application Support/EnergiCore/wallet.dat

On Linux, type put /home/username/.energicore/wallet.dat

TIP: The shorter command in the screenshot, put wallet.dat, which uses a relative path will only work if your working directory contains the wallet.dat file. To ensure this, you can either copy and paste your wallet.dat to the location of psftp.exe or move psftp.exe to your EnergiCore folder.

Verify that your .energicore folder contains the energi.conf file you just setup as well as the wallet.dat file you just uploaded





12. Adjust your permissions



type the following command:

chmod -R go= ~/.energicore

(this removes group and other permissions so only the owner of that folder can read those files)



13. Bootstrap your Full Node!



Make sure you are still working within your .energicore directory and type these commands:

wget https://www.dropbox.com/s/gsaqiry3h1ho3nh/blocks_n_chains.tar.gz?dl=1 -O energiblocks

tar -xvzf energiblocks

NOTE: This will download and unpack the blockchain files to your server much more quickly than letting it sync from scratch!



14. Start your Full Node!



In the console, type energid to start the server. You will have to wait hours for it to sync, unless you bootstrapped it in the previous step. You can check the status by running this command on the server: energi-cli mnsync status

Wait for it to say “MASTERNODE_SYNC_FINISHED





15. Enable Staking



type the following command:

energi-cli walletpassphrase password 999999999 true

password” should be the password you used to encrypt your wallet.dat file.

999999999” is how many seconds the wallet should remain unlocked for staking.

true” at the end means “unlock for staking only”… this is VERY IMPORTANT, as without it the wallet would be fully unlocked for spending as well…



16. Verify that your wallet is currently staking



type energi-cli getstakingstatus



Congratulations! You are now staking Energi on a cloud server 24/7… Way to go!