How to Run a Validator ?

Hardware/Software Requirements

  • CPU: Equivalent of 8 AWS vCPU

  • RAM: 16 GiB

  • Storage: 1 TiB

  • OS: Ubuntu 20.04 or MacOS >= 12

AWS Specifications

  • Instance type: c52x.large

  • volume: 1 TB

  • Public IP

  • Ports: 9650 & 9651

Running the script

To download and run the script, enter the following in the terminal:

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

The output should be look like this

AvalancheGo installer
---------------------
Preparing environment...
Found arm64 architecture...
Looking for the latest arm64 build...
Will attempt to download:
 https://github.com/ava-labs/avalanchego/releases/download/v1.1.1/avalanchego-linux-arm64-v1.1.1.tar.gz
avalanchego-linux-arm64-v1.1.1.tar.gz 100%[=========================================================================>]  29.83M  75.8MB/s    in 0.4s
2020-12-28 14:57:47 URL:https://github-production-release-asset-2e65be.s3.amazonaws.com/246387644/f4d27b00-4161-11eb-8fb2-156a992fd2c8?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201228%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201228T145747Z&X-Amz-Expires=300&X-Amz-Signature=ea838877f39ae940a37a076137c4c2689494c7e683cb95a5a4714c062e6ba018&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=246387644&response-content-disposition=attachment%3B%20filename%3Davalanchego-linux-arm64-v1.1.1.tar.gz&response-content-type=application%2Foctet-stream [31283052/31283052] -> "avalanchego-linux-arm64-v1.1.1.tar.gz" [1]
Unpacking node files...
avalanchego-v1.1.1/plugins/
avalanchego-v1.1.1/plugins/evm
avalanchego-v1.1.1/avalanchego
Node files unpacked into /home/ubuntu/avalanche-node

And then the script will prompt you for information about the network environment:

To complete the setup some networking information is needed.
Where is the node installed:
1) residential network (dynamic IP)
2) cloud provider (static IP)
Enter your connection type [1,2]:

enter 1 if you have dynamic IP, and 2 if you have a static IP. If you are on a static IP, it will try to auto-detect the IP and ask for confirmation.

Detected '3.15.152.14' as your public IP. Is this correct? [y,n]:

Confirm with y, or n if the detected IP is wrong (or empty), and then enter the correct IP at the next prompt.

Next, you have to set up RPC port access for your node. Those are used to query the node for its internal state, to send commands to the node, or to interact with the platform and its chains (sending transactions, for example). You will be prompted:

Do you want the RPC port to be accessible to any or only local network interface? [any, local]:

If you're ok with sending RPC requests only from the node machine itself, enter local at the prompt. If you want to be able to send RPC requests to your node from a remote machine, enter any. Please note that if you choose to allow RPC requests on any network interface you will need to set up a firewall to only let through RPC requests from known IP addresses, otherwise your node will be accessible to anyone and might be overwhelmed by RPC calls from malicious actors! If you do not plan to use your node to send RPC calls, enter local for increased node security.

The script will then continue with system service creation and finish with starting the service:

Created symlink /etc/systemd/system/multi-user.target.wants/avalanchego.service β†’ /etc/systemd/system/avalanchego.service.Done!Your node should now be bootstrapping.Node configuration file is /home/ubuntu/.avalanchego/configs/node.jsonC-Chain configuration file is /home/ubuntu/.avalanchego/configs/chains/C/config.jsonTo check that the service is running use the following command (q to exit):sudo systemctl status avalanchegoTo follow the log use (ctrl-c to stop):sudo journalctl -u avalanchego -fReach us over on https://chat.avax.network if you're having problems.

The script is finished, and you should see the system prompt again.

Post Installation

AvalancheGo should be running in the background as a service. You can check that it's running with:

sudo systemctl status avalanchego

This will print the node's latest logs, which should look like this:

● avalanchego.service - AvalancheGo systemd serviceLoaded: loaded (/etc/systemd/system/avalanchego.service; enabled; vendor preset: enabled)Active: active (running) since Tue 2021-01-05 10:38:21 UTC; 51s agoMain PID: 2142 (avalanchego)Tasks: 8 (limit: 4495)Memory: 223.0MCGroup: /system.slice/avalanchego.service└─2142 /home/ubuntu/avalanche-node/avalanchego --dynamic-public-ip=opendns --http-host=Jan 05 10:38:45 ip-172-31-30-64 avalanchego[2142]: INFO [01-05|10:38:45] <P Chain> avalanchego/vms/platformvm/vm.go#322: initializing last accepted block as 2FUFPVPxbTpKNn39moGSzsmGroYES4NZRdw3mJgNvMkMiMHJ9eJan 05 10:38:45 ip-172-31-30-64 avalanchego[2142]: INFO [01-05|10:38:45] <P Chain> avalanchego/snow/engine/snowman/transitive.go#58: initializing consensus engineJan 05 10:38:45 ip-172-31-30-64 avalanchego[2142]: INFO [01-05|10:38:45] avalanchego/api/server.go#143: adding route /ext/bc/11111111111111111111111111111111LpoYYJan 05 10:38:45 ip-172-31-30-64 avalanchego[2142]: INFO [01-05|10:38:45] avalanchego/api/server.go#88: HTTP API server listening on ":9650"Jan 05 10:38:58 ip-172-31-30-64 avalanchego[2142]: INFO [01-05|10:38:58] <P Chain> avalanchego/snow/engine/common/bootstrapper.go#185: Bootstrapping started syncing with 1 vertices in the accepted frontierJan 05 10:39:02 ip-172-31-30-64 avalanchego[2142]: INFO [01-05|10:39:02] <P Chain> avalanchego/snow/engine/snowman/bootstrap/bootstrapper.go#210: fetched 2500 blocksJan 05 10:39:04 ip-172-31-30-64 avalanchego[2142]: INFO [01-05|10:39:04] <P Chain> avalanchego/snow/engine/snowman/bootstrap/bootstrapper.go#210: fetched 5000 blocksJan 05 10:39:06 ip-172-31-30-64 avalanchego[2142]: INFO [01-05|10:39:06] <P Chain> avalanchego/snow/engine/snowman/bootstrap/bootstrapper.go#210: fetched 7500 blocksJan 05 10:39:09 ip-172-31-30-64 avalanchego[2142]: INFO [01-05|10:39:09] <P Chain> avalanchego/snow/engine/snowman/bootstrap/bootstrapper.go#210: fetched 10000 blocksJan 05 10:39:11 ip-172-31-30-64 avalanchego[2142]: INFO [01-05|10:39:11] <P Chain> avalanchego/snow/engine/snowman/bootstrap/bootstrapper.go#210: fetched 12500 blocks

Note the active (running) which indicates the service is running ok. You may need to press q to return to the command prompt.

To find out your NodeID, which is used to identify your node to the network, run the following command:

sudo journalctl -u avalanchego | grep "NodeID"

It will produce output like:

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 6seStrauyCnVV7NEVwRbfaT9B6EnXEzfY

Prepend NodeID- to the value to get, for example, NodeID-6seStrauyCnVV7NEVwRbfaT9B6EnXEzfY. Store that; it will be needed for staking or looking up your node.

Your node should be in the process of bootstrapping now. You can monitor the progress by issuing the following command:

sudo journalctl -u avalanchego -f

Press ctrl+C when you wish to stop reading node output.

Stopping the Node

To stop AvalancheGo, run:

sudo systemctl stop avalanchego

To start it again, run:

sudo systemctl start avalanchego

Node Upgrade

AvalancheGo is an ongoing project and there are regular version upgrades. Most upgrades are recommended but not required. Advance notice will be given for upgrades that are not backwards compatible. When a new version of the node is released, you will notice log lines like:

Jan 08 10:26:45 ip-172-31-16-229 avalanchego[6335]: INFO [01-08|10:26:45] avalanchego/network/peer.go#526: beacon 9CkG9MBNavnw7EVSRsuFr7ws9gascDQy3 attempting to connect with newer version avalanche/1.1.1. You may want to update your client

It is recommended to always upgrade to the latest version, because new versions bring bug fixes, new features and upgrades.

To upgrade your node, just run the installer script again:

./avalanchego-installer.sh

It will detect that you already have AvalancheGo installed:

AvalancheGo installer---------------------Preparing environment...Found 64bit Intel/AMD architecture...Found AvalancheGo systemd service already installed, switching to upgrade mode.Stopping service...

It will then upgrade your node to the latest version, and after it's done, start the node back up, and print out the information about the latest version:

Node upgraded, starting service...New node version:avalanche/1.1.1 [network=mainnet, database=v1.0.0, commit=f76f1fd5f99736cf468413bbac158d6626f712d2]Done!

Advanced Node Configuration

Without any additional arguments, the script installs the node in a most common configuration. But the script also enables various advanced options to be configured, via the command line prompts. Following is a list of advanced options and their usage:

  • admin - Admin API will be enabled

  • archival - disables database pruning and preserves the complete transaction history

  • state-sync - if on state-sync for the C-Chain is used, if off it will use regular transaction replay to bootstrap; state-sync is much faster, but has no historical data

  • db-dir - use to provide the full path to the location where the database will be stored

  • fuji - node will connect to Fuji testnet instead of the mainnet

  • index - Index API will be enabled

  • ip - use dynamic, static arguments, of enter a desired IP directly to be used as the public IP node will advertise to the network

  • rpc - use any or local argument to select any or local network interface to be used to listen for RPC calls

  • version - install a specific node version, instead of the latest. See here for usage.

Please note that configuring index and archival options on an existing node will require a fresh bootstrap to recreate the database.

Complete script usage can be displayed by entering:

./avalanchego-installer.sh --help

Unattended Installation

If you want to use the script in an automated environment where you cannot enter the data at the prompts you must provide at least the rpc and ip options. For example:

./avalanchego-installer.sh --ip 1.2.3.4 --rpc local

Usage Examples

To run a Fuji node with indexing enabled and autodetected static IP:

./avalanchego-installer.sh --fuji --ip static --index

To run an archival mainnet node with dynamic IP and database located at /home/node/db:

./avalanchego-installer.sh --archival --ip dynamic --db-dir /home/node/db

To use C-Chain state-sync to quickly bootstrap a mainnet node, with dynamic IP and local RPC only:

./avalanchego-installer.sh --state-sync on --ip dynamic --rpc local

To reinstall the node using node version 1.7.10 and use specific IP and local RPC only:

./avalanchego-installer.sh --reinstall --ip 1.2.3.4 --version v1.7.10 --rpc local

Node Configuration

File that configures node operation is ~/.avalanchego/configs/node.json. You can edit it to add or change configuration options. The documentation of configuration options can be found here. Configuration may look like this:

{  "dynamic-public-ip": "opendns",  "http-host": ""}

Note that configuration file needs to be a properly formatted JSON file, so switches are formatted differently than for command line, so don't enter options like --dynamic-public-ip=opendns but as in the example above.

Script also creates an empty C-Chain config file, located at ~/.avalanchego/configs/chains/C/config.json. By editing that file you can configure the C-Chain, as described in detail here.

Using a Previous Version

The installer script can also be used to install a version of AvalancheGo other than the latest version.

To see a list of available versions for installation, run:

./avalanchego-installer.sh --list

It will print out a list, something like:

AvalancheGo installer---------------------Available versions:v1.3.2v1.3.1v1.3.0v1.2.4-arm-fixv1.2.4v1.2.3-signedv1.2.3v1.2.2v1.2.1v1.2.0

To install a specific version, run the script with --version followed by the tag of the version. For example:

./avalanchego-installer.sh --version v1.3.1

danger

Note that not all AvalancheGo versions are compatible. You should generally run the latest version. Running a version other than latest may lead to your node not working properly and, for validators, not receiving a staking reward.

Thanks to community member Jean Zundel for the inspiration and help implementing support for installing non-latest node versions.

Reinstall and Script Update

Installer script gets updated from time to time, with new features and capabilities added. To take advantage of new features or to recover from modifications that made the node fail, you may want to reinstall the node. To do that, fetch the latest version of the script from the web with:

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

After the script has updated, run it again with the --reinstall config flag:

./avalanchego-installer.sh --reinstall

This will delete the existing service file, and run the installer from scratch, like it was started for the first time. Note that the database and NodeID will be left intact.

Last updated