logo

0G Node Installation Guide

Dependencies Installation

bash
# Install dependencies for building from source sudo apt update sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y

Install Go

We will use Go v1.21.6 as example here.
bash
# Install Go sudo rm -rf /usr/local/go curl -L https://go.dev/dl/go1.21.6.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile source .bash_profile # Check Go version go version

Install Node

Install the current version of node binary.
bash
# Clone project repository cd && rm -rf 0g-chain git clone https://github.com/0glabs/0g-chain cd 0g-chain git checkout v0.2.5 # Build binary make install

Configure Node

Initialize Node

Please replace YOUR_MONIKER with your own moniker.
bash
# Initialize the node 0gchaind init "Your Node Name" --chain-id zgtendermint_16600-2

Download Genesis and Addrbook file

bash
# Download genesis and addrbook files curl -L https://snapshots-testnet.nodejumper.io/0g-testnet/genesis.json > $HOME/.0gchain/config/genesis.json curl -L https://snapshots-testnet.nodejumper.io/0g-testnet/addrbook.json > $HOME/.0gchain/config/addrbook.json wget -O $HOME/.0gchain/config/genesis.json https://server-5.itrocket.net/testnet/og/genesis.json wget -O $HOME/.0gchain/config/addrbook.json https://server-5.itrocket.net/testnet/og/addrbook.json

Configure config.toml and app.toml

bash
# set seeds and peers SEEDS="8f21742ea5487da6e0697ba7d7b36961d3599567@og-testnet-seed.itrocket.net:47656" PEERS="80fa309afab4a35323018ac70a40a446d3ae9caf@og-testnet-peer.itrocket.net:11656,698e1680e11f41dec6d99e757402875023edac53@62.171.166.223:12656,0ae19691f97f5797694c253bc06c79c8b58ea2a8@85.190.242.81:26656,56ee4c337848a70a43887531b5f1ca211bac1a34@185.187.170.125:26656,593f012c2f496c3e3972e4c302e6c5d3bfef1a2a@38.242.197.125:26656,fa08f548e8d34b6c72ed9e7495a59ae6be656da8@109.199.97.178:12656,c85eaa1b3cbe4d7fb19138e5a5dc4111491e6e03@115.78.229.59:10156,9dbb76298d1625ebcc47d08fa7e7911967b63b61@45.159.221.57:26656,c0d35052a7612d992f721b25f186a5d1f569405e@195.201.194.188:26656,8bd2797c8ece0f099a1c31f98e5648d192d8cd54@38.242.146.162:26656,5bb50b80f855b343ac9d8957055fd44b8c51667e@135.181.229.232:31656,ffdf7a8cc6dbbd22e25b1590f61da149349bdc2e@135.181.229.206:26656,0e44ddb20380bc06f489b8a58f6cb634c208d4e8@136.243.43.106:26656,5e098c96e69e3e2a943b923eda791ba34543f792@116.202.210.96:26656,928f42a91548484f35a5c98aa9dcb25fb1790a70@65.21.46.201:26656,7e7ca71ae2a6b97ba31af673355f0b3ba9cbbc23@213.199.43.252:26656" sed -i -e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*seeds *=.*/seeds = \"$SEEDS\"/}" \ -e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*persistent_peers *=.*/persistent_peers = \"$PEERS\"/}" $HOME/.0gchain/config/config.toml # Set minimum gas price sed -i -e 's|^minimum-gas-prices *=.*|minimum-gas-prices = "0.0025ua0gi"|' $HOME/.0gchain/config/app.toml # Set pruning sed -i \ -e 's|^pruning *=.*|pruning = "custom"|' \ -e 's|^pruning-keep-recent *=.*|pruning-keep-recent = "100"|' \ -e 's|^pruning-interval *=.*|pruning-interval = "17"|' \ $HOME/.0gchain/config/app.toml

Download Snapshot

bash
# Download latest chain data snapshot curl https://server-5.itrocket.net/testnet/og/og_2024-08-01_486354_snap.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.0gchain curl https://snapshots-testnet.nodejumper.io/0g-testnet/0g-testnet_latest.tar.lz4" | lz4 -dc - | tar -xf - -C "$HOME/.0gchain

Launch Node

Create Service File

Create a 0gchaind.service file in the /etc/systemd/system folder with the following code snippet. Make sure to replace USER with your Linux user name. You need sudo previlege to do this step.
bash
# create service file sudo tee /etc/systemd/system/0gchaind.service > /dev/null <<EOF [Unit] Description=0G node After=network-online.target [Service] User=$USER WorkingDirectory=$HOME/.0gchain ExecStart=$(which 0gchaind) start --home $HOME/.0gchain Restart=on-failure RestartSec=5 LimitNOFILE=65535 [Install] WantedBy=multi-user.target EOF

Start Node Service

bash
# Enable service sudo systemctl enable 0gchaind.service # Start service sudo service 0gchaind start # Check logs sudo journalctl -u 0gchaind.service -f --no-hostname -o cat # or tail -f $HOME/.0gchain/log/chain.log

Create Validator

Add New Key

bash
# Add New Key 0gchaind keys add wallet # Recover Existing Key 0gchaind keys add wallet --recover

EVM Address

bash
echo "0x$(0gchaind debug addr $(0gchaind keys show wallet -a) | grep hex | awk '{print $3}')"

Faucet

And then request tokens from the faucet to your address (EVM Address) above.
Faucet - 0G Testnet
0G Testnet Facuet

Create New Validator

bash
# Create New Validator 0gchaind tx staking create-validator \ --amount=1000000ua0gi \ --pubkey=$(0gchaind tendermint show-validator) \ --moniker="Moniker" \ --identity="" \ --details="I love BLockchain" \ --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=wallet \ --gas-adjustment=1.5 \ --gas=auto \ --fees=800ua0gi \ -y # Create New Validator 0gchaind tx staking create-validator \ --amount=999000ua0gi \ --pubkey=$(0gchaind tendermint show-validator) \ --moniker="MurphyNode" \ --identity=A6BA1EDB718724AE \ --website="https://murphynode.com" \ --details="Empowering Trust, Securing the Future: MurphyNode Validators" \ --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=wallet \ --gas-adjustment=1.5 \ --gas=auto \ --fees=800ua0gi \ -y

Check Validator on Nodes.Guru

Validators Overview - 0g (A0GI) Blockchain Explorer
Meet the validators powering the 0g (A0GI) blockchain. View their performance, staked amount, and rewards.
Validators Overview - 0g (A0GI) Blockchain Explorer

Edit Existing Validator

bash
# Edit Existing Validator 0gchaind tx staking edit-validator \ --new-moniker="Moniker" \ --identity="" \ --details="I love BLockchain" \ --chain-id=zgtendermint_16600-2 \ --commission-rate=0.1 \ --from=wallet \ --gas-adjustment=1.5 \ --gas=auto \ --fees=800ua0gi \ -y

Video guide: