November 19

How to Run a Full Node for Avail

Prerequisites

Before starting, ensure you have:

  1. Minimum Requirements:
    • OS: Linux/macOS (Windows via WSL is possible).
    • CPU: 2 cores or more.
    • RAM: Minimum 4GB.
    • Disk: At least 100GB of free SSD storage.
    • Stable internet connection.
  2. Tools Installed:
    • Docker.
    • Docker Compose.
    • git.

Steps to Deploy the Node

Step 1: Update System

Keep your system packages updated:

sudo apt update && sudo apt upgrade -y

Step 2: Install Docker and Docker Compose

If you don't already have Docker installed, follow these commands:

  1. Install Docker:bashCopia codicesudo apt install docker.io -y
  2. Install Docker Compose:bashCopia codicesudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
  3. Verify Installation:bashCopia codicedocker --version docker-compose --version

Step 3: Clone the Avail Full Node Repository

git clone https://github.com/availproject/avail-full-node.git
cd avail-full-node

Step 4: Configure the Node

  1. Open the docker-compose.yml file in your editor (e.g., nano or vim):bashCopia codicenano docker-compose.yml
  2. Customize the configuration as needed. For example, ensure the node ports match your environment:yamlCopia codiceservices: avail: image: availproject/avail-node:latest ports: - "30333:30333" # P2P port - "9933:9933" # RPC port - "9944:9944" # WebSocket port volumes: - ./data:/data
  3. Save and exit (Ctrl+O, Ctrl+X).

Step 5: Start the Node

Use Docker Compose to start the node:

docker-compose up -d

Step 6: Check Node Logs

Ensure the node is running correctly by checking the logs:

docker-compose logs -f

Look for lines indicating the node is syncing or producing blocks:

Syncing blocks: #12345
Peer connections: 5

Step 7: Expose Node to Network (Optional)

To allow public access to your node:

  1. Open the required ports (30333, 9933, 9944) on your firewall:bashCopia codicesudo ufw allow 30333 sudo ufw allow 9933 sudo ufw allow 9944
  2. Restart the node if needed:bashCopia codicedocker-compose down docker-compose up -d

Step 8: Monitor Node Health

You can query the node's health using the RPC API. Install curl if needed:

sudo apt install curl -y

Check if the node is running:

curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method":"system_health"}' http://localhost:9933

Expected output:

{
  "jsonrpc": "2.0",
  "result": {
    "isSyncing": false,
    "peers": 12,
    "shouldHavePeers": true
  },
  "id": 1
}

Step 9: Update Node (When Required)

To update the node, pull the latest Docker image:

docker-compose down
docker pull availproject/avail-node:latest
docker-compose up -d

Step 10: Stop or Remove Node (Optional)

If you need to stop the node:

docker-compose down

To completely remove the node (including data):

rm -rf ./data

This guide provides everything you need to deploy and maintain an Avail full node. Let me know if you need further customization or assistance! 🚀