Binary
In this guide, we will use the binary provided in Astar release. If you have experience with rust compilation, you can still compile the binary on your machine.

Let's get started

Let's start with updating our server. Connect to your server and update:
1
sudo apt-get update
2
sudo apt-get upgrade
3
sudo apt install -y adduser libfontconfig1
Copied!

Create dedicated user and directory

Download the latest release from Github:
1
wget $(curl -s https://api.github.com/repos/AstarNetwork/Astar/releases/latest | grep "tag_name" | awk '{print "https://github.com/PlasmNetwork/Plasm/releases/download/" substr($2, 2, length($2)-3) "/astar-collator-" substr($2, 3, length($2)-4) "-ubuntu-x86_64.tar.gz"}')
2
tar -xvf astar-collator*.tar.gz
Copied!
Create a dedicated user for the node and move the node binary:
1
sudo useradd --no-create-home --shell /usr/sbin/nologin astar
2
sudo mv ./astar-collator /usr/local/bin
3
sudo chmod +x /usr/local/bin/astar-collator
Copied!
Create a dedicated directory for the chain storage data:
1
sudo mkdir /var/lib/astar
2
sudo chown astar:astar /var/lib/astar
Copied!

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
1
sudo nano /etc/systemd/system/astar.service
Copied!
Add service parameters:
Astar
Shiden
Shibuya
1
[Unit]
2
Description=Astar Archive node
3
4
[Service]
5
User=astar
6
Group=astar
7
8
ExecStart=/usr/local/bin/astar-collator \
9
--pruning archive \
10
--rpc-cors all \
11
--name ${NODE_NAME} \
12
--chain astar \
13
--parachain-id 2006 \
14
--base-path /var/lib/astar \
15
--execution Wasm \
16
--unsafe-rpc-external \
17
--ws-external \
18
--state-cache-size 1
19
20
Restart=always
21
RestartSec=10
22
23
[Install]
24
WantedBy=multi-user.target
Copied!
1
[Unit]
2
Description=Shiden Archive node
3
4
[Service]
5
User=astar
6
Group=astar
7
8
ExecStart=/usr/local/bin/astar-collator \
9
--pruning archive \
10
--rpc-cors all \
11
--name ${NODE_NAME} \
12
--chain shiden \
13
--parachain-id 2007 \
14
--base-path /var/lib/astar \
15
--execution Wasm \
16
--unsafe-rpc-external \
17
--ws-external \
18
--state-cache-size 1
19
20
Restart=always
21
RestartSec=10
22
23
[Install]
24
WantedBy=multi-user.target
Copied!
1
[Unit]
2
Description=Shibuya Archive node
3
4
[Service]
5
User=astar
6
Group=astar
7
8
ExecStart=/usr/local/bin/astar-collator \
9
--pruning archive \
10
--rpc-cors all \
11
--name ${NODE_NAME} \
12
--chain shibuya \
13
--parachain-id 1000 \
14
--base-path /var/lib/astar \
15
--execution Wasm \
16
--unsafe-rpc-external \
17
--ws-external \
18
--state-cache-size 1
19
20
Restart=always
21
RestartSec=10
22
23
[Install]
24
WantedBy=multi-user.target
Copied!
Do not forget to change ${NODE_NAME}
Start the service:
1
sudo systemctl start astar.service
Copied!
Check the node log and that everything is syncing fine:
1
journalctl -f -u astar.service -n100
Copied!
Enable the service:
1
sudo systemctl enable astar.service
Copied!
You can test the node health through RPC port with this command:
1
curl -H "Content-Type: application/json" --data '{ "jsonrpc":"2.0", "method":"system_health", "params":[],"id":1 }' localhost:9933
Copied!

And then?

For any usage, wait for the chain to be fully sync by checking the node log.
It all depends about what you plan to do with your archive node.
  • In most cases, you will want to access node from outside. In this case, you need to set up a nginx server.
  • If you run your dapp on the same server than the node (recommended for testing purpose only), you can access it directly with the localhost address.
  • If you run the node locally for testing purpose, you can for example switch network into Polkadot.js portal and explore the chain:
Switch to local node

Extra operations

Get node logs

To get the last 100 lines from the node logs, use the following command:
1
journalctl -fu astar-collator -n100
Copied!

Indexers and oracles

To access data from indexers (lke The Graph) or Oracles (like Chainlink), you need to add the debug flags below to the node launch command, after the astar-collator line:
-l evm=debug,ethereum=debug,rpc=debug \

Upgrade node

When an upgrade is necessary, node operators are be notified in our Discord and Element group.
Download the latest release from Github:
1
wget $(curl -s https://api.github.com/repos/AstarNetwork/Astar/releases/latest | grep "tag_name" | awk '{print "https://github.com/PlasmNetwork/Plasm/releases/download/" substr($2, 2, length($2)-3) "/astar-collator-" substr($2, 3, length($2)-4) "-ubuntu-x86_64.tar.gz"}')
2
tar -xvf astar-collator*.tar.gz
Copied!
Move the new release binary and restart the service:
1
sudo mv ./astar-collator /usr/local/bin
2
sudo chmod +x /usr/local/bin/astar-collator
3
sudo systemctl restart astar.service
Copied!

Purge node

To start a node from scratch without any chain data, just wipe the chain data directory:
1
sudo systemctl stop astar.service
2
sudo rm -R /var/lib/astar/chains/astar/db*
3
sudo systemctl start astar.service
Copied!

Relay Chain snapshot

If you run your collator it not only needs to sync the mainnet chain but also the complete relay chain from Kusama / Polkadot. This can take up to 3-4 days. You can also use a snapshot of Kusama/Polkadot. You can download this here and will save a lot of time.
NOTE: know what you are doing when using snapshots!