Step 2: Setting Up Your Node

GateOmega
7 min readJul 18, 2022

--

The Common Question
First of all let’s start with answering a very common question.
- Question: I have a spare computer. Can I run my node from home?
- Answer : In short, maybe it is technically possible, but it is NOT a good idea.

Home environment is not suitable for data centers such as stable internet connection, electricity and cooling. So, the most convenient (and affordable) way is to rent a VPS (Virtual Private Server) or Dedicated Server from a good service provider such as Hetzner.

How to rent a Server from Hetzner?

If you already don’t have an account from Hetzner, you need to register first. Go to https://www. hetzner.com web site. To register, click on the Cloud/Robot button from dropdown menu on the login button.

Click on the “Registration Now” button and the next section type your email address and create a strong password. To complete verification, check your mailbox for an email that Hetzner has sent you. In the email, click on the activation link to activate Hetzner account and continue with the registration process. Enter your personal and contact information, choose your desired payment method to complete registration.

You’re ready to rent a server that you need!

Hardware Requirements for StakeWars III.

Based on the minimum hardware requirements in StakeWars-III, the best option in Hetzner is Dedicated Root Server AX41-NVMe.

You can reach this server from the Hetzner Robot section. You can find all other options on the “Ordering” tab on the menu if you need a server with different configurations.

After clicking on the “Order product”, you will be given the options to choose locations, IP addresses, operating system, additional drives, add-ons and number of servers.

Choose the location that you want from the Location Section and Ubuntu 20.04.3 (HWE) LTS minimal from the Operating systems without pre-install control panel. You can leave the other sections as they are. Click on the “add to shopping cart” button to continue.

In the next section(picture above), you will see your configurations in brief and server login details. In server login details, you will have two options. If you select “Password” as your authentication method, a randomly generated password will be sent to you via email when the server is ready. If you specify your public SSH key, you can log in to the server without a password using your private key. Although specifying SSH Key is more secure way, we will continue with password option for simplicity.

Choose “Password” and click on “Save” to proceed and to view your current order status before “Checkout”.

Lastly, check to accept Terms and Conditions and click on “Order in obligation”. You will get a randomly generated password via email when your server is ready. Probably in minutes!

Total Cost for renting Dedicated Root Server AX41-NVMe from Hetzner is between 34€ — 40€ for the specification below. This cost may be change for the location you choose.

Now it’s time to connect your server!

Connecting to your server

You need a client software installed on your computer to remotely connect and manage your new server. Putty is the favorite app if you have a Windows computer. If you have a Mac, Termius is a good option. They are both free.

We will show instructions for Putty in this guide. Download and install Putty to your computer.

  1. Create shortcut to your server within Putty.
  2. Ensure that your node is kept alive while you work by changing above settings.

Check CPU Compatibility

Let’s start checking if your server meets the required CPU feature. Run the following command and check if output is “Supported”. If so, there is no problem and you can proceed with the guide.

You should see “Supported” as Output message.

Initial Setup of your server

First of all let’s install all available patches and updates of Ubuntu. This will take couple of minutes:

Create a new user for your Near Node

Root is the most powerful account of Linux. But it should not be used for day to day operation for security of your node. So let’s create a new user.
You may name your node and add new password as you wish considering those are aligned with security requirements (i.e. strong password and uncommon user name).
Grant sudo permission to this new user, so that it can run commands that require root privileges when needed (without connecting with root user).

Another security best practice is to prevent remotely login with root.
To do that, open the sshd_config file with the nano text editor, and change the line PermitRootLogin yes to no.

Press Ctrl + O and Enter to save. Press Ctrl + X to quit from nano.

IMPORTANT!
Run the following command in order to take the change effect. Please note that you will not be able to login with root user anymore. But that is ok, since you have the user near with sudo capability.

Wait a couple of minutes and reconnect to your server, but this time login with the user near (not with root).
Now your server is ready for Near challenges. You have done very well so far. Let’s proceed with the first challenge, it is easier than you think!

Setup NEAR-CLI

Now it is time to go back to our server. Run Putty and connect your server with the account near. Before installing NEAR-CLI we need to install its requirements. Run following commands one by one :

To check NEAR-CLI is properly installed, run the below commands and check the outputs if they are as shown in this guide. Please note that you will not be able to see your validator until you complete the next step!

‘near proposal’ output:

‘near validators current’ output:

‘near validators next’ output:

Install required software & set the configuration

Run the following commands one by one:

You will see the following:

Type 1 and press enter.

Source the environment and clone from Github

Run the following commands:

Compile nearcore binary

Compile Nearcore binary by running the below command. It will take a while.

Initialize working directory

Generate the initial required working directory by running the below command:

This command will create the directory structure and will generate config.json, node_key.json, and genesis.json on the network you have passed.

  • config.json Configuration parameters which are responsive for how the node will work. The config.json contains needed information for a node to run on the network, how to communicate with peers, and how to reach consensus. Although some options are configurable. In general validators have opted to use the default config.json provided.
  • genesis.jsonA file with all the data the network started with at genesis. This contains initial accounts, contracts, access keys, and other records which represents the initial state of the blockchain. The genesis.json file is a snapshot of the network state at a point in time. In contacts accounts, balances, active validators, and other information about the network.
  • node_key.json A file which contains a public and private key for the node. Also includes an optional account_id parameter which is required to run a validator node (not covered in this doc).
  • data/ A folder in which a NEAR node will write it’s state.

Replace the config.json

Get latest snapshot

Important: Not required to get snapshot after hardfork on Shardnet during 2022–07–18

Install AWS Cli

Run the node

Follow below commands to run the node and wait for sync to complete.

Check if your node sync.

If you see output like [“syncing”: false], your node is successfully synced.

Well done! You set up your node.
Now let’s proceed with the Step 3: Activating Your Node as Validator

--

--

GateOmega
GateOmega

Written by GateOmega

Gate Omega is a new start-up company based in Turkey. We are a team of 6 and currently focusing on disruptive and innovative crypto projects .

No responses yet