# Avalanche (https://docs.axelar.dev/infrastructure/chain-nodes/avalanche)



<Callout title="Consensus chain">
  This chain is verified by Axelar validators. Before setting up this node,
  [set up your Axelar validator](https://docs.axelar.dev/llms.mdx/infrastructure/validators/content.md).
  Once the node is running, connect it to `vald` as described in [Verify consensus
  chains](https://docs.axelar.dev/llms.mdx/infrastructure/verifiers/consensus-chains/content.md).
</Callout>

<Callout type="warn" title="Check the official documentation">
  The node setup steps below follow Avalanche's own documentation at the time of
  writing and may be out of date. Check the [official
  documentation](https://docs.avax.network/build/tutorials/nodes-and-staking/run-avalanche-node) before you start. The Axelar-specific steps (connecting
  the node to `vald` or `ampd`) are maintained here.
</Callout>

Instructions to set up your Avalanche node.

## Requirements [#requirements]

* [Setup your Axelar validator](https://docs.axelar.dev/llms.mdx/infrastructure/validators/content.md)
* Minimum hardware requirements: 8 AWS vCPU+, 16GB RAM, 500GB+ free storage space.
* MacOS or Ubuntu 20.04 (tested on 20.04)
* [Official Documentation](https://docs.avax.network/build/tutorials/nodes-and-staking/run-avalanche-node)

## Prerequisites [#prerequisites]

```bash
sudo apt-get install wget jq -y
```

## Get Binaries [#get-binaries]

Check the appropriate version for the network accordingly [in their docs](https://docs.avax.network/build/tutorials/nodes-and-staking/run-avalanche-node) or choose the [latest release](https://github.com/ava-labs/avalanchego/releases)

<Tabs items="[&#x22;Mainnet&#x22;,&#x22;Testnet&#x22;]">
  <Tab value="Mainnet">
    ```bash
     # This is an example - check their docs and release page to opt for the right version
    AVALANCHEGO=v1.9.3
    ```
  </Tab>

  <Tab value="Testnet">
    ```bash
     # This is an example - check their docs and release page to opt for the right version
    AVALANCHEGO=v1.9.3
    ```
  </Tab>
</Tabs>

```bash
# verify correct versions
echo $AVALANCHEGO

# create a temp dir for binaries
cd $HOME
mkdir binaries && cd binaries


# get avalanchego binary and rename
wget https://github.com/ava-labs/avalanchego/releases/download/$AVALANCHEGO/avalanchego-linux-amd64-$AVALANCHEGO.tar.gz
tar -xvf avalanchego-linux-amd64-$AVALANCHEGO.tar.gz
rm avalanchego-linux-amd64-$AVALANCHEGO.tar.gz
cd avalanchego-$AVALANCHEGO

# make binaries executable
chmod +x *

# move to usr bin
sudo mv * /usr/bin/

# get out of binaries directory
cd $HOME

# verify version
avalanchego --version
```

## Set environment variables [#set-environment-variables]

Note: Update your shell profile in accordance with the shell you are using

<Tabs items="[&#x22;Mainnet&#x22;,&#x22;Testnet&#x22;]">
  <Tab value="Mainnet">
    ```bash
    echo export NETWORK_ID=mainnet >> $HOME/.profile
    ```
  </Tab>

  <Tab value="Testnet">
    ```bash
    echo export NETWORK_ID=fuji >> $HOME/.profile
    ```
  </Tab>
</Tabs>

Apply your changes

```bash
source $HOME/.profile
```

## Create services [#create-services]

Use `systemctl` to set up service for `avalanchego`.

### avalanchego [#avalanchego]

```bash
sudo tee <<EOF >/dev/null /etc/systemd/system/avalanchego.service
[Unit]
Description=Avalanche daemon
After=network-online.target

[Service]
User=root
ExecStart=/usr/bin/avalanchego --http-host= --network-id=$NETWORK_ID
Restart=on-failure
RestartSec=3
LimitNOFILE=32768

[Install]
WantedBy=multi-user.target
EOF


# verify and enable
cat /etc/systemd/system/avalanchego.service
sudo systemctl enable avalanchego
```

## Start the service [#start-the-service]

```bash
sudo systemctl daemon-reload
sudo systemctl restart avalanchego
```

## Check logs [#check-logs]

```bash
# change log settings to persistent if not already
sed -i 's/#Storage=auto/Storage=persistent/g' /etc/systemd/journald.conf
sudo systemctl restart systemd-journald

journalctl -u avalanchego.service -f -n 100 -o cat
```

Logs should appear like this

```bash
[11-28|07:50:59.280] INFO <P Chain> bootstrap/bootstrapper.go:481 fetching blocks {"numFetchedBlocks": 85000, "numTotalBlocks": 3241631, "eta": "1h52m8s"}
[11-28|07:51:13.370] INFO <P Chain> bootstrap/bootstrapper.go:481 fetching blocks {"numFetchedBlocks": 90000, "numTotalBlocks": 3241631, "eta": "1h53m58s"}
[11-28|07:51:29.644] INFO <P Chain> bootstrap/bootstrapper.go:481 fetching blocks {"numFetchedBlocks": 95000, "numTotalBlocks": 3241631, "eta": "1h56m46s"}
[11-28|07:51:43.864] INFO <P Chain> bootstrap/bootstrapper.go:481 fetching blocks {"numFetchedBlocks": 100000, "numTotalBlocks": 3241631, "eta": "1h58m12s"}
[11-28|07:51:52.789] INFO <P Chain> bootstrap/bootstrapper.go:481 fetching blocks {"numFetchedBlocks": 105000, "numTotalBlocks": 3241631, "eta": "1h56m50s"}
[11-28|07:52:06.814] INFO <P Chain> bootstrap/bootstrapper.go:481 fetching blocks {"numFetchedBlocks": 110000, "numTotalBlocks": 3241631, "eta": "1h58m0s"}
[11-28|07:52:17.979] INFO <P Chain> bootstrap/bootstrapper.go:481 fetching blocks {"numFetchedBlocks": 115000, "numTotalBlocks": 3241631, "eta": "1h57m45s"}
[11-28|07:52:31.488] INFO <P Chain> bootstrap/bootstrapper.go:481 fetching blocks {"numFetchedBlocks": 120000, "numTotalBlocks": 3241631, "eta": "1h58m31s"}
[11-28|07:52:40.475] INFO <P Chain> bootstrap/bootstrapper.go:481 fetching blocks {"numFetchedBlocks": 125000, "numTotalBlocks": 3241631, "eta": "1h57m20s"}
[11-28|07:52:53.462] INFO <P Chain> bootstrap/bootstrapper.go:481 fetching blocks {"numFetchedBlocks": 130000, "numTotalBlocks": 3241631, "eta": "1h57m49s"}
```

## Verify [#verify]

```bash
YOUR_IP=$(curl -4 ifconfig.co)

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

If you get something like this in response of the above rpc call, your node is setup correctly

Wait for `isBootstrapped` to become true before using it in vald config

```bash
{
  "jsonrpc": "2.0",
  "result": {
    "isBootstrapped": false # wait for it to become true
  },
  "id": 1
}
```

## Endpoint [#endpoint]

```bash
echo "${YOUR_IP}:9650/ext/bc/C/rpc"
```

### Configure vald [#configure-vald]

In order for `vald` to connect to your Avalanche node, your `rpc_addr` should be exposed in
vald's `config.toml`

<Tabs items="[&#x22;Mainnet&#x22;,&#x22;Testnet&#x22;]">
  <Tab value="Mainnet">
    ```bash [[axelar_bridge_evm]] name = "Avalanche" rpc_addr = "http://IP:PORT"
    start-with-bridge = true 
    ```
  </Tab>

  <Tab value="Testnet">
    ```bash [[axelar_bridge_evm]] name = "Avalanche" rpc_addr = "http://IP:PORT"
    start-with-bridge = true 
    ```
  </Tab>
</Tabs>


---

All pages of these docs, as Markdown: https://docs.axelar.dev/llms.txt