<aside> 👉🏻 Familiarity with Linux/Mac command line is essential.

</aside>

Overview

Darwinia Collators play a crucial role in the Darwinia Network as they are responsible for block production and ensuring block liveness. These Collators collect transactions from users on the parachain and generate state transition proofs for Relay Chain validators. In essence, they provide blocks to validators on the relay chain for finalization.

To learn more about Collators and their functions, you can click here. This resource will provide you with detailed information on the topic.

<aside> 👉🏻 The steps outlined below are based on Darwinia, and the steps for Crab are similar.

</aside>

Run Collator Node

Recommended Hardware

Download Snapshot

It's important to note that there is a faster method to expedite the syncing process**.** You can achieve this by downloading the snapshot blockchain data and moving it to the current node database location and greatly speeding up the node sync process. Click here for more detailed instructions.

Start The Collator Node

  1. Open a terminal shell on your computer

  2. Create a work dirctory

    Let's create a directory called run-collator-node to store everything needed for setting up an collator node, including the downloaded node binary and the chain database.

    mkdir run-collator-node && cd run-collator-node
    
  3. Download and decompress the binary.

    As of the time of writing this doc(2023-09-04), the latest version of the Darwinia node is v6.4.0. Please ensure that you check for the latest version when running your own node.

    wget [<https://github.com/darwinia-network/darwinia/releases/download/v6.4.0/darwinia-x86_64-linux-gnu.tar.bz2>](<https://github.com/darwinia-network/darwinia/releases/download/v6.3.4/darwinia-x86_64-linux-gnu.tar.bz2>)
    tar xvf darwinia-x86_64-linux-gnu.tar.bz2
    
  4. Start the node by running the following command:

    ./darwinia --chain darwinia --base-path /data/darwinia-collator --frontier-backend-type sql --collator
    
  5. Verify your node is up and running successfully by reviewing the output displayed in the terminal. The terminal should display output similar to this:

    Loading genesis from `/home/bear/coding/rust-space/test-docs/run-collator-node/darwinia2.json`
    2023-10-16 16:14:20 Darwinia    
    2023-10-16 16:14:20 ✌️  version 6.4.0-2f0941d6f2a    
    2023-10-16 16:14:20 ❤️  by Darwinia Network <[email protected]>, 2018-2023    
    2023-10-16 16:14:20 📋 Chain specification: Darwinia2    
    2023-10-16 16:14:20 🏷  Node name: adventurous-throne-2027    
    2023-10-16 16:14:20 👤 Role: AUTHORITY    
    2023-10-16 16:14:20 💾 Database: RocksDb at /data/darwinia-collator/chains/darwinia2/db/full    
    2023-10-16 16:14:20 ⛓  Native runtime: Darwinia2-6400 (DarwiniaOfficialRust-0.tx0.au0)    
    2023-10-16 16:14:21 Parachain id: Id(2046)    
    2023-10-16 16:14:21 Parachain Account: 2qiDxtPxw1BsbLwujRn5Q2352CaDPY8UMZi4iHBfPXo6FgHd    
    2023-10-16 16:14:21 Parachain genesis state: 0x000000000000000000000000000000000000000000000000000000000000000000de42f41f451c1be24559be5f93ed0a74f2b6a65d0c965fec4647e165d1947b7103170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400    
    2023-10-16 16:14:21 Is collating: yes    
    2023-10-16 16:14:23 [Parachain] 📑 Connection configuration: SqliteBackendConfig { path: "/data/darwinia-collator/chains/darwinia2/sql/frontier.db3", create_if_missing: true, thread_count: 4, cache_size: 209715200 }    
    2023-10-16 16:14:25 [Relaychain] 🏷  Local node identity is: 12D3KooWJXgiE8JJSv6fCiEmkEjGAewNYh2HPCSJZuKMZrJUwWrR    
    2023-10-16 16:14:25 [Relaychain] 💻 Operating system: linux    
    2023-10-16 16:14:25 [Relaychain] 💻 CPU architecture: x86_64    
    2023-10-16 16:14:25 [Relaychain] 💻 Target environment: gnu    
    2023-10-16 16:14:25 [Relaychain] 💻 CPU: AMD Ryzen 7 5700G with Radeon Graphics    
    2023-10-16 16:14:25 [Relaychain] 💻 CPU cores: 8    
    2023-10-16 16:14:25 [Relaychain] 💻 Memory: 63578MB    
    2023-10-16 16:14:25 [Relaychain] 💻 Kernel: 6.2.0-33-generic    
    2023-10-16 16:14:25 [Relaychain] 💻 Linux distribution: Ubuntu 22.04.3 LTS    
    2023-10-16 16:14:25 [Relaychain] 💻 Virtual machine: no    
    2023-10-16 16:14:25 [Relaychain] 📦 Highest known block at #61195    
    2023-10-16 16:14:25 [Relaychain] 〽️ Prometheus exporter started at 127.0.0.1:9616    
    2023-10-16 16:14:25 [Relaychain] Running JSON-RPC server: addr=127.0.0.1:9945, allowed origins=["<http://localhost>:*", "<http://127.0.0.1>:*", "<https://localhost>:*", "<https://127.0.0.1>:*", "<https://polkadot.js.org>"]    
    2023-10-16 16:14:25 [Relaychain] 🏁 CPU score: 1.34 GiBs    
    2023-10-16 16:14:25 [Relaychain] 🏁 Memory score: 14.33 GiBs    
    2023-10-16 16:14:25 [Relaychain] 🏁 Disk score (seq. writes): 1.42 GiBs    
    2023-10-16 16:14:25 [Relaychain] 🏁 Disk score (rand. writes): 746.65 MiBs    
    2023-10-16 16:14:25 [Relaychain] Starting with an empty approval vote DB.
    2023-10-16 16:14:25 [Parachain] 🏷  Local node identity is: 12D3KooWLoBFJ5oRNmXU8SfSiSuA8vuFAwaS5PyMfdWCGvtXGYnJ    
    2023-10-16 16:14:25 [Parachain] 💻 Operating system: linux    
    2023-10-16 16:14:25 [Parachain] 💻 CPU architecture: x86_64    
    2023-10-16 16:14:25 [Parachain] 💻 Target environment: gnu    
    2023-10-16 16:14:25 [Parachain] 💻 CPU: AMD Ryzen 7 5700G with Radeon Graphics    
    2023-10-16 16:14:25 [Parachain] 💻 CPU cores: 8    
    2023-10-16 16:14:25 [Parachain] 💻 Memory: 63578MB    
    2023-10-16 16:14:25 [Parachain] 💻 Kernel: 6.2.0-33-generic    
    2023-10-16 16:14:25 [Parachain] 💻 Linux distribution: Ubuntu 22.04.3 LTS    
    2023-10-16 16:14:25 [Parachain] 💻 Virtual machine: no    
    2023-10-16 16:14:25 [Parachain] 📦 Highest known block at #18290    
    2023-10-16 16:14:25 [Parachain] Running JSON-RPC server: addr=127.0.0.1:9944, allowed origins=["<http://localhost>:*", "<http://127.0.0.1>:*", "<https://localhost>:*", "<https://127.0.0.1>:*", "<https://polkadot.js.org>"]    
    2023-10-16 16:14:25 [Parachain] 🏁 CPU score: 1.34 GiBs    
    2023-10-16 16:14:25 [Parachain] 🏁 Memory score: 14.33 GiBs    
    2023-10-16 16:14:25 [Parachain] 🏁 Disk score (seq. writes): 1.42 GiBs    
    2023-10-16 16:14:25 [Parachain] 🏁 Disk score (rand. writes): 746.65 MiBs    
    2023-10-16 16:14:25 [Parachain] 〽️ Prometheus exporter started at 127.0.0.1:9615    
    2023-10-16 16:14:25 [Parachain] 🔍 Discovered new external address for our node: /ip4/60.176.103.239/tcp/30333/p2p/12D3KooWLoBFJ5oRNmXU8SfSiSuA8vuFAwaS5PyMfdWCGvtXGYnJ    
    2023-10-16 16:14:26 [Relaychain] 🔍 Discovered new external address for our node: /ip4/60.176.103.239/tcp/30334/ws/p2p/12D3KooWJXgiE8JJSv6fCiEmkEjGAewNYh2HPCSJZuKMZrJUwWrR    
    2023-10-16 16:14:26 [Parachain] [pallet::message-gadget] invalid raw message root: [], return.    
    2023-10-16 16:14:26 [Parachain] [pallet::message-gadget] invalid raw message root: [], return.    
    2023-10-16 16:14:26 [Parachain] [pallet::message-gadget] invalid raw message root: [], return.    
    2023-10-16 16:14:26 [Parachain] [pallet::message-gadget] invalid raw message root: [], return.    
    2023-10-16 16:14:26 [Parachain] [pallet::message-gadget] invalid raw message root: [], return.    
    2023-10-16 16:14:26 [Parachain] [pallet::message-gadget] invalid raw message root: [], return.
    

    A collator operates a relay chain node alongside a parachain node. The status messages [Relaychain] ⚙️ Syncing and [Parachain] ⚙️ Syncing indicate that the node is currently in the process of syncing. You can refer to these logs to monitor the syncing progress. Given that the relay chain and parachain have been active for several years, the syncing process may take anywhere from one to three days to complete.

  6. Generate session key

    To generate your node session key, leave the node running in one terminal and open another terminal. Then, execute the following command:

    curl -X POST \\
         -H 'Content-Type: application/json' \\
         -d '{"id":1, "jsonrpc":"2.0", "method":"author_rotateKeys", "params":[]}' \\
         <http://127.0.0.1:9944>
    

    the output display like this:

    {"jsonrpc":"2.0","result":"0x846fa7e10413740d94281a496f9422447182cb6562ea8df8227dded1766b9163","id":1}
    

    0x846fa7e10413740d94281a496f9422447182cb6562ea8df8227dded1766b9163 is the generated session key. Please remember to securely store this key as it is necessary for registering as a collator in the staking app.

  7. Wait for the node sync process to complete

    Once the syncing process of the node is complete, you are just a step away from becoming a fully operational network collator. Keep an eye on your node's running terminal, and when you come across a message resembling the following, it signifies the completion of the syncing process.

    2023-07-25 02:43:30 [Relaychain] ✨ Imported #16547932 (0x3391…ab15)
    2023-07-25 02:43:31 [Parachain] ✨ Imported #636560 (0x2ea0…29d0)
    2023-07-25 02:43:35 [Relaychain] 💤 Idle (109 peers), best: #16547932 (0x3391…ab15), finalized #16547930 (0x7b6b…4c5d), ⬇ 326.8kiB/s ⬆ 203.2kiB/s
    2023-07-25 02:43:35 [Parachain] 💤 Idle (31 peers), best: #636559 (0x235e…ab71), finalized #636558 (0x03fc…a0f5), ⬇ 30.9kiB/s ⬆ 14.5kiB/s
    2023-07-25 02:43:36 [Relaychain] ✨ Imported #16547933 (0x7569…7c4d)
    2023-07-25 02:43:40 [Relaychain] 💤 Idle (109 peers), best: #16547933 (0x7569…7c4d), finalized #16547930 (0x7b6b…4c5d), ⬇ 305.1kiB/s ⬆ 272.8kiB/s
    2023-07-25 02:43:40 [Parachain] 💤 Idle (31 peers), best: #636559 (0x235e…ab71), finalized #636558 (0x03fc…a0f5), ⬇ 1.1kiB/s ⬆ 1.4kiB/s
    2023-07-25 02:43:42 [Relaychain] ✨ Imported #16547934 (0xa4aa…c72b)
    2023-07-25 02:43:43 [Parachain] ✨ Imported #636561 (0x97de…c0ba)
    2023-07-25 02:43:45 [Relaychain] 💤 Idle (109 peers), best: #16547934 (0xa4aa…c72b), finalized #16547931 (0x17bc…5121), ⬇ 364.1kiB/s ⬆ 296.6kiB/s
    2023-07-25 02:43:45 [Parachain] 💤 Idle (31 peers), best: #636560 (0x2ea0…29d0), finalized #636558 (0x03fc…a0f5), ⬇ 35.5kiB/s ⬆ 8.1kiB/s
    2023-07-25 02:43:48 [Relaychain] ✨ Imported #16547935 (0x9f0f…517e)
    2023-07-25 02:43:48 [Relaychain] ✨ Imported #16547935 (0x7892…a897)
    2023-07-25 02:43:50 [Relaychain] 💤 Idle (109 peers), best: #16547935 (0x9f0f…517e), finalized #16547932 (0x3391…ab15), ⬇ 466.0kiB/s ⬆ 301.9kiB/s
    2023-07-25 02:43:50 [Parachain] 💤 Idle (31 peers), best: #636560 (0x2ea0…29d0), finalized #636559 (0x235e…ab71), ⬇ 1.0kiB/s ⬆ 3.1kiB/s