July 20, 2022

NEAR: Bootstrapping with at a speed of light

In ValiDAO our main emphasize is repeatability and standardization of the node installation process. Thus we are always creating an ansible playbook to install a node. And u know, usually I am always in doubt, if we are overcomplicating things for nothing? But for NEAR ya, it was worth it. The network has restarted twice already, and I love it, it means that the team is testing things, searching for bugs and vulnerabilities. And our playbook was reused 3 times to re-create a node from scratch because there was already a number of hard forks.

So, in this article I'm going to explain how to use our ansible playbook instead of just following instruction from official NEAR's github. This article assumes you knowledge of ansible and that you have it installed.

The first step is to checkout our repo:

git clone https://github.com/ValiDAO/nodes.git

Change the directory:

cd nodes/near

And run the scenario:

ansible-playbook -l your-server.fr install.yml

Once it is ready, your server has a node setup and running, but at the moment it is not connected to your wallet. So the next step is to register on https://wallet.shardnet.near.org/ . Once it is there, return back to your node and run:

source ~/.bashrc && near login

This will give you the link, which you should enter to your browser, allow your wallet to sign it, and once it is ready, you will see a browser redirected to 127.0.0.1 and giving an error. It is all as expected, don't worry. Return back to the terminal and put your login to the terminal (e.g. validao.shardnet.near). Once done, some extra steps need to be done. We intentionally haven't automated them, as human supervising and check is important on this stage.

./near_create_pool.sh

It will do everything automatically, but will ask you to confirm everything it does. So, if everything is good, press Enter.

./near_stake.sh

This will stake some coins to your pool. The script will ask you for amount. Insert something like 350 and press Enter.

Actually that's it! Congratulations.

There are some helper scripts which are included to the playbook as well:

near_restart_after_hardwork.sh it does exactly what it says. Prepares your node to restart after a cluster hardfork.