Docs
Ecosystem Roles
Validator
Deploying with Docker
Validator Node

Deploying with Docker

A Tangle node can be spun up quickly using Docker. For more information on installing Docker, please visit the official Docker docs (opens in a new tab). When connecting to Tangle on Kusama, it will take a few days to completely sync the embedded relay chain. Make sure that your system meets the requirements which can read here.

Standalone Testnet

1. Pull the Tangle Docker image:

Although we can make use of the provided docker-compose file in the Tangle repo (opens in a new tab), we pull the tangle-standalone:main Docker image from ghcr.io so that we can generate and insert our required keys before starting the node.

pull
# Only use "main" if you know what you are doing, it will use the latest and maybe unstable version of the node.
 
docker pull ghcr.io/webb-tools/tangle/tangle-standalone:main

2. Create a local directory to store the chain data:

Let us create a directory where we will store all the data for our node. This includes the chain data, keys, and logs.

mkdir
mkdir /var/lib/tangle/

3. Fetch applicable chainspec(s):

To join the Tangle Test network as node operator we need to fetch the appropriate chainspec for the Tangle network. Download the latest chainspec for standalone testnet:

get chainspec
# Fetches chainspec for Tangle network
wget https://raw.githubusercontent.com/webb-tools/tangle/main/chainspecs/testnet/tangle-standalone.json

Please make a reference where you have stored this json file as we will need it in the next steps.

4. Generate and store keys:

We need to generate the required keys for our node. The keys we need to generate include the following:

  • DKG key (Ecdsa)
  • Aura key (Sr25519)
  • Account key (Sr25519)
  • Grandpa key (Ed25519)
  • ImOnline key (Sr25519)

Let's now insert our required secret keys, we will not pass the SURI in the command, instead it will be interactive, where you should paste your SURI when the command asks for it.

Account Keys

Acco
# it will ask for your suri, enter it.
docker run --rm -it --platform linux/amd64 --network="host" -v "/var/lib/data" \
ghcr.io/webb-tools/tangle/tangle-standalone:main \
     key insert --base-path /var/lib/tangle/ \
    --chain /data/chainspecs/tangle-standalone.json \
    --scheme Sr25519 \
    --key-type acco

Aura Keys

Aura
docker run --rm -it --platform linux/amd64 --network="host" -v "/var/lib/data" \
ghcr.io/webb-tools/tangle/tangle-standalone:main \
    key insert --base-path /var/lib/tangle/ \
    --chain /data/chainspecs/tangle-standalone.json \
    --scheme Sr25519 \
    --key-type aura

Im-online Keys - these keys are optional (required if you are running as a validator)

Imonline
docker run --rm -it --platform linux/amd64 --network="host" -v "/var/lib/data" \
ghcr.io/webb-tools/tangle/tangle-standalone:main \
    key insert --base-path /var/lib/tangle/ \
    --chain /data/chainspecs/tangle-standalone.json \
    --scheme Sr25519 \
    --key-type imon

DKG Keys

DKG
docker run --rm -it --platform linux/amd64 --network="host" -v "/var/lib/data" \
ghcr.io/webb-tools/tangle/tangle-standalone:main \
    tangle-standalone key insert --base-path /data \
    --chain /data/chainspecs/tangle-standalone.json \
    --scheme Ecdsa \
    --key-type wdkg

Grandpa Keys

Grandpa
docker run --rm -it --platform linux/amd64 --network="host" -v "/var/lib/data" \
ghcr.io/webb-tools/tangle/tangle-standalone:main \
    tangle-standalone key insert --base-path /data \
    --chain /data/chainspecs/tangle-standalone.json \
    --scheme Ed25519 \
    --key-type gran

To ensure you have successfully generated the keys correctly run:

ls
ls ~/webb/tangle/chains/*/keystore
# You should see a some file(s) there, these are the keys.
Caution: Ensure you insert the keys using the instructions at generate keys, if you want the node to auto generate the keys, add the --auto-insert-keys flag.

5. Start Tangle Validator node:

To start the node run the following command:

docker run
docker run --platform linux/amd64 --network="host" -v "/var/lib/data" --entrypoint ./tangle-standalone \
ghcr.io/webb-tools/tangle/tangle-standalone:main \
--base-path=/data \
--chain tangle-testnet \
--name="YOUR-NODE-NAME" \
--execution wasm \
--wasm-execution compiled \
--trie-cache-size 0 \
--validator \
--telemetry-url "wss://telemetry.polkadot.io/submit/ 0" --name <NODE_NAME>

For an overview of the above flags, please refer to the CLI Usage page of our documentation.

Once Docker pulls the necessary images, your Tangle node will start, displaying lots of information, such as the chain specification, node name, role, genesis state, and more.

If you followed the installation instructions for Tangle, once synced, you will be connected to peers and see blocks being produced on the Tangle network!

logs
2023-03-22 14:55:51 Tangle Standalone Node
2023-03-22 14:55:51 ✌️  version 0.1.15-54624e3-aarch64-macos
2023-03-22 14:55:51 ❤️  by Webb Technologies Inc., 2017-2023
2023-03-22 14:55:51 📋 Chain specification: Tangle Testnet
2023-03-22 14:55:51 🏷  Node name: cooing-morning-2891
2023-03-22 14:55:51 👤 Role: FULL
2023-03-22 14:55:51 💾 Database: RocksDb at /Users/local/Library/Application Support/tangle-standalone/chains/local_testnet/db/full
2023-03-22 14:55:51   Native runtime: tangle-standalone-115 (tangle-standalone-1.tx1.au1)
2023-03-22 14:55:51 Bn254 x5 w3 params
2023-03-22 14:55:51 [0] 💸 generated 5 npos voters, 5 from validators and 0 nominators
2023-03-22 14:55:51 [0] 💸 generated 5 npos targets
2023-03-22 14:55:51 [0] 💸 generated 5 npos voters, 5 from validators and 0 nominators
2023-03-22 14:55:51 [0] 💸 generated 5 npos targets
2023-03-22 14:55:51 [0] 💸 new validator set of size 5 has been processed for era 1
2023-03-22 14:55:52 🔨 Initializing Genesis block/state (state: 0xfd16…aefd, header-hash: 0x7c05…a27d)
2023-03-22 14:55:52 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.
2023-03-22 14:55:53 Using default protocol ID "sup" because none is configured in the chain specs
2023-03-22 14:55:53 🏷  Local node identity is: 12D3KooWDaeXbqokqvEMqpJsKBvjt9BUz41uP9tzRkYuky1Wat7Z
2023-03-22 14:55:53 💻 Operating system: macos
2023-03-22 14:55:53 💻 CPU architecture: aarch64
2023-03-22 14:55:53 📦 Highest known block at #0
2023-03-22 14:55:53 〽️ Prometheus exporter started at 127.0.0.1:9615
2023-03-22 14:55:53 Running JSON-RPC HTTP server: addr=127.0.0.1:9933, allowed origins=["http://localhost:*", "http://127.0.0.1:*", "https://localhost:*", "https://127.0.0.1:*", "https://polkadot.js.org"]
2023-03-22 14:55:53 Running JSON-RPC WS server: addr=127.0.0.1:9944, allowed origins=["http://localhost:*", "http://127.0.0.1:*", "https://localhost:*", "https://127.0.0.1:*", "https://polkadot.js.org"]
2023-03-22 14:55:53 discovered: 12D3KooWMr4L3Dun4BUyp23HZtLfxoQjR56dDp9eH42Va5X6Hfgi /ip4/192.168.0.125/tcp/30304
2023-03-22 14:55:53 discovered: 12D3KooWNHhcCUsZTdTkADmDJbSK9YjbtscHHA8R4jvrbGwjPVez /ip4/192.168.0.125/tcp/30305
2023-03-22 14:55:53 discovered: 12D3KooWMr4L3Dun4BUyp23HZtLfxoQjR56dDp9eH42Va5X6Hfgi /ip4/192.168.88.12/tcp/30304
2023-03-22 14:55:53 discovered: 12D3KooWNHhcCUsZTdTkADmDJbSK9YjbtscHHA8R4jvrbGwjPVez /ip4/192.168.88.12/tcp/30305

Run via Docker Compose

The docker-compose file will spin up a container running Tangle standalone node, but you have to set the following environment variables. Remember to customize your the values depending on your environment and then copy paste this to CLI.

set variables
RELEASE_VERSION=main
CHAINSPEC_PATH=/tmp/chainspec/

After that run:

compose up
docker compose up -d

Update the Client

As Tangle development continues, it will sometimes be necessary to upgrade your node software. Node operators will be notified on our Discord channel when upgrades are available and whether they are necessary (some client upgrades are optional). The upgrade process is straightforward and is the same for a full node.

  1. Stop the docker container:
docker stop
sudo docker stop `CONTAINER_ID`
  1. Get the latest version of Tangle from the Tangle GitHub Release page (opens in a new tab)

  2. Pull the latest version of Tangle binary by doing docker pull ghcr.io/webb-tools/tangle/tangle-standalone:{VERSION_CODE}. Example, if the latest version of Tangle is v0.1.2, then the command would be docker pull ghcr.io/webb-tools/tangle/tangle-standalone:v0.1.12

  3. Restart the tangle container and you should have the updated version of the client.

Once your node is running again, you should see logs in your terminal.

Purge Your Node

If you need a fresh instance of your Tangle node, you can purge your node by removing the associated data directory.

You'll first need to stop the Docker container:

docker stop
sudo docker stop `CONTAINER_ID`

If you did not use the -v flag to specify a local directory for storing your chain data when you spun up your node, then the data folder is related to the Docker container itself. Therefore, removing the Docker container will remove the chain data.

If you did spin up your node with the -v flag, you will need to purge the specified directory. For example, for the suggested data directly, you can run the following command to purge your standalone node data:

rm
# purges standalone data
sudo rm -rf /data/chains/*

Now that your chain data has been purged, you can start a new node with a fresh data directory!