Skip to content

Run a Tanssi Node Using Docker

Introduction

In this guide, you'll learn how to spin up a Tanssi node using the official image release with Docker on Linux systems. Nodes are crucial for the Tanssi ecosystem as they provide stable API endpoints that applications and users can connect to for chain data and transaction submission.

Checking Prerequisites

Installing Docker

To get started, you'll need access to a computer running a Linux OS and install Docker.

Run the following command to install Docker on a Linux Ubuntu platform:

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

And the following command to check the installation:

sudo docker run hello-world

This is what a successful execution in the terminal looks like:

sudo docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

Pull the Docker Image

For every release, a Docker image is built and published. It contains all the necessary dependencies a Tanssi node requires and the binary file itself.

A Docker image combines the binary corresponding to the latest stable release of the client node, along with the Tanssi orchestrator specification file.

Run the following command to pull the Docker image:

docker pull moondancelabs/starlight

The command will download and extract the image and show the status upon execution:

docker moondancelabs/starlight

Using default tag: latest
latest: Pulling from moondancelabs/starlight
e1caac4eb9d2: Pull complete
1d4409959e6d: Pull complete
b8beed19c122: Pull complete
c0fab1f18601: Pull complete
Digest: sha256:0f717d6cf247bbb1b082f5f9e5761b23c44a0be8b704492a57fdbf8c63c0a91c
Status: Downloaded newer image for moondancelabs/starlight
docker.io/moondancelabs/starlight

Set Up the Data Directory

Running a node requires syncing with the Tanssi chain and storing its state.

Run the following command to create the directory where your node will store the databases containing blocks and chain states:

mkdir /var/lib/dancelight-data

Set the folder's ownership to the account that will run the Docker image to ensure writing permission:

chown INSERT_DOCKER_USER /var/lib/dancelight-data

Or run the following command if you want to run the node with the current logged-in user:

sudo chown -R $(id -u):$(id -g) /var/lib/dancelight-data

Note

The directory is a parameter in the Docker start-up command. If you decide to create the directory elsewhere, update the command accordingly.

Generate the Node Key

To generate and store on disk the session keys that will be referenced in the start-up command, run the following command:

docker run --network="host" -v "/var/lib/dancelight-data:/data" \
-u $(id -u ${USER}):$(id -g ${USER}) \
moondancelabs/starlight key generate-node-key --file /data/node-key

Note

This step could be avoided using the --unsafe-force-node-key-generation parameter in the start-up command, although this is not the recommended practice.

Start Your Node

To spin up your node, you must run the Docker image with the docker run command.

Replace INSERT_YOUR_TANSSI_NODE_NAME with a human-readable name and set INSERT_YOUR_IP_ADDRESS with your public IP address.

Note

It is recommended that you run the optimized binary versions for either Intel's Skylake or AMD's Zen3 architectures for better performance.

docker run --network="host" -v "/var/lib/dancelight-data:/data" \
-u $(id -u ${USER}):$(id -g ${USER}) \
moondancelabs/starlight \
--chain dancelight \
--base-path /data \
--name INSERT_YOUR_TANSSI_NODE_NAME \
--node-key-file /data/node-key \
--rpc-port 9944 \
--prometheus-port 9615 \
--prometheus-external \
--listen-addr /ip4/0.0.0.0/tcp/30333 \
--public-addr /ip4/INSERT_YOUR_IP_ADDRESS/tcp/30333 \
--state-pruning archive \
--blocks-pruning archive \
--database paritydb \
--unsafe-rpc-external \
--telemetry-url 'wss://telemetry.polkadot.io/submit/ 0'

Run Flags

The flags used in the docker run command can be adjusted according to your preferences and hardware configuration. The following ones are some of the most note-worthy:

  • --state-pruning=archive - keeps all state data, which is necessary for historical state queries
  • --blocks-pruning=archive - keeps all blocks, necessary for historical block data
  • --database=paritydb - uses ParityDB as the database backend, which is optimized for RPC node performance
  • --unsafe-rpc-external - allows external connections to the RPC server. This is required for the node to be accessible externally, but exposing RPC endpoints carries security risks. Ensure appropriate firewall and security measures are in place (see warning below)

Warning

The --unsafe-rpc-external flag opens your RPC node to external connections. In production environments, you should implement additional security measures like a reverse proxy with rate limiting and authentication.

You can view all available flags by running:

docker run -ti --entrypoint /chain-network/tanssi-relay moondancelabs/starlight --help

Syncing Your Node

The first time your node spins up, the syncing process displays lots of log information from the node configuration and the chain blocks being synced. Some errors are expected to be displayed at the beginning of the process, disappearing once the chain gets synced to the last block.

docker run ....
2024-02-08 18:30:04.093 INFO tokio-runtime-worker substrate: [Parachain] 💤 Idle (0 peers), best: #0 (0x4a2b…7de3), finalized #0 (0x4a2b…7de3), ⬇ 0 ⬆ 0
2024-02-08 18:30:06.368 INFO tokio-runtime-worker substrate: [Relaychain] ✨ Imported #14139635 (0x8c41…8df6)
2024-02-08 18:30:08.809 INFO tokio-runtime-worker substrate: [Relaychain] 💤 Idle (8 peers), best: #14139635 (0x8c41…8df6), finalized #14139632 (0xa9a8…cab9), ⬇ 32.7kiB/s ⬆

When the syncing process is finished, your node is ready to serve API requests.

Testing Your Node

After your node is fully synced, you can verify that the RPC endpoint is working correctly by making a simple request. You can use curl to test the connection:

curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method":"chain_getHeader", "params":[]}' http://localhost:9944

If the RPC endpoint is working correctly, you should receive a JSON response containing the latest block header information.

Last update: May 15, 2025
| Created: February 10, 2024