How to easily launch your 0G Labs node

BreizhNode
7 min readApr 18, 2024

--

ZeroGravity Launches Newton Testnet of Ultra-Scalable Modular AI Blockchain. The network is now available for node operators for an upcoming mainnet launch in Q3 2024.

This article can be read in French or English.
To access the French version, follow this
link.

I am BreizhNode, passionate about the world of blockchain and masternodes. I share my knowledge about this ecosystem through my articles. To stay updated on my latest publications, I invite you to subscribe to my Medium.

Also, follow me on Twitter and check out my videos on YouTube.

Join me on the BreizhNode community Discord to discuss nodes, staking, and discover alpha opportunities!

Introduction

0G is a modular blockchain tailored for high-data AI applications, offering infinitely scalable architecture and efficient data storage solutions to revolutionize AI use on blockchain.

https://0g.ai/

The project’s momentum is underscored by a successful $35 million funding round, positioning it as a pivotal player in blockchain innovation for AI.

1- VPS Configuration

To deploy your node, you have two options: hosting it on your own computer or setting it up on a Virtual Private Server (VPS), the latter being perfect for hosting websites, applications, or nodes.

Personally, I chose Contabo, a renowned VPS provider, for its reliability and performance.

The required configuration to run a 0G node demands an little level of setup.

Therefore, I recommend the Cloud VPS 4.
If you wish to run additional nodes on your VPS, consider moving to the next tier up.

Now it’s your turn…

To order your Contabo VPS, you can click on this link.

It’s an affiliate link, with no additional cost to you, which allows me to support my work and provide valuable content.

Opt for a 1.6 TB storage capacity and select the Ubuntu 22.04 image for your configuration.

Once you have completed the payment process, you will receive an order confirmation email. Please wait to receive a second email containing information about your VPS, including your login credentials.

To connect to your VPS, I recommend following this detailed tutorial. You will need to download the Putty software, which will allow you to establish a secure connection with your VPS and access its features.

2- Installation of Essential Components

Before diving into setting up your node, it’s crucial to update your VPS.
To do this, simply execute the following command in your VPS terminal:

sudo apt-get update && sudo apt-get upgrade -y
Copy the command and right-click in your terminal to paste it.

Download all these composants to run your node :

apt-get install git unzip wget snapd lz4 make -y

Set the timezone of your VPS to UTC to avoid mismatch errors :

timedatectl set-timezone UTC

You will also need to install the Go language. Start by downloading the Go folder (version 1.24.4 here) :

wget https://golang.org/dl/go1.21.4.linux-amd64.tar.gz

Extract your folder :

tar -C /usr/local -xzf go1.21.4.linux-amd64.tar.gz

Add Go to your environment:

sed -i '$ a export PATH=$PATH:/usr/local/go/bin' ~/.bashrc; source ~/.bashrc

And verify that Go has been correctly installed :

go version

3- Installation of the command terminal

Install the 0G command terminal :

git clone -b v0.3.1 https://github.com/0glabs/0g-chain.git
./0g-chain/networks/testnet/install.sh
source ~/.profile

Make sure you have installed the 0G command-line terminal correctly:

0gchaind --help

Set Chain ID :

0gchaind config chain-id zgtendermint_16600-2

4- Node initialization

Initiate the validator node by replacing <NAME> with the name you want to assign to your validator :

0gchaind init <your_validator_name> --chain-id zgtendermint_16600-2

Installed the Genesis file of the project:

rm ~/.0gchain/config/genesis.json
wget -P ~/.0gchain/config https://github.com/0glabs/0g-chain/releases/download/v0.2.3/genesis.json

Add peers to accelerate synchronization (provided by OG-lab):

sed -i '/^seeds =/c\seeds = "e371f26305869fd8294f6e57dc01ffbbd394a5ac@156.67.80.182:26656,f8e73164ef67ec5288f663b271d320f303832b49@149.102.147.164:12656,c45a79a6e28fbee2b35b55bc2e18644fe4d20bb8@62.171.131.80:12656,7baa9325f18259079d701d649d22221232dd7a8d@116.202.51.84:26656,cd1d5fc0f6f35d0ef7d640c33b5159d84d07bd5c@161.97.110.100:12656,dbb44850914d0507e082ea81efd32662f883b222@62.169.26.33:26656,3be5290378f4ef5a5793bde6f5b7cf198f215366@65.108.200.101:26656,908a7a4f23d8a0933dbf11cbb0dbfe36e16f7d03@185.209.228.241:26646,c0cfc7c9d0cab4562e1933adf9fcc62f659f1b78@94.16.105.248:13456,a9d070c0c5900c3734a57c985f06098088b46583@213.199.32.62:12656,ecd31d198e658512967d964d8b80c1c8cc29a1d4@5.189.182.240:12656,0a827d0e1966731fd8680490601f49e5e9dc7130@158.220.109.21:26656,b517215f5542d9978981d63b7b926f8d70d9c9db@62.171.167.145:12656,276186e07dd59c28306286156ce8738d357e761a@109.199.100.144:12656,a4cc54c65e2f14e1ac28103c816d6e4f8f4f06e0@65.108.6.59:26656"' /root/.0gchain/config/config.toml
sed -i '/^persistent_peers =/c\persistent_peers = "e371f26305869fd8294f6e57dc01ffbbd394a5ac@156.67.80.182:26656,f8e73164ef67ec5288f663b271d320f303832b49@149.102.147.164:12656,c45a79a6e28fbee2b35b55bc2e18644fe4d20bb8@62.171.131.80:12656,7baa9325f18259079d701d649d22221232dd7a8d@116.202.51.84:26656,cd1d5fc0f6f35d0ef7d640c33b5159d84d07bd5c@161.97.110.100:12656,dbb44850914d0507e082ea81efd32662f883b222@62.169.26.33:26656,3be5290378f4ef5a5793bde6f5b7cf198f215366@65.108.200.101:26656,908a7a4f23d8a0933dbf11cbb0dbfe36e16f7d03@185.209.228.241:26646,c0cfc7c9d0cab4562e1933adf9fcc62f659f1b78@94.16.105.248:13456,a9d070c0c5900c3734a57c985f06098088b46583@213.199.32.62:12656,ecd31d198e658512967d964d8b80c1c8cc29a1d4@5.189.182.240:12656,0a827d0e1966731fd8680490601f49e5e9dc7130@158.220.109.21:26656,b517215f5542d9978981d63b7b926f8d70d9c9db@62.171.167.145:12656,276186e07dd59c28306286156ce8738d357e761a@109.199.100.144:12656,a4cc54c65e2f14e1ac28103c816d6e4f8f4f06e0@65.108.6.59:26656"' /root/.0gchain/config/config.toml

5- Launching the node with Snapshot (Not update, proceed directly to step 6)

We will use a snapshot to download the entire 0G Labs blockchain.
We will use the snapshot provided by EasyNode.

Download the snapshot :

wget http://snapshots.easy-node.xyz/easynode-snapshot-0G-latest.tar.lz4

Backup of the validator.json file :

cp $HOME/.0gchain/data/priv_validator_state.json $HOME/.0gchain/priv_validator_state.json.backup

Reset the data :

0gchaind tendermint unsafe-reset-all --home $HOME/.0gchain --keep-addr-book

Extracting the snapshot file :

lz4 -d -c ./easynode-snapshot-0G-latest.tar.lz4 | tar -xf - -C $HOME/.0gchain

Restore your private keys:

mv $HOME/.0gchain/priv_validator_state.json.backup $HOME/.0gchain/data/priv_validator_state.json

6- Launch your Node

For increased stability, you’ll set up your node using systemd:

sudo tee /etc/systemd/system/zerog.service > /dev/null <<EOF
[Unit]
Description=0G Node
After=network.target

[Service]
User=root
ExecStart=/root/go/bin/0gchaind start --home /root/.0gchain --log_output_console
Restart=always
RestartSec=3
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target
EOF

Then start the node:

systemctl daemon-reload
systemctl enable zerog
systemctl start zerog

You can check your node’s log:

journalctl -fu zerog
To exit this screen, press CTRL+C.

7- Create your wallet

Create a 0G wallet.
Replace <NAME> with the name you want to give to your wallet:

0gchaind keys add <NAME> --eth
Enter a password.

To obtain your private key :

0gchaind keys unsafe-export-eth-key <NAME>
Enter your password

Then, to obtain your 0x wallet, required for claiming faucet rewards, change <EVMOSD_ADDRESS> with your evmosd address :

0gchaind debug addr <0g_ADDRESS>
My 0x adress is 0x61E6C73B279E074EF5CE366B0DCD51FBB3620162

Claim tokens from the project’s faucet:

https://faucet.0g.ai/

It will take 1 token to register your node as a validator.
The faucet distributes 1 token per request.

8- Validator Registration

Once you have enough tokens, you can register your node as a validator.

Replace <your_validator_name> with the name you want to give to your validator, and <NAME> with the name you have given to your wallet:

0gchaind tx staking create-validator \
--amount=1000000ua0gi \
--pubkey=$(0gchaind tendermint show-validator) \
--moniker="<NAME>" \
--chain-id=zgtendermint_16600-2 \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1" \
--from=<NAME> \
--gas=auto \
--gas-adjustment=1.4

The top 125 stacker validators will be active.

You can check your validator on Nodes Guru explorer :

9- Importing the evmos key

To import your evmos keys into the new version:

0gchaind keys import <NAME>

Thank you for taking the time to read my article.

If you have any additional questions or would like to discuss further, feel free to find me on Discord. You can also check out my videos on YouTube!

Don’t forget to subscribe to my Medium to stay informed about my new publications.

You can follow me on Twitter.

If you wish to support my work, I’ve created a dedicated wallet for this purpose:
=> 0x8AF4A2ec91469aBda8Fc36571D4f50A581215D29

You can also join the social media channels of the projects :

--

--

BreizhNode

Crypto, blockchain, and masternode enthusiast - Setting up your own node has never been easier - (French/English)