Skip to main content

4. Building Your Collator

Let's get started

Let's start with updating our server. Connect to your server and update:

sudo apt-get update
sudo apt-get upgrade
sudo apt install -y adduser libfontconfig1

the last command (related to libfontconfig1) is optional and required if you want install Grafana in the later sections of Secure Setup Guide).

Build the node

To build a collator node, you have 3 different options

  • From source: experience with using Linux
  • From binary: easiest way to start and update node with new releases
  • Run a Docker container: Docker background requires

Build from source

Building a node from source code is the most complicated path, but will also provide the best optimized node version for your server.

Make sure your server is ready to build a collator. The instructions that follow do not go into details which you can find in official Substrate Docs

## Prerequisites (Software required for compilation)
sudo apt install build-essential
sudo apt install --assume-yes git clang curl cmake llvm protobuf-compiler
sudo apt update

## Install Rust
curl --proto '=https' --tlsv1.2 -sSf | sh
source $HOME/.cargo/env
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly

Clone the Astar repository:

git clone
cd Astar

Make sure you have the latest commit in place:

git checkout
git pull

Compile the node binary:

CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="-C codegen-units=1" cargo build --release

Build from binaries

The easiest way to install an Astar node is to download the binaries. You can find them here: Astar releases.

Get the file and extract:

wget $(curl -s | grep "tag_name" | awk '{print "" substr($2, 2, length($2)-3) "/astar-collator-v" substr($2, 3, length($2)-4) "-ubuntu-x86_64.tar.gz"}')
tar -xvf astar-collator*.tar.gz

Run a Docker container

You can find here the Astar Docker hub.

Pull the latest Docker version

docker pull staketechnologies/astar-collator:latest

Launch Your Collator


The following steps are suitable for binary usage (built from source or downloaded). In case you want to run a Docker container, you will have to adapt those.

Create a dedicated user for the node and move the node binary (in this example, username is astar):

sudo useradd --no-create-home --shell /usr/sbin/nologin astar
sudo cp ./astar-collator /usr/local/bin
sudo chmod +x /usr/local/bin/astar-collator

Create a dedicated directory for the chain storage data:

sudo mkdir /var/lib/astar
sudo chown astar:astar /var/lib/astar

Now, let's go to our binary directory and start the collator manually:

cd /usr/local/bin

sudo -u astar ./astar-collator --collator --chain astar --pruning archive --name {COLLATOR_NAME} --base-path /var/lib/astar --telemetry-url 'wss:// 0'

Type in the place of {COLLATOR_NAME}, what you would like to call your node.

See your node syncing on

Useful commands to be used in screen: ctrl+a+d (detach actual session) screen ls (this will list all running screens) screen -r (restore a screen session)

Stop the manual node and kill the screen session:


Set systemd service

To run a stable collator node, a systemd service has to be set and activated. This will ensure that the node is restarting even after a server reboot.

Create a service file

sudo nano /etc/systemd/system/astar.service

Add service parameters (this example is for Astar Network):

Description=Astar Collator


ExecStart=/usr/local/bin/astar-collator \
--collator \
--name {COLLATOR_NAME} \
--chain astar \
--base-path /var/lib/astar \
--pruning archive \
--trie-cache-size 0 \
--telemetry-url 'wss:// 0'



Start the service:

sudo systemctl start astar.service

Check the node log and that everything is syncing fine:

journalctl -f -u astar.service -n100

Enable the service:

sudo systemctl enable astar.service


Please refer to the snapshot page.


To finalize your collator you need to:

  • Setup an account
  • Author your session key
  • Set up your session key
  • Verify your identity
  • Bond tokens

this part is covered in chapter Spin up a Collator