Setup a Full node on CORD
If you’re building dApps or products on a Substrate-based chain like CORD or a custom Substrate implementation, you want the ability to run a node-as-a-back-end. This guide will show you how to connect to CORD network, but the same process applies to any other Substrate-based chain. First, let’s clarify the term full node.
A full node prunes historical states: all finalized blocks’ states older than a configurable number except the genesis block’s state. This is 256 blocks from the last finalized one by default. A pruned node this way requires much less space than an archive node. A full node could eventually rebuild every block’s state without additional information and become an archive node. Full nodes allow you to read the current state of the chain and to submit and validate extrinsics directly on the network without relying on a centralized infrastructure provider.
Using Docker for Full Node
Docker Info
💡 Install Docker
Follow the official Docker installation guide here to set up Docker on your machine.📌 Post-installation steps for Docker
post-installation procedures here shows you how to configure your host machine to work better with Docker.
- Update and Upgrade packages
sudo apt update -y && sudo apt upgrade -y
- The following command creates a directory called “cord” in the root directory, gives ownership of the directory to the user who executed the command, and grants rwx access on that directory.
sudo mkdir /cord && sudo chown $USER /cord && sudo chmod 777 /cord
- Generate node key and store it in
cord
directory
cd /cord && docker run -i -v $(pwd):/cord dhiway/cord:develop key generate-node-key --file /cord/node.key
- Download the chain specification into cord directory
#for linux:cd /cord && wget -c https://raw.githubusercontent.com/dhiway/confidex/main/confidex-alpha.json
#for mac:cd /cord && curl -O https://raw.githubusercontent.com/dhiway/confidex/main/confidex-alpha.json
- Run CORD using the following command. name-you-see-in-telemetry should be changed to name of your choice before running the command.
sudo docker run --detach --restart unless-stopped -v /cord:/cord --name cord --network host dhiway/cord:dev_9 --name name-you-see-in-telemetry --base-path /cord/ --chain /cord/confidex-alpha.json --node-key-file /cord/node.key --port 30333 --rpc-port 9933 --prometheus-port 9615 --rpc-methods=Safe --rpc-cors all --state-pruning 100 --blocks-pruning 100 --prometheus-external
- If the CORD is up and running, run the following command by replacing
secret seed
with the secret you generated during the account creation
sudo docker run -v /cord:/cord --rm dhiway/cord:develop \ key generate-session-keys \ --chain=/cord/confidex-alpha.json \ --suri "secret seed" \ -d /cord/
- Check logs
sudo docker logs container-id
To verify that your node is live and synchronized, head to https://telemetry.cord.network and find your node. Note that this will show all nodes on the CORD network, which is why it is important to select a unique name!