Here’s a detailed guide with more code on setting up a Waku validator node using nwaku.

Step 1: Install Dependencies

Ensure Docker and Docker Compose are installed:

sudo apt-get update
sudo apt-get install docker.io docker-compose -y

Step 2: Clone the Waku Repository

git clone <https://github.com/waku-org/nwaku.git>
cd nwaku

Step 3: Build the Docker Image

docker build -t nwaku .

Step 4: Set Up Docker Compose

Create a docker-compose.yml file:

version: '3'
services:
  nwaku:
    image: nwaku
    ports:
      - "60000:60000/tcp"
      - "60000:60000/udp"
    command: >
      --nat=extip:<YOUR_EXTERNAL_IP>
      --relay
      --log-level=debug
      --metrics-server
    environment:
      - WAKU_PORT=60000

Replace <YOUR_EXTERNAL_IP> with your actual IP.

Step 5: Run the Node

docker-compose up -d

Step 6: Checking Logs

To check if the node is running correctly:

docker-compose logs -f

Step 7: Accessing Node Metrics

Waku nodes expose metrics using Prometheus. Add --metrics-server to your command to enable it and access metrics at http://localhost:6060/metrics.

Step 8: Interact with the Node Using Waku CLI