Creating and Executing the Avalanche Network Node in Minutes with Minimal User Intervention

This tutorial aims, in a practical and objective way, to create your node to make it validate the Avalanche network by using the shell script (bash) that will install AvalancheGo on your virtual machine by configuring a full node in minutes with minimal user intervention, backing up your node, updating your node with each upgrade of the Avalanche mainnet, checking your node’s health, and finally staking by validating your Avalanche network node.

AVALANCHE NETWORK CREATION

The minimum requirements for running an Avalanche node were obtained in

Below is the list of minimum requirements:

# Operational system

https://docs.avax.network/build/tutorials/nodes-and-staking/run-avalanche-node#requirements

# Hardware

https://docs.avax.network/build/tutorials/nodes-and-staking/run-avalanche-node#requirements

# Software

https://www.sudo.ws

# AvalancheGo Version

# Avalanche Wallet

  • You must have at least 2,000,001 AVAX to become an Avalanche network validator, with 2,000 AVAX being the minimum to become the Avalanche network validator plus the 0.001 AVAX fee for the AVAX tokens transfer transaction from your address X -CHAIN ​​to your P-CHAIN ​​address.

In this tutorial we will use Cloudjiffy, a cloud service provider, in order to implement the programming language to create and run an Avalanche network node.

CLOUDJIFFY

Register on Cloudjiffy by clicking on the image below:

After completing your registration, you will have to configure your payment information and pre-load your balance with cash. Make a deposit of at least US$ 10 to use the Cloudjiffy service. I recommend enabling automatic recharge.

After completing your deposit, create your virtual machine. Follow the steps below:

1- Click on “NEW ENVIRONMENT”, as shown in the image below.

2- Now we will configure your virtual machine in the “GO Lang” tab, which has the initial screen below.

3- Click on VPS, as shown in the image below.

4- Choose Ubuntu 20.04, as shown in the image below.

5- Double click on GO, as shown in the image below.

After you double click on “GO” the image will look like this.

6- Click on “OFF”, as shown in the image below.

After clicking “OFF” the image will look like this.

7- Click on “GO”, as shown in the image below.

After clicking “GO” the image will look like this.

8- Click on “Ubuntu”, as shown in the image below.

After clicking on “Ubuntu” the image will look like this.

9- Insert 30 cloudlets, as shown in the image below.

10- Click “OFF”, as shown in the image below.

After clicking “OFF” the image will look like this.

11- After completing the configuration above, click on “Create”, as shown in the image below.

After a few minutes your virtual machine will be successfully created!

Port 9651

To ensure that your connectivity to the Avalanche network is optimized and uninterrupted, you will want to update port 9651. Follow the steps below:

1- Click on “Settings” of your virtual machine env-1563667 , as shown in the image below.

After clicking on “Settings” the image will look like this.

2- Click on “Firewall”, as shown in the image below.

After clicking on “Firewall” the image will look like this.

3- Click on “Inbound Rules”, as shown in the image below.

After clicking on “Inbound Rules” the image will look like this.

4- Click on ‘Add’, as shown in the image below.

5- Fill in the fields, as shown in the image below and click on “Add”.

After clicking “Add” note that port 9651 has been configured, as shown in the image below.

Finally, click on the “x” to close “Settings”, as shown in the image below.

SCRIPT INSTALLATION

The shell script (bash) will install AvalancheGo on your virtual machine by configuring a full node in minutes with minimal user intervention. Follow the steps below:

Click on your virtual machine, as shown in the image below.

Then, click on the Elastic VPS Web SSH icon (black window), as shown in the image below.

Next, we observe the session in which we will introduce the command lines for the creation of your Avalanche network node, as shown in the image below.

We must periodically check if there has been an update to the version of the Avalanche mainnet node . In case of updating, we must replace the two command lines that contain the old version of the node to suit the latest version of the Avalanche mainnet node . To check the latest version of the Avalanche mainnet node click on the image below:

The command sudo- which, in fact, is a native Linux utility - is certainly one of the best known among system users. It allows you to configure the privilege levels of each user of a machine, deciding who can make profound changes to the computer (that is, an administrator) and who is authorized to simply use it as an “ordinary” person.

We should periodically check for an update to the Sudo command version. In case of updating, we must replace the two command lines that contain the old version of the node to suit the latest version of the Sudo command. To check the latest version of that command click on the image below:

Install thesudoin version v1.9.5p2 that fixed the bug that existed for over a decade. The bug in question was registered by the code “2021–3156” and allowed an attacker with physical access to the computer to escalate privileges, obtaining superuser privileges without the authorization of an administrator. To correct the flaw, just make sure you have the latest version of sudo installed on your Linux distribution. To do this, you must update your Sudo system or package to fix this security hole. Enter - copy and paste - the command line below into the Elastic VPS SSH web session (black window) and press enter:

sudo apt update && sudo apt upgrade

At the command line that is asked Y(yes)or N(no), type o Y, and press enter.

Another option is to use the command wgetto install that version. Insert - copy and paste - each command line and successively “enter”, line by line, until the last command line, in the Elastic VPS Web SSH session (black window), in the following order:

sudo wget https://www.sudo.ws/dist/sudo-1.9.5p2.tar.gz

Then, verify that version v1.9.5p2 of the command has sudobeen installed. Enter - copy and paste - the command line below into the Elastic VPS SSH web session (black window) and press enter:

ls -ltra

Install tmux. It is a terminal multiplexer. In other words, it means that you can start a Tmux session and then open multiple windows within that session. Tmux sessions are persistent, which means that programs running on Tmux will continue to function even if you are disconnected . Insert - copy and paste - each command line and successively “enter”, line by line, until the last command line, in the Elastic VPS Web SSH session (black window), in the following order:

sudo apt-get install tmuxtmux new -s avalanche

Note : If you have logged out , to retrieve the information entered so far, open a new SSH Web session , enter — copy and paste — the command line below into the Elastic VPS Web SSH session (black window) and press enter:

tmux attach -t avalanche

Then, duplicate the session and enter — copy and paste — the command line below into the Elastic VPS SSH web session (black window) and press enter:

tmux new -s avalanche

Install the command curlwhich is a command line utility to transfer data to or from a remote server. With curl, you can download or send data using one of the supported protocols, including HTTP, HTTPS, SCP, SFTP and FTP. To install the command, curlenter - copy and paste - the command line below in the Elastic VPS SSH web session (black window) and press enter:

sudo apt install curl

Install package dnsutilswhat contains a collection of utilities (such as the dig command that is required in the script) to query DNS name servers for information about Internet hosts. These tools will provide IP addresses for certain host names, as well as other information about registered domains and network addresses. To install, package dnsutilsenter - copy and paste - the command line below in the Elastic VPS SSH web session (black window) and press enter:

sudo apt install dnsutils

At the command line that is asked Y(yes)or N(no), type o Y, and press enter.

Download and run it by scriptentering - copy and paste - the command line block into the Elastic VPS SSH web session (black window) and hit enter:

wget -nd -m https://raw.githubusercontent.com/ava-labs/avalanche-docs/master/scripts/avalanchego-installer.sh;\
chmod 755 avalanchego-installer.sh;\
./avalanchego-installer.sh

Next, we observe the session after the introduction of the command lines to execute scriptwhat will install AvalancheGo on your virtual machine by configuring a full node in a matter of minutes with the minimum of user intervention, as shown in the image below.

Type 2and hit enter, as your virtual machine has a static IP.

Type nand hit enter if your IP is wrong or is not automatically detected. Otherwise type yand hit enter.

Enter the Internet Protocol IP(include numbers and periods) for your virtual machine. To do this, check the email received from Cloudjiffy, as shown in the image below.

Enter IP(include numbers and periods) and hit enter.

Next, we observe the session after completing the introduction of the command lines, as shown in the image below.

Ready! The script was successfully completed, as shown in the image below.

SCRIPT POST-INSTALLATION

AvalancheGo must run in the background as a service. Check if it is working by entering — copy and paste — the command line and hit “enter”:

sudo systemctl status avalanchego

Note that it active (running)indicates that the service is working well, as shown in the image below.

If it’s necessary, press ctrl+Cwhen you want to exit the verification of the AvalancheGo execution.

ctrl+C

To find your NodeID, which is used to identify your node to the Avalanche network, enter — copy and paste — the command line and hit “enter”:

sudo journalctl -u avalanchego | grep "node's ID"

Next we look at the session after introducing the command line to find out NodeIDwhich one will inform your Avalanche network node. In this example, we observe the following:

Jan 05 10:38:38 ip-172–31–30–64 avalanchego[2142]: INFO [01–05|10:38:38] avalanchego/node/node.go#428: Set node’s ID to NodID-6seStrauyCnVV7NEVwRbfaT9B6EnXEzfY

In this example, the NodeIDis as follows:

NodeID-6seStrauyCnVV7NEVwRbfaT9B6EnXEzfY

Make a note of your nodeID , as it will be necessary for you to stake the AVAX token.

Your node should now be in the bootstrap process. You can monitor progress by entering — copy and paste — the command line and hit “enter”:

sudo journalctl -u avalanchego -f

Below we look at the session after introducing the command line to monitor the progress of the boot process, as shown in the image below.

Press ctrl+Cwhen you want to stop monitoring the progress of your node's bootstrap process.

ctrl+C

Next, we observe the session that the monitoring of the progress of the bootstrap process of your node was stopped, as shown in the image below.

Remembering that when the node is started, it needs to follow the rest of the Avalanche network. Wait until the node completes the initialization with the Avalanche network, as soon we must make sure that the node has made the initialization.

Below we see that the bootstrap was completed successfully, as shown in the image below.

Then, duplicate the session and enter — copy and paste — the command line below into the Elastic VPS SSH web session (black window) and press enter:

tmux new -s avalanche

To check if the node was initialized in the Avalanche network, enter — copy and paste — the command line block in the Elastic VPS Web SSH session (black window) and press “enter”:

curl -X POST --data '{ 
"jsonrpc": "2.0",
"method": "info.isBootstrapped",
"params": {
"chain": "X"
},
"id": 1
}' -H 'content-type: application / json;' 127.0.0.1:9650/ext/info

If this command block returns “ true ”, the chain has been successfully initialized.

BACKUP OF YOUR AVALANCHE NETWORK NODE

Before updating your Avalanche network node it is recommended to back up your staker files, which are used to identify your node on the network. In the standard installation, you can copy them by entering — copy and paste — each command line and hit “enter”, successively, line by line, until the last command line, in the following order:

cdcp ~/.avalanchego/staking/staker.crt .cp ~/.avalanchego/staking/staker.key .

Check if the files have been downloaded by entering — copy and paste — the command line and hit “enter”:

ls -ltra

Then download the files staker.crtand staker.keykeep them in a safe and private place. To do this, you will have to transfer your files from Ubuntu to Windows. Follow the steps below:

On the virtual machine install openssh-server by entering — copy and paste — the command line and hit “enter”:

sudo apt-get install openssh-server

After installing openssh-server, download the FileZilla program on your computer with a Window operating system and, finally, open it. To download the FileZilla program click on the image below:

Now we will create FTP/FTPS support in Jelastic on your CloudJiffy virtual machine, in order to download the files staker.crtand staker.keyto your computer.

The file transfer protocol (FTP) is a standard network protocol used to transfer files from one host to another over a TCP-based network. FTP is built on a client-server architecture and uses separate control and data connections between the client and the server. For secure transmission that hides (encrypts) the username and password and encrypts the content, SSL-protected FTP (FTPS) is used. Unlike HTTP, the FTP protocol is stateful: you establish a control connection during an FTP session that normally covers multiple data transfers. We will use FTP in Jelastic to upload/download files.

To use FTP with Jelastic, meet the following three requirements:

  • have the FTP client installed (for example, FileZilla) on your computer with a Window operating system.
  • have the node on your virtual machine.
  • have the public IP for the node in your virtual machine.

From this moment on we will add FTP to your Jelastic environment. Follow the steps below:

1- CREATION OF THE JELASTIC ENVIRONMENT

1.1- Click on “NEW ENVIRONMENT” to create the Jelastic environment, as shown in the image below.

1.2- Click on the following sequence (from 2.1 to 2.60, as shown in the image below).

1.2.1- “JAVA”

1.2.2- “Tomcat”

1.2.3- Insert “30” cloudlet (s)

1.2.4- Click “ON” in Public IPv4

1.2.5- Enter a name for the Jelastic environment. In this example, “ftp-feature” was inserted

1.2.6- Finally, click on “Create”

Next, we observe the successful creation of the Jelastic environment, as shown in the image below.

2- FTP INSTALLATION

2.1- Click on the “Add-Ons” button to access the list of all available applications to add to your Jelastic environment, as shown in the image below.

2.2- Next, find the FTP application, as shown in the image below.

2.3- Click on “Install” in the FTP application field, as shown in the image below.

2.4- After clicking on “Install”, some information will appear, as shown in the image below.

2.5- Click on “Install”, as shown in the image below.

2.6- The FTP package is being installed, as shown in the image below.

2.7- The FTP package was successfully installed, as shown in the image below.

3- USING FTP

3.1- After completing the configuration of the Jelastic environment, access the Cloudjiffy email containing the data that will be used for insertion into Filezilla, as shown in the image below.

3.2- Open the Filezilla program.

3.3- Then, insert the data contained in the Cloudjiffy email into the Filezilla program, as shown in the image below.

  • Host = IP obtained from Cloudjiffy email
  • Username = Login obtained from Cloudjiffy email
  • Password = Password obtained in the Cloudjiffy email
  • *Port = 22

*SSH is a communication protocol that allows you to establish an encrypted remote session with a host on a computer network. The standard communication port used by the SSH protocol is 22.

3.4- After entering the data above, in the Filezilla program click on “Quick connection”.

Now that your virtual machine has been connected, you can easily transfer files from Windows to Ubuntu or Ubuntu to Windows using the Filezilla program.

Keep the files staker.crtand staker.keyin a safe and private place. If something happens to your node, these files can be used to fully recreate your node from the Avalanche network.

RECOVERY OF YOUR AVALANCHE NETWORK NODE

To recover your old node, after creating a new node, just give the command to stop the new node (it does not need that the new node has completed the initialization — bootstrap). Then replace the files on the new node with the files on the old node (staking.key and staking.crt files). Finally, give the command to restart your node in order to recover your old node.

AVALANCHE NETWORK NODE UPDATE

Before updating your Avalanche network node, check the current version of your node by entering — copy and paste — the command line block and press “enter”:

curl -X POST --data '{ 
"jsonrpc": "2.0",
"id": 1,
"method": "info.getNodeVersion"
}' -H 'content-type: application / json;' 127.0.0.1:9650/ext/info

AvalancheGo is an ongoing project and there are regular version updates. Most updates are recommended, but not required. It is always recommended to update to the latest version, because new versions bring bug fixes, new features and updates. To update your node, run the script by entering — copy and paste — the command line and hit “enter”:

./avalanchego-installer.sh

It will detect that you already have AvalancheGo installed. Then, it will update its node to the latest version and, once completed, it will start the node to follow the rest of the Avalanche network and inform the latest version, as shown in the image below.

Now we should check if you have successfully upgraded your Avalanche node to the latest version of Mainet . To do so, duplicate the session and enter — copy and paste — the command line in the Elastic VPS SSH web session (black window) and press “enter”:

tmux new -s avalanche

Then check the current version of your node by entering — copy and paste — the block of command lines and hit “enter”:

curl -X POST --data '{ 
"jsonrpc": "2.0",
"id": 1,
"method": "info.getNodeVersion"
}' -H 'content-type: application / json;' 127.0.0.1:9650/ext/info

If it is the current version of the Avalacnhe network node, the answer should be as follows, as shown in the image below.

Remembering that the latest version of the Avalanche Mainet can be checked by clicking on the image below:

If the update has been successfully completed, the latest version of the Mainet of your Avalanche network node will be displayed.

AVALANCHE NETWORK NODE HEALTH

To check the health of the node , enter — copy and paste — the command line block in the Elastic VPS Web SSH session (black window) and press “enter”:

curl -X POST --data '{ 
"jsonrpc": "2.0",
"id": 1,
"method": "health.getLiveness"
}' -H 'content-type: application / json;' 127.0.0.1:9650/ext/health

If the node is “healthy”, the answer should be as follows, as shown in the image below.

Also, observing the response, we can verify the uptime of the node, which is fundamental for receiving rewards in AVAX tokens, as shown in the image below.

Thus, the uptime, in this example, will be approximately 98.81%, higher than the 80% online node, to be maintained by the validator for the time corresponding to the validation staking period.

AVALANCHE NETWORK NODE UPTIME

Another way to identify that uptimeof a specific validator, that is, the% online time of the node, is through the command platform.getCurrentValidators. Check which is uptimeyour node's by entering - copy and paste - the block of command lines and hit "enter":

curl -X POST --data '{
"jsonrpc": "2.0",
"id" : 1,
"method" : "platform.getCurrentValidators"
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P | jq . - | grep -15 enter_here_your_NodeID

For example, uptimefor NodeID-KMbH9P6TdMpYu1XrvLvgT3h6MpEFiwtgc after entering - copy and paste - the command line block and press “enter”:

curl -X POST --data '{
"jsonrpc": "2.0",
"id" : 1,
"method" : "platform.getCurrentValidators"
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P | jq . - | grep -15 NodeID-KMbH9P6TdMpYu1XrvLvgT3h6MpEFiwtgc

It turned out that the uptimeNodeID-KMbH9P6TdMpYu1XrvLvgT3h6MpEFiwtgc is 1,000, that is, 100%, as shown in the image below.

INTRODUCTION TO AVAX TOKENS STAKING

Staking is a natural mechanism for participating in an open network and offers a direct economic argument: the likelihood of an attack’s success is directly proportional to a well-defined monetary cost function. Staking nodes are economically motivated to act virtuously and avoid behavior that could damage their stake’s value.

A node that wants to enter the network can do so freely, first placing and blocking a stake that cannot be moved for a defined period of time determined by the token holder. Once accepted, a stake cannot be reversed or unlocked to ensure that nodes share the same stable view of the network. Even better, for both the token holder and the network, this stake does not incur additional maintenance costs.

Unlike other systems that also offer a proof-of-stake (PoS) mechanism, AVAX does not use a cut and therefore the entire stake is returned when the stake period ends.

With Avalanche, staking tokens are never at risk of a network failure.

STAKING FOR VALIDATION OF AVAX TOKENS THROUGH YOUR AVALANCHE WALLET

The AVAX token holder can participate in the staking of the primary network as a validator using the Avalanche Wallet.

AVALANCHE NETWORK NODE VALIDATOR

A validator is an AVAX token holder that operates a node and wishes to participate in the staking and validation of the primary network by issuing a special “addValidator” transaction for the platform chain (P-Chain) whose transaction specifies the following:

  • Staking amount (amount of AVAX tokens in staking).
  • NodeID (own node).
  • Start & End Time (date and time of start and end of staking).
  • Delegation Fee (delegation fee charged by the validator to the delegator).
  • Reward Address (address of your Avalanche wallet where staking rewards for validation and delegation will be sent).

Once the mentioned transaction is accepted, the funds will be blocked until the end of the AVAX token staking period.

VALIDATION STAKING PARAMETERS

  • The minimum amount to become a validator is 2,000 AVAX.
  • The minimum amount of time someone can stake AVAX tokens is 2 weeks.
  • The maximum amount of time someone can stake AVAX tokens is 1 year.
  • The validator receives a delegation fee (Delegation Fee) of at least 2% on the amount generated by STAKING BY DELEGATION to be received by the delegator. For example, if the delegator is entitled to 100 AVAX tokens at the end of the STAKING PER DELEGATION period, the VALIDATOR will receive 2 AVAX tokens (2%) and the DELEGATOR will receive 98 AVAX tokens (98%).
  • The validator can receive numerous delegations up to the limit of 4 times the amount of AVAX tokens in staking by validation.
  • The validator is responsible for creating and maintaining the online node above, at least, 80% of the time corresponding to the validation staking period.

Check out the parameters related to AVAX token staking below:

  • ID node: A Node unique ID derived from staker certificate of each individual node.
  • Start time: The date and time when a staking validator is started.
  • End time: The date and time when the validator’s staking is finished.
  • Delegation fee: The delegation fee is specified by each validator as it joins the Avalanche network. The delegator pays a delegation fee to the validator to which he has delegated his AVAX tokens.
  • Reward address: destination address for the staking rewards accumulated over the staking period.

IT’S TIME TO MAKE STAKING BY VALIDATION!

In view of the above, you need to have, at least, 2,000,001 AVAX tokens in your Avalanche wallet for staking by validation, as there is a fee of 0.001 AVAX for the transfer transaction from your X-CHAIN ​​address to your P-CHAIN ​​address .

If you do not have to purchase the desired quantity of AVAX tokens on the exchange of your choice. Check the list of exchanges below:

HAVE YOU CREATED YOUR AVALANCHE WALLET?

No, then create your Avalanche wallet by clicking on the image below:

With your Avalanche wallet, access it by clicking on the image below:

There are four options for accessing your Avalanche wallet. Choose one of the four options above.

In this example, we chose the MNEMONIC KEY PHASE option.

Insert your MNEMONIC KEY PHASE in the appropriate field.

Access your Avalanche wallet.

Now click on “Earn”.

After clicking on “Earn” you will be informed that you can earn more AVAX tokens by staking your AVAX tokens from your Avalanche wallet.

To do this, you must transfer your AVAX tokens from your X-CHAIN ​​address to your P-CHAIN ​​address to stake the AVAX tokens in your Avalanche wallet. Bearing in mind that you need to have at least 2,000,001 AVAX tokens in your Avalanche wallet for staking by validation, as there is a fee of 0.001 AVAX for the transfer transaction from your X-CHAIN ​​address to your P-CHAIN ​​address.

To make this transfer, in “Cross Chain Transfer”, click on the “TRANSFER” button.

Then, click again on the “TRANSFER” button.

Next, the confirmation screen that the transfer between the chains was successful (from X-CHAIN ​​to P-CHAIN) will appear.

Now click on the “BACK TO EARN” button.

To validate your AVAX tokens choose the option — Validate

Click on “ADD VALIDATOR” and fill in all the fields.

Node ID

Enter your Node ID.

Staking Period

Period of time when your AVAX tokens will be blocked for validation staking.

Start Date & Time

Staking start date and time.

End Date & Time

End date and time.

Stake Amount

Choose from at least 2,000 AVAX tokens to perform validation staking.

MAX
enter at least 2,000
AVAX

Reward Address

Address of your Avalanche wallet where the staking rewards for validation and delegation will be sent, if any.

The start date of the staking should be in the future (that is, choose the day after the day you are creating your staking) and the end date must be after the start date.

Finally, click on “SUBMIT”.

If the information “You are now validating” appears , then you have successfully become an Avalanche network validator!

To confirm that you have become an Avalanche network validator, enter — copy and paste — the command line block into the Elastic VPS Web SSH session (black window) and press “enter”:

curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.getCurrentValidators",
"params": {},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P

If this command block returns your NodeID in the list of active validators , then you have successfully become an Avalanche network validator.

When you become a validator for the Avalanche network, your AVAX tokens are blocked for validation staking.

You will receive your blocked AVAX tokens plus AVAX token rewards as soon as your validation staking period ends.

Now if you want to see your AVAX token reward estimate, after clicking on “Earn”, click on “VIEW REWARDS”.

GET REAL-TIME ALERTS FROM THE AVALANCHE NETWORK

Keep a minute-by-minute monitoring of the operational status of your Avalanche node by clicking on the image below:

About Avalanche

Avalanche is an open-source platform for launching decentralized applications and enterprise blockchain deployments in one interoperable, highly scalable ecosystem. Avalanche is able to process 4,500+ transactions/second and instantly confirm transactions. Ethereum developers can quickly build on Avalanche as Solidity works out-of-the-box.

Website | Whitepapers | Twitter | Discord | GitHub | Documentation | Explorer | Avalanche-X | Telegram | Facebook | LinkedIn | Reddit | YouTube

Aviso Legal

“Esse artigo é meramente informativo e não é uma recomendação de investimento, o mercado de criptomoedas é bastante volátil e você deve pesquisar e decidir por si mesmo em que investir, especialmente em mercados de alto risco”.

Aviso Legal: Todos os artigos são meramente informativos e não são recomendações de investimento. Você deve pesquisar e decidir por si mesmo em que investir.

Aviso Legal: Todos os artigos são meramente informativos e não são recomendações de investimento. Você deve pesquisar e decidir por si mesmo em que investir.