Migrating nodes from your machine to a cloud server. Guide

Mystic
16 min readOct 19, 2019

--

In this guide, I will show you how to transfer your nodes to a cloud service avoiding the cost of renting during the first month. We will create the correct instance, copying the keys and free our PC or MAC from round-the-clock loading. This will allow our nodes to work offline.

The article was originally written for Windows users, but you can use it on Linux or MacOS as well by adjusting the instructions.

I will consider 2 cloud providers Vultr and GCP (Google Cloud Platform). Choose the one you like.

I. Option 1: Vultr

Registration

Register on the site. If you want to get a free $50 credit for 1 month, you must register using the link

Confirm your email address by following the link. Now you have to enter your card details. If you use a debit card, then the balance of the card must be positive.

Don’t forget to tick the box “I just want to link my credit card — $0.00 deposit”

Keep in mind that when the trial period ends, the loan balance will be withdrawn. If you do not delete the instance before this period, the fee for the working instance will be automatically billing from your card.

If you did everything correctly, then in the Billing — History tab you will see this:

Extras: if you complete 3 simple tasks on Twitter you will get + $ 3 more to your balance.

Video guide.

Creating instance

Let’s now create the correct instance. In the Products — Instanses tab, click the “+” — Deploy New Server

Choose Instance Type

Two instance types would fit: Cloud Compute and High Frequency.You can choose preferred location as well.

Choose Server Type. Select version Ubuntu 18.04 x64. It fits perfectly.

I recommend Server Size one of the two:

Cloud Compute: 2 CPU, 4 GB RAM, 80 GB SSD 3000GB Bandwidth $20/month

High Frequency: 2 CPU, 4 GB RAM, 128 GB NVMe SSD 3000GB Bandwidth $24/month

If you think that this is not enough — select the desired one. This will greatly affect the cost.

This instance is suitable ideal for 1 node. If you want to run more nodes on the same VPS use more powerful machines. In extreme cases, use 2 nodes at your own risk of losing uptime due to CPU overload.

Vult may notice that the CPU cores are running at 100% each and apply penalties to you in the form of reducing the power of each core by 50%. Then you will definitely not have enough 2 CPU and 4 Gb RAM for two nodes. Sanctions apply to the entire account.

Enter a name for the server

The rest of the settings we leave by default, except for the last one. We will give a name to our instance. You can choose any name without spaces.

Click “ Deploy Now” and wait a few minutes for the server to start.

Create Firewall Group

To avoid hacker attacks, create a firewall rule. Go to the firewall tab and click “Add Firewall Group”

Enter a name for the firewall group, e.g. BoN and click “Add Firewall Group” again.

Open the incoming port 22 for ssh connection “anywhere”. To do this, click “+” — add firewall rule.

Now click on the “Linked Instances” tab and click again “+” — Add Linked Instances.

Your instance should now be added to the firewall group and the number of linked instances should increment by 1.

Great! Now expand your instance by clicking on it.

You can see your IP Address and Password. We’ll need them for to connect to the instance remotely.

Connect to your Vultr Instance

If you are using Windows 7–10 you will need Git Bash.

Download and install Git Bash if you haven’t already installed it.https://gitforwindows.org

Run Git Bash. If you do not see the icon on the desktop — find it in the start menu (windows) in the “Git” folder.

Type the command:

ssh root@"NSTANCE IP ADDRESS”

Instead of “INSTANCE IP ADDRESS”, type the IP Address of your instance mentioned above. Just copy and paste this using the copy icon and to insert use the right mouse button.

Git Bash has one feature. Instead of the keyboard shortcut “Ctrl”+”V” to paste from the clipboard, the right mouse button is used. It works the same way. It’s worth getting used to. In the future, you will always have to work like this.

This works exactly the same as in CMD for Windows.

To the question “are you sure you want to continue connecting, answer “yes”

Copy and paste the password (it will not be visible) and press enter

Congratulations, we have now joined the instance remotely.

Before anything is recommended to update your system:

apt update && apt upgrade

Next, I will use the author’s scripts of the user Alwin 05. They are convenient both for new installation and for updating the version. Scripts will install the software Golang, Tmux and Screen in the desired directory and you do not have to conjure over their installation.

The scripts themselves will create the right number of nodes on a single instance and binaries to run these nodes in multithreaded mode.

I do not recommend installing more than 1–2 nodes on a single instance. It is better to use 1. At your own risk 2 nodes. If you have 6 nodes — create 3 or 6 instances. Or choose a more powerful machine.

Further installation you can make yourself using the manual Alwin05 in Medium:
https://medium.com/@haklander/run-and-maintain-one-or-multiple-elrond-nodes-in-ubuntu-18-04-5f5c9658e580

It explains in more detail when and what to do. Don’t forget to claps Alwin’s article. It’s really interesting.

Transferring keys from a computer to an instance

Let’s download first the Alwins scripts:

git clone https://github.com/ahakla/elrond-nodes.git

If you have previously run a node on your computer you must have validator keys.

Let’s create a temporary folder for transferring a key pair from a computer named “node1”:

mkdir -p ~/elrond_backup_keys/node1

If you already have validator keys, all you need is to put 2 key files (initialNodesSk.pem and initialBalancesSk.pem) to this folder.

If you will be running 2 or 3 nodes on this instance create more folders in this directory:

mkdir -p ~/elrond_backup_keys/node2

mkdir -p ~/elrond_backup_keys/node3

Now let’s put our real keys in these folders. To do this, run the second git Bash window.

To make it clearer, we will move our 2 key files from the “downloads” folder. These are files initialNodesSk.pem and initialBalancesSk.pem. The path to this folder in Windows is as follows: C:\Users\UserName\Downloads. Just make a copy of the 2 keys in the “downloads” folder using the standard tools of windows, macOS or Linux (depending on which operating system you have installed).

In the new git Bash window go to the downloads folder:

cd downloads

Type the commands:

scp initialBalancesSk.pem root@”Instance IPAddress”:~/elrond_backup_keys/node1scp initialNodesSk.pem root@”Instance IPAddress”:~/elrond_backup_keys/node1

“Instance IP Address” replace with your instance IP address.
We will also need to enter the instance password.

Now you can check if we copied our keys correctly to the node1 folder in the first window:

cd ~/elrond_backup_keys/node1ls

If everything is correct, then repeat this operation for the other keys, placing the next pair of keys in the folder “node 2”, “node 3”. It depends on how many nodes you want and how many key pairs you have. Do not forget to clear the “downloads” folder of previous keys before you transfer the next copy of the keys to it.

Editing the config file

Let’s go to the folder with scripts

cd ~/elrond-nodes

Run the nano-editor of the config file:

nano nodes_config.sh

Set the number of nodes you want to run in the parameter “NUMBER_OF_NODES=”

Name your nodes as you wish in the NODE_NAMES parameter. Replacing the values of “your_name” with any of your wildest fantasies

To move, use the arrows on the keyboard, to insert from the buffer-the right mouse button.

The use_keys parameter is needed to find your keys in the elrond_backup_keys folder. Replace the values with the first 12 characters of your initialNodesSk public key. So came up with Alwin05 and so it is more convenient for us than to enter the whole key entirely

You can open the key file in Notepad and copy the first 12 characters of the key after “- — — — — BEGIN PRIVATE KEY for” that is, from the second line.

Only the first 12 characters of “initialNodes” for each node. Keys must be separated by a space!

If you are doing the installation for the first time, replace values KEEPER_KEYS, KEEP LOGS_KEYS, KEEP STATS_KEYS, values to “(no no no)” for three nodes. For two nodes — “(no no)”. For one node — “(no)”, and the CLEANUP parameter=yes

Parameter KEEPDB_KEYS=(yes yes yes) — should be set only if you want to keep the old database — it will be useful in the future.

Save the changes in the editor by pressing “Ctrl+X” then confirm “y” and press enter.

Now run the node installation script:

bash install_nodes.sh

Confirm several times by pressing “y” and enter

Wait until the nodes are installed

Let’s check if our keys are still in the backup keys folder:

cd ~/elrond_backup_keysls

We see that folders have been created with a backup copy of our keys for each node. They contain our keys. We no longer have to download keys when upgrading. We also see temporary folders with our keys. They can already be removed:

rm -rf ~/elrond_backup_keys/node1
rm -rf ~/elrond_backup_keys/node2
rm -rf ~/elrond_backup_keys/node3
lscd ~/elrond-nodes

If the script worked without errors, go to section III at the bottom of the article.

II. Option 2: GCP

Registration

Go to https://cloud.google.com and click on “Get Started for Free”
If you haven’t used Google Cloud yet, you will get a $300 USD dollars credit for 1 year!

Register with e-mail address verification and enter your credit card details. If you use a debit card the balance must be at least $1.

Trial payment is a standard procedure when validate cards. With a successful payment, the funds will be returned to your card very quickly. But do not try to bind a virtual card — you will immediately receive a billing account lock. Only plastic!

If you receive an account block, you will need to pass KYC. You will be asked to send a photo of your passport or driver’s license and credit card showing the last 4 digits. Do this and approval will take a few minutes.

After successful registration of the billing account, on side tab click on “Compute Engine” and then in “VM Instances”.

Add this page to your favorites. This page we will then use often.

Click on the “Create” button to make a new instance.

Name your instance in lowercase letters. The instance name cannot be changed. Select the Machine type as “Custom” and set up 2 vCPU’s and 4GB RAM.

This instance ideal is suitable for 1 node. If you want to run more nodes on the same VPS use more powerful machines. In extreme cases, use 2 nodes at your own risk of losing uptime due to CPU overload.

If you will be running 2 nodes on a single instance, I recommend installing 8 GB RAM.

If the power of the CPU cores or the amount of RAM will not be enough, then you will be charged an additional fee for the overload in the triple amount.

Try to comply with the minimum requirements for nodes

Leave the rest of the default settings. But you can change them if you want. Increase only the volume of the boot disk to at least 30–200 Gb.

10 GB — this will not be enough and there will be a triple charge for additional resources

Click “Create”. Please wait a few minutes for running your instance

Create a Firewall Rule

If you do not plan to use another SSH client, you can safely skip this step. We can leave port 22 closed and use the browser console to connect to the VPS. It would be safer.

Click on “nic0” as shown below. In the next page click on “Firewall rules” and after that on “CREATE FIREWALL RULE”.

Come up with a name consisting of lowercase letters. Enter the values as shown below and click on “ Create”

Connecting to Instance

Go to the VM instances page. If you listened to me-it should be in your favorites.

To connect to the instance we will use the browser console. To do this, click on “ SSH”

Greetings! We connected remotely.

Let’s create a root user password. Type the command:

sudo passwd

When you enter the password it will be hidden.

Come up with and enter a password. Confirm the password.

Remember or save the password in a safe place.

To log in as root user, enter:

su

Then enter the password.

Before anything is recommended to update your system:

apt update && apt upgrade

Now install Git:

sudo apt update && sudo apt install git curl -y

Next, I will use the author’s scripts of the user Alwin 05. They are convenient both for new installation and for updating the version. Scripts will install the software Golang, Tmux and Screen in the desired directory and you do not have to conjure over their installation.

The scripts themselves will create the right number of nodes on a single instance and binaries to run these nodes in multithreaded mode.

I do not recommend installing more than 1-2 nodes on a single instance. It is better to use 1.

2 nodes — at your own risk. If you have 6 nodes — create 3 or 6 instances. Or use more powerful machines.

Further installation you can make yourself using the manual Alwin05 in Medium:
https://medium.com/@haklander/run-and-maintain-one-or-multiple-elrond-nodes-in-ubuntu-18-04-5f5c9658e580

It explains in more detail when and what to do. Don’t forget to claps Alwin’s article. It’s really interesting.

Transferring keys from a computer to an instance

Go to the main directory by typing the command:

cd

Let’s download first the Alwins scripts:

git clone https://github.com/ahakla/elrond-nodes.git

If you have previously run a node on your computer you must have validator keys.

Let’s create a temporary folder for transferring a key pair from a computer named “node1”:

mkdir -p ~/elrond_backup_keys/node1

If you already have validator keys, all you need is to put 2 key files (initialNodesSk.pem and initialBalancesSk.pem) to this folder.

If you will be running 2 or 3 nodes on this instance create more folders in this directory:

mkdir -p ~/elrond_backup_keys/node2
mkdir -p ~/elrond_backup_keys/node3

Now let’s load our keys into these folders.

In the upper right corner of the console there is a gear icon. Click on it and select “Upload file” and upload initialBalancesSk. After the upload is finished, click “ Close”. Then in the same way upload initialNodesSk.

By default, files are downloaded to the user’s folder. Let’s go into this directory:

cd /home/”YOUR USERNAME”

Usually the “USERNAME” is the first half of your e-mail address without “@gmail.com”. Replace the value.

Let’s check if we loaded the keys correctly:

ls

If you did everything correctly, you will see 2 key files

Now move these keys to the “node1” folder:

cp initialBalancesSk.pem ~/elrond_backup_keys/node1cp initialNodesSk.pem ~/elrond_backup_keys/node1

Ready! The keys to start the first node have been moved to the temporary folder “node1”.

Now repeat this operation for each node. But first remove the unnecessary keys from the user folder:

rm initialBalancesSk.pemrm initialNodesSk.pem

Place the key pair for node 2 in the “node 2” folder, for node 3 in the “node 3” folder.

Editing the config file

Let’s go to the folder with scripts:

cd ~/elrond-nodes

Run the nano-editor of the config file:

nano nodes_config.sh

Set the number of nodes you want to run in the parameter “NUMBER_OF_NODES=”

Name your nodes as you wish in the NODE_NAMES parameter. Replacing the values of “your_name” with any of your wildest fantasies.

To move, use the arrows on the keyboard. To copy, use “Ctrl+C”, to paste “ Ctrl+V”.

The use_keys parameter is needed to find your keys in the elrond_backup_keys folder. Replace the values with the first 12 characters of your initialNodesSk public key. So came up with Alwin05 and so it is more convenient for us than to enter the whole key entirely

You can open the key file in Notepad and copy the first 12 characters of the key after “- — — — — BEGIN PRIVATE KEY for” that is, from the second line.

Only the first 12 characters of “initialNodes” for each node. Keys must be separated by a space!

If you are doing the installation for the first time, replace values KEEPER_KEYS, KEEP LOGS_KEYS, KEEP STATS_KEYS, values to “(no no no)” for three nodes. For two nodes — “(no no)”. For one node — “(no)”, and the CLEANUP parameter=yes

Parameter KEEPDB_KEYS=(yes yes yes) — should be set only if you want to keep the old database — it will be useful in the future.

Save the changes in the editor by pressing “Ctrl+X” then confirm “y” and press enter.

Now run the node installation script:

bash install_nodes.sh

Confirm several times by pressing “y” and enter

Wait until the nodes are installed

Let’s check if our keys are still in the backup keys folder:

cd ~/elrond_backup_keysls

We see that folders have been created with a backup copy of our keys for each node. They contain our keys. We no longer have to download keys when upgrading. We also see temporary folders with our keys. They can already be removed:

rm -rf ~/elrond_backup_keys/node1
rm -rf ~/elrond_backup_keys/node2
rm -rf ~/elrond_backup_keys/node3
ls
cd ~/elrond-nodes

III. Starting the nodes. Monitoring. Updating.

To start the nodes using Tmux, type the command:

bash start_nodes_tmux.sh

Your nodes are running in standalone mode. To see the node1 panel:

tmux a -t node-01

For node 2 use:

tmux a -t node-02

And so on.

To exit this mode, use the keyboard shortcut “Ctrl+B” then “ D”. Use the English keyboard layout.

After you exit monitoring mode, your nodes continue to work. You can close the SSH console and shut down the computer. Your nodes are now running in the cloud.

Updating

When it’s time to update the version for your nodes enter the commands:

cd ~/elrond-nodes
tmux kill-server
bash install_nodes.sh
bash start_nodes_tmux.sh

To quickly restart nodes without updating, type:

tmux kill-server
bash start_nodes_tmux.sh

To quickly restart only one node on a multi-node VPS, use the “Ctrl+C” hotkeys in the node-specific dashboard. Then press the up arrow key on your keyboard to go to the last node start command and press “ Enter”

What if there are no keys?

You can use the built-in key generator. To do this, set the node names and their number in the editor, and leave the 4 parameters with empty values =().
For example you want to create 3 nodes and keys for them:

NUMBER_OF_NODES=3 
USE_KEYS=()
KEEPDB_KEYS=()
KEEP LOGS_KEYS=()
KEEP STATS_KEYS=()
Set CLEANUP=yes

Do not forget to save the changes “Ctrl+X”, then “y”, enter

Run the script with these values:

bash install_nodes.sh

Keys are generated automatically.

Copy all values to a text file. When you open registration for the next round, fill out the form: https://forms.gle/grGpqAy519GihZjJ8

and enter these keys. In the next round, your status will change from Observer to Validator.

Conclusion

This article is mainly aimed at beginners in Linux. I tried to explain in detail what each team does. I hope the article will be useful for anyone who is preparing itself for mainnet.

Some of the values of the translation may seem strange to you. It’s because I don’t speak English at all. I hope y’all forgive me for that. Below will be useful links for all Testnet Elrond members. Thanks for your claps! Good luck!

Elrond

Elrond forum

Elrond community

Battle of Nodes

Explorer/validators

Leaderboard Battle of Nodes

Telegram/ElrondValidators

Riot room

--

--