Some familiarity with the Linux/Mac command line and Docker is required.
Overview
Darwinia Collators are members of the Darwinia Network responsible for producing blocks and supporting block liveness. They collect parachain transactions from users and produce state transition proofs for Relay Chain validators. In short, collators offer blocks to validators on the relay chain for finalization.
Learn more about Collator by clicking here.
Reward that a Dariwnia Collator Can Get
where
Networks
Network | Chain Name | Collators Max | Session Length |
Crab 2 | crab | 14 | 6 hours |
Darwinia 2 | darwinia | 10 | 6 hours |
The following steps are based on Crab 2. Darwiniaβs steps are similar.
Run Collator Node
Recommended Hardware
- RAM: 16 GB:
- Storage(SSD): 1 TB
Use Precompiled Binary
bash#!/bin/bash DARWINIA_HOME="$HOME/darwinia" DARWINIA_DATA_DIR="$DARWINIA_HOME/data" mkdir -p $DARWINIA_DATA_DIR # Download and extract the darwinia binary to your DARWINIA_HOME directory wget -P $DARWINIA_HOME https://github.com/darwinia-network/darwinia/releases/download/v6.0.0-1/darwinia2-x86_64-linux-gnu.tar.bz2 tar xvf $DARWINIA_HOME/darwinia2-x86_64-linux-gnu.tar.bz2 -C $DARWINIA_HOME rm $DARWINIA_HOME/darwinia2-x86_64-linux-gnu.tar.bz2 # Run $DARWINIA_HOME/darwinia \ --chain=crab \ --base-path=$DARWINIA_DATA_DIR \ --collator # Or, run by PM2 # pm2 start $DARWINIA_HOME/darwinia -- \ # --chain=crab \ # --base-path=$DARWINIA_DATA_DIR \ # --collator
To increase the high availability of your collator node, consider using process management tools like PM2.
error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
If you encounter this error, try the following method:
https://stackoverflow.com/questions/72133316/libssl-so-1-1-cannot-open-shared-object-file-no-such-file-or-directoryAlternatively, you can use Docker
bash#!/bin/bash DARWINIA_DATA_DIR="$HOME/darwinia/data" mkdir -p $DARWINIA_DATA_DIR chown -R 1000:1000 $DARWINIA_DATA_DIR docker run -dit \ --name collator \ -v $DARWINIA_DATA_DIR:/data ghcr.io/darwinia-network/darwinia:sha-a7ba402 \ --chain=crab \ --base-path=/data \ --collator
bashdocker logs -f --tail 10 collator
(Optional) Download History Kusama Data
The Kusama node may take up to 2 days to complete syncing. You can download the Kusama history data from a snapshot to accelerate the process. The download process may take approximately 1-2 hours.
bashsudo apt install lz4 wget -c https://ksm-rocksdb.polkashots.io/snapshot -O - | tar -I lz4 -xf - -C $DARWINIA_DATA_DIR/polkadot/chains/ksmcc3/ # for darwinia # wget -c https://dot-rocksdb.polkashots.io/snapshot -O - | tar -I lz4 -xf - -C $DARWINIA_DATA_DIR/polkadot/chains/polkadot
(Optional) Download History Crab2 Data
You also can download Crab2 data from snapshots. http://snapshots.crab.network/
bashsudo apt install zstd wget http://snapshots.crab.network/crab2-<LAST_SNAPSHOT>.tar.zst -O - | tar -I zstd -xf - -C $DARWINIA_DATA_DIR/chains/crab2
Prepare Session Key
- Generate a session key
Enter your Docker container first if you are using Docker,
docker exec -it collator bash
shellcurl -X POST \ -H 'Content-Type: application/json' \ -d '{"id":1, "jsonrpc":"2.0", "method":"author_rotateKeys", "params":[]}' \ http://127.0.0.1:9933
If everything is correct, this command will return the session key.
- Or, Insert your existing sr25519 key as the session key
bash#!/bin/bash SR_PHRASE="..." # Mnemonic Phrase SR_PUB_KEY="..." curl -H "Content-Type: application/json" \ --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["aura", "'"${SR_PHRASE}"'", "'"${SR_PUB_KEY}"'"],"id":1 }' \ "http://127.0.0.1:9933"
Set Session Key & Your Commission Rate
- Open the following URL in your browser, and connect to your wallet account:
- Steps:
Wait Until the Next Session
You are currently in the candidate collator waiting pool. If you rank among the top 14 when the next session begins (after up to 6 hours in Crab2), you will become a collator. Upon successfully performing your duties as a collator during the next session, you will be eligible for rewards.