Docs
Ecosystem Roles
Validator
Running with Systemd
Validator Node

Running with Systemd

You can run your validator node as a Systemd process so that it will automatically restart on server reboots or crashes (and helps to avoid getting slashed!).

Before following this guide you should have already set up your machines environment, installed the dependencies, and compiled the Tangle binary. If you have not done so, please refer to the Hardware page.

Standalone Testnet

Generate and store keys

We need to generate the required keys for our node. For more information on these keys, please see the Required Keys section. 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.
./target/release/tangle-standalone key insert --base-path /data/validator/<USERNAME> \
--chain ./chainspecs/tangle-standalone.json \
--scheme Sr25519 \
--suri <"12-MNEMONIC-PHARSE"> \
--key-type acco

Aura Keys

Aura
# it will ask for your suri, enter it.
./target/release/tangle-standalone key insert --base-path /data/validator/<USERNAME> \
--chain ./chainspecs/tangle-standalone.json \
--scheme Sr25519 \
--suri <"12-MNEMONIC-PHARSE"> \
--key-type aura

Im-online Keys - these keys are optional

Imonline
# it will ask for your suri, enter it.
./target/release/tangle-standalone key insert --base-path /data/validator/<USERNAME> \
--chain ./chainspecs/tangle-standalone.json \
--scheme Sr25519 \
--suri <"12-MNEMONIC-PHARSE"> \
--key-type imon

DKG Keys

DKG
# it will ask for your suri, enter it.
./target/release/tangle-standalone key insert --base-path /data/validator/<USERNAME> \
--chain ./chainspecs/tangle-standalone.json \
--scheme Ecdsa \
--suri <"12-MNEMONIC-PHARSE"> \
--key-type wdkg

Grandpa Keys

Grandpa
# it will ask for your suri, enter it.
./target/release/tangle-standalone key insert --base-path /data/validator/<USERNAME> \
--chain ./chainspecs/tangle-standalone.json \
--scheme Ed25519 \
--suri <"12-MNEMONIC-PHARSE"> \
--key-type gran

To ensure you have successfully generated the keys correctly run:

ls
ls ~/data/validator/<USERNAME>/keystore
# You should see a some file(s) there, these are the keys.

System service setup

Run the following commands to create the service configuration file:

mv
# Move the tangle-standalone binary to the bin directory (assumes you are in repo root directory)
sudo mv ./target/release/tangle-standalone /usr/bin/

Add the following contents to the service configuration file. Make sure to replace the USERNAME with the username you created in the previous step, add your own node name, and update any paths or ports to your own preference.

Note: The below configuration assumes you are targeting the Tangle Network chainspec.

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.

Validator Node

validator.service
sudo tee /etc/systemd/system/validator.service > /dev/null << EOF
[Unit]
Description=Tangle Validator Node
After=network-online.target
StartLimitIntervalSec=0
 
[Service]
User=<USERNAME>
Restart=always
RestartSec=3
ExecStart=/usr/bin/tangle-standalone \
  --base-path /data/validator/<USERNAME> \
  --name <NODE-NAME> \
  --chain tangle-testnet \
  --node-key-file "/home/<USERNAME>/node-key" \
  --port 30333 \
  --validator \
  --no-mdns \
  --telemetry-url "wss://telemetry.polkadot.io/submit/ 0" --name <NODE_NAME>
 
[Install]
WantedBy=multi-user.target
EOF

Enable the services

Double check that the config has been written to /etc/systemd/system/validator.service correctly. If so, enable the service so it runs on startup, and then try to start it now:

enable service
sudo systemctl daemon-reload
sudo systemctl enable validator
sudo systemctl start validator

Check the status of the service:

status
sudo systemctl status validator

You should see the node connecting to the network and syncing the latest blocks. If you need to tail the latest output, you can use:

logs
sudo journalctl -u validator.service -f

If the node is running correctly, you should see an output similar to below:

output
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

Network sync

After a validator node is started, it will start syncing with the current chain state. Depending on the size of the chain when you do this, this step may take anywhere from a few minutes to a few hours.

Example of node sync :

output after synced
2021-06-17 03:07:39 🔍 Discovered new external address for our node: /ip4/10.26.16.1/tcp/30333/ws/p2p/12D3KooWLtXFWf1oGrnxMGmPKPW54xWCHAXHbFh4Eap6KXmxoi9u
2021-06-17 03:07:40 ⚙️  Syncing 218.8 bps, target=#5553764 (17 peers), best: #24034 (0x08af…dcf5), finalized #23552 (0xd4f0…2642), ⬇ 173.5kiB/s ⬆ 12.7kiB/s
2021-06-17 03:07:45 ⚙️  Syncing 214.8 bps, target=#5553765 (20 peers), best: #25108 (0xb272…e800), finalized #25088 (0x94e6…8a9f), ⬇ 134.3kiB/s ⬆ 7.4kiB/s
2021-06-17 03:07:50 ⚙️  Syncing 214.8 bps, target=#5553766 (21 peers), best: #26182 (0xe7a5…01a2), finalized #26112 (0xcc29…b1a9), ⬇ 5.0kiB/s ⬆ 1.1kiB/s
2021-06-17 03:07:55 ⚙️  Syncing 138.4 bps, target=#5553767 (21 peers), best: #26874 (0xcf4b…6553), finalized #26624 (0x9dd9…27f8), ⬇ 18.9kiB/s ⬆ 2.0kiB/s
2021-06-17 03:08:00 ⚙️  Syncing 37.0 bps, target=#5553768 (22 peers), best: #27059 (0x5b73…6fc9), finalized #26624 (0x9dd9…27f8), ⬇ 14.3kiB/s ⬆ 4.4kiB/s

Bond TNT and setup validator Account

After your node is synced, you are ready to setup keys and onboard as a validator, make sure to complete the steps at required keys to start validating.


Congratulations! You have officially setup an Tangle Network node using Systemd. If you are interested in learning how to setup monitoring for your node, please refer to the monitoring page.