Docker
A Docker container allow you to run easily a node without depending on the platform it is running on. This method should be reserved for users who already have experience with Docker containers.

Installation

If you don't already have, start by installing docker: How to install Docker on Ubuntu​
Create a local directory for the chain storage data and a dedicated user:
1
sudo mkdir /var/lib/astar
2
sudo useradd --no-create-home --shell /usr/sbin/nologin astar
3
sudo chown astar:astar /var/lib/astar
Copied!

Start Docker node

In this guide, we will start a container for both WS and RPC endpoints. If you want only one of those, just remove the unnecessary port and command.
Launch the docker node in detached mode:
Astar
Shiden
Shibuya
1
docker run -d \
2
--name astar-container \
3
-u $(id -u astar):$(id -g astar) \
4
-p 30333:30333 \
5
-p 9933:9933 \
6
-p 9944:9944 \
7
-v "/var/lib/astar/:/data" \
8
staketechnologies/astar-collator:latest \
9
astar-collator \
10
--pruning archive \
11
--name ${NODE_NAME} \
12
--chain astar \
13
--execution Wasm \
14
--base-path /data \
15
--rpc-cors=all \
16
--unsafe-rpc-external \
17
--ws-external \
18
--state-cache-size 1
Copied!
1
docker run -d \
2
--name shiden-container \
3
-u $(id -u astar):$(id -g astar) \
4
-p 30333:30333 \
5
-p 9933:9933 \
6
-p 9944:9944 \
7
-v "/var/lib/astar/:/data" \
8
staketechnologies/astar-collator:latest \
9
astar-collator \
10
--pruning archive \
11
--name ${NODE_NAME} \
12
--chain shiden \
13
--execution Wasm \
14
--base-path /data \
15
--rpc-cors=all \
16
--unsafe-rpc-external \
17
--ws-external \
18
--state-cache-size 1
Copied!
1
docker run -d \
2
--name shibuya-container \
3
-u $(id -u astar):$(id -g astar) \
4
-p 30333:30333 \
5
-p 9933:9933 \
6
-p 9944:9944 \
7
-v "/var/lib/astar/:/data" \
8
staketechnologies/astar-collator:latest \
9
astar-collator \
10
--parachain-id 1000 \
11
--pruning archive \
12
--name ${NODE_NAME} \
13
--chain shibuya \
14
--execution Wasm \
15
--base-path /data \
16
--rpc-cors=all \
17
--unsafe-rpc-external \
18
--ws-external \
19
--state-cache-size 1
Copied!
​
Do not forget to change ${NODE_NAME}
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.
Then, 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:

Extra operations

Get node logs

To get the last 100 lines from the node logs, use the following command:
Astar
Shiden
Shibuya
docker logs -f -n 100 $(docker ps -aq --filter name="astar-container")
docker logs -f -n 100 $(docker ps -aq --filter name="shiden-container")
docker logs -f -n 100 $(docker ps -aq --filter name="shibuya-container")

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.
To upgrade to the latest node version, stop and remove the actual container:
Astar
Shiden
Shibuya
docker stop $(docker ps -q --filter name="astar-container")
docker rm $(docker ps -a -q --filter name="astar-container")
docker stop $(docker ps -q --filter name="shiden-container")
docker rm $(docker ps -a -q --filter name="shiden-container")
docker stop $(docker ps -q --filter name="shibuya-container")
docker rm $(docker ps -a -q --filter name="shibuya-container")
Then start a new container with the start command. Chain data will be kept on your machine under var/lib/astar/.

Purge node

To start a new container from scratch without any chain data, just remove the container and wipe the chain data directory:
Astar
Shiden
Shibuya
1
docker rm -f $(docker ps -a -q --filter name="astar-container")
2
sudo rm -R /var/lib/astar/*
Copied!
1
docker rm -f $(docker ps -a -q --filter name="shiden-container")
2
sudo rm -R /var/lib/astar/*
Copied!
1
docker rm -f $(docker ps -a -q --filter name="shibuya-container")
2
sudo rm -R /var/lib/astar/*
Copied!
Then start a new container with the start command.

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!
Last modified 27d ago