Running a validator node in the 0G project involves several steps, including setting up the necessary environment, configuring the node, and ensuring it runs smoothly. Below is a comprehensive guide to help you through the process.
Update and Upgrade the System:
bashCode kopiëren
sudo apt update && sudo apt upgrade -y
Install Docker:
bashCode kopiëren
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] <https://download.docker.com/linux/ubuntu> $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce -y
Install Docker Compose:
bashCode kopiëren
sudo curl -L "<https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$>(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
Clone the Repository:
bashCode kopiëren
git clone <https://github.com/0G-Project/0g-validator-node.git>
cd 0g-validator-node
Environment Variables:
Create a .env
file in the project root directory and add the necessary environment variables. An example .env
file might look like this:
envCode kopiëren
NODE_NAME=your_node_name
NODE_KEY=your_node_key
P2P_PORT=30303
RPC_PORT=8545
Edit the Configuration Files:
docker-compose.yml
file if needed to match your specific configuration or network settings.Start the Node:
bashCode kopiëren
docker-compose up -d
Check the Logs:
To ensure that the node is running correctly, check the logs:
bashCode kopiëren
docker-compose logs -f
htop
, docker stats
, or other monitoring solutions.When updates are available, pull the latest changes from the repository and restart the node:
bashCode kopiëren
git pull
docker-compose down
docker-compose up -d