Skip to content

Instantly share code, notes, and snippets.

@chicodias
Last active March 20, 2025 15:20
Show Gist options
  • Save chicodias/05d6e6f4be03c8c674877d7d014861a8 to your computer and use it in GitHub Desktop.
Save chicodias/05d6e6f4be03c8c674877d7d014861a8 to your computer and use it in GitHub Desktop.
How to Set Up a Kadena Testnet Node Without Genesis Sync

How to Set Up a Chainweb Node for Testnet

The official documentation is comprehensive for setting up a Chainweb node on the mainnet (refer to Chainweb Get Started). However, deploying on the testnet requires additional configuration, as detailed below.


Prerequisites

A Linux machine meeting the minimum requirements (see Chainweb Node README) with the following software installed:

  • Docker
  • rsync
  • Git

This was my configuration: I used a Digital Ocean droplet with 8GB RAM, 2 vCPUs, and an attached volume. Higher disk space is recommended to maintain the full history of the node, especially if it will support a dApp.

Feel free to adjust based on your own requirements and workload.


Step-by-Step Guide

1. Create a Folder and Add the docker-compose.yaml File

mkdir testnet && cd testnet

Save the following content in docker-compose.yaml:

services:
  chainweb-node:
    image: chainweb-node-custom
    environment:
      - CHAINWEB_NETWORK=testnet04
    container_name: chainweb-node
    ports:
     - mode: host
       protocol: tcp
       published: 1789
       target: 1789
     - mode: host
       protocol: tcp
       published: 1848
       target: 1848
    restart: unless-stopped
    volumes:
     - ./data:/data

volumes: {}

2. Clone the Chainweb Docker Repository

git clone https://github.com/kadena-io/chainweb-node-docker

3. Edit the Configuration File (optional)

Before building the Docker image, edit the configuration file chainweb.testnet04.yaml in the chainweb-node-docker directory if needed. For instance, to enable Pact table read queries, add:

allowReadsInLocal: true

This step is optional and should be done only if your application requires specific parameters.


4. Build the Docker Image

After editing the configuration file, build the custom Docker image and tag it as chainweb-node-custom:

cd chainweb-node-docker
docker build -t chainweb-node-custom .

Once built, return to the testnet directory:

cd ../testnet

4. Copy the Database from a Bootstrap Node (Optional)

This step significantly reduces the synchronization time (from about a week to a few minutes).

  • Choose a bootstrap node close to your server location. A list of testnet bootstrap nodes is available here.

  • Copy the database using rsync:

rsync -aP --no-compress --delete --progress "rsync://eu1.testnet.chainweb.com/db/0" ./data/chainweb-db

This downloads the pre-synced database, saving hours of synchronization time.


5. Start the Container

Once the database copy is complete, bring up the container:

docker compose up -d

6. Test the Node

After a few minutes, you can test the node using curl:

curl -sk https://localhost:1789/chainweb/0.0/testnet04/cut

Compare the cut height from your node with the height shown at:

https://api.testnet.chainweb.com/chainweb/0.0/testnet04/cut

If the heights are close and your node's height continues to grow quickly, your node is syncing correctly and should be running fine.


Next Steps

If this setup is on a server, you should configure a reverse proxy with Nginx and Certbot to expose the following ports:

  • 1789 (P2P API)
  • 1848 (Service API)

Refer to the Chainweb API documentation for detailed information on the exposed endpoints.


How to Update the Node

To update the node, simply pull the latest changes from the chainweb-node-docker repository and rebuild the Docker image. No additional steps are required if the docker-compose.yaml file remains unchanged.


Testnet05

This tutorial can likely be adapted for testnet05, but it has not been tested by the author. If you want to experiment, you can use the following bootstrap nodes for testnet05:

  • rsync://us1.testnet05.chainweb.com/db/0
  • rsync://us2.testnet05.chainweb.com/db/0

Please let us know if you succeed in setting up a testnet05 node!


Acknowledgments

  • Special thanks to @peppinho89 for the original docker-compose.yaml file.
  • Additional thanks to Discord user xiownthisp for guidance (original message in Kadena Discord).
@aserranoni
Copy link

Thank you for this!

@frostweb3
Copy link

Appreciate the guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment