Running with Systemd
You can run your full or validator node as a systemd process so that it will automatically restart on server reboots or crashes, helping to avoid getting slashed. This guide now includes additional steps for setting up dependencies and Rust configuration, ensuring a smoother setup process.
Before following this guide, ensure that your machine's environment is set up and the Tangle binary is compiled. If you haven't done so, please refer to the Requirements page.
Setup
1. Fetch the Tangle Network Binary
Use the latest release version in the url in place of <VERSION>
, you can visit releases (opens in a new tab) page to view the latest info.
wget wget https://github.com/webb-tools/tangle/releases/download/<VERSION>/tangle-linux-amd64
For example, at the time of writing this document, the latest release is v0.6.1 and the link would be as follows
wget https://github.com/webb-tools/tangle/releases/download/v0.6.1/tangle-mainnet-linux-amd64
2. Install Dependencies
Ensure all necessary dependencies are installed:
sudo apt update && sudo apt upgrade -y
sudo apt install curl iptables build-essential git wget jq make gcc nano tmux htop nvme-cli pkg-config libssl-dev libleveldb-dev libgmp3-dev tar clang bsdmainutils ncdu unzip llvm libudev-dev make protobuf-compiler -y
3. Install and Configure Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# choose option 1
source $HOME/.cargo/env
rustup default nightly
rustup update
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
4. Select and Run Your Node Type
Create the Service Configuration File
Run the following commands to create the service configuration file:
# Move the tangle binary to the bin directory (assumes you are in repo root directory)
sudo mv ./target/release/tangle /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.
Full Node Service Configuration File
sudo tee /etc/systemd/system/full.service > /dev/null << EOF
[Unit]
Description=Tangle Full Node
After=network-online.target
StartLimitIntervalSec=0
[Service]
User=<USERNAME>
Restart=always
RestartSec=3
ExecStart=/usr/bin/tangle \
--base-path <BASE_PATH> \
--name <NODE-NAME> \
--chain tangle-mainnet \
--node-key-file "/home/<USERNAME>/node-key" \
--rpc-cors all \
--port 9946 \
--no-mdns \
--telemetry-url "wss://telemetry.polkadot.io/submit/ 1"
[Install]
WantedBy=multi-user.target
EOF
Enable the services
After ensuring the config is correctly written to /etc/systemd/system/full.service, enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable full
sudo systemctl start full
Check the Status of the Service
sudo systemctl status full
You should see the node connecting to the network and syncing with the latest blocks.
Tail the Latest Outputs
sudo journalctl -u full.service -f
Network sync
After a full 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 :
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
Congratulations! You have officially setup a Tangle Network node using Systemd.
Monitoring
To setup monitoring for your node, please refer to the monitoring page.
Begin Validating
Now that your node is setup, continue onto our Validator guides to understand token bonding and more.
Support and Questions
Visit our Discord's validator channel (opens in a new tab) for community assistance.