# Current version used in doc
Binary: 0gchaind
Chain-id: zgtendermint_16600-2
Version: 0.2.3
Service Name : 0gd.service
Chain Explorer : https://testnet.0g.explorers.guru/
# Set TCP, GRPC, GRPC Web ports to app.toml
sed -i \
-e "/\[api\]/,/^\[/{s/\(address = \"tcp:\/\/\)\([^:]*\):\([0-9]*\)\(\".*\)/\1\2:$API_PORT\4/}" \
-e "/\[grpc\]/,/^\[/{s/\(address = \"\)\([^:]*\):\([0-9]*\)\(\".*\)/\1\2:$GRPC_PORT\4/}" \
-e "/\[grpc-web\]/,/^\[/{s/\(address = \"\)\([^:]*\):\([0-9]*\)\(\".*\)/\1\2:$GRPC_WEB_PORT\4/}" $HOME/.0gchain/config/app.toml
# Optional pruning setting - set it if you want to save storage space
sed -i.bak -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.0gchain/config/app.toml
sed -i.bak -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.0gchain/config/app.toml
sed -i.bak -e "s/^pruning-interval *=.*/pruning-interval = \"10\"/" $HOME/.0gchain/config/app.toml
# Set gas price to app.toml
sed -i "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0ua0gi\"/" $HOME/.0gchain/config/app.toml
# Set indexer to config.toml
sed -i "s/^indexer *=.*/indexer = \"kv\"/" $HOME/.0gchain/config/config.toml
# Set json-rpc to app.toml
sed -i \
-e 's/address = "127.0.0.1:8545"/address = "0.0.0.0:8545"/' \
-e 's|^api = ".*"|api = "eth,txpool,personal,net,debug,web3"|' \
$HOME/.0gchain/config/app.toml
Create 0gd service for your node to run in the background
0gchaind keys add $WALLET_NAME --eth
# DO NOT FORGET TO SAVE THE SEED PHRASE & YOUR PASSPHRASE YOU SET FOR THIS WALLET
# You can add --recover flag to restore existing key instead of creating
Extract the 0x address and use it for receiving testnet token
The command below is to delegate 1 A0GI to your validator node, you may change the amount as you wish
0gchaind tx staking delegate $(0gchaind keys show $WALLET_NAME --bech val -a) 1000000ua0gi \
--from $WALLET_NAME \
--chain-id zgtendermint_16600-2 \
--gas-adjustment 1.4 \
--gas auto \
--gas-prices 0.0025ua0gi \
-y
Create backup for Nodeβs important files
In the case of hardfork or you would like to migrate your validator to another server. We must make sure that we have all essential files ready.
# download script from gist.github and run 0g-backup.sh
curl -o $HOME/.0gchain/0g-backup.sh https://gist.githubusercontent.com/nodecattel/5d2682e7fce4179e10521f00d9699fa5/raw/bcfcd4492af1d3e59809fd38ed0ffb9be7b3b10a/0g-backup.sh
chmod +x $HOME/.0gchain/0g-backup.sh
# Execute the script
$HOME/.0gchain/0g-backup.sh
Your backup files will be available at $HOME/0g-chain-backup
Upgrade 0g validator node hardfork from v0.1.0
# stop the validator node
sudo systemctl stop 0gd
# remove the previous cloned repo
rm -rf $HOME/0g-chain
# clone new source code and compile new version
cd $HOME
git clone -b v0.2.3 https://github.com/0glabs/0g-chain
cd 0g-chain
git checkout tags/v0.2.3
make install
0gchaind version
Once it fully update the 0gchaind binary should be version 0.2.3
- Set new CHAIN-ID
0gchaind config chain-id zgtendermint_16600-2
- Set 0G chain v2 newton testnet SEEDS
SEEDS="81987895a11f6689ada254c6b57932ab7ed909b6@54.241.167.190:26656,010fb4de28667725a4fef26cdc7f9452cc34b16d@54.176.175.48:26656,e9b4bc203197b62cc7e6a80a64742e752f4210d5@54.193.250.204:26656,68b9145889e7576b652ca68d985826abd46ad660@18.166.164.232:26656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/" $HOME/.0gchain/config/config.toml
- Add NodeCattel's peer for faster discovery
PEERS="6122859577a3465ba67065f3b63194cae67ef4c4@110.171.123.186:36656"
sed -i "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" "$HOME/.0gchain/config/config.toml"
- Alternatively, fetch the live peers from our node
In the case our node already have max peer connection, please fetch live peers instead of using our nodeβs peer
# download script from gist.github and run 0gpeers.sh
curl -o $HOME/.0gchain/0gpeers.sh https://gist.githubusercontent.com/nodecattel/8d28377a323a23d874d8bc64006ab2fc/raw/9a44bead876e6539efe0fd1b80050b837572d6d9/0gpeers.sh
chmod +x $HOME/.0gchain/0gpeers.sh
# Execute the script
$HOME/.0gchain/0gpeers.sh
- Becareful at these following steps will RESET all your data
You must make sure that you have all the important files backup in case there is something wrong.
Prepare new genesis file
# remove the outdated files
rm $HOME/.0gchain/config/addrbook.json $HOME/.0gchain/config/genesis.json
# download new genesis file
wget -P ~/.0gchain/config https://github.com/0glabs/0g-chain/releases/download/v0.2.3/genesis.json
0gchaind validate-genesis
*** Reset Node's data ***
# reset all node's data to pristine state
0gchaind tendermint unsafe-reset-all --home $HOME/.0gchain
0gchaind q staking validator $(0gchaind keys show $WALLET_NAME --bech val -a)
Run curl test to check for your RPC port if it's works properly
# set EXTERNAL_IP variable
EXTERNAL_IP=$(wget -qO- eth0.me)
# query for current block height (json-rpc)
curl -X POST http://$EXTERNAL_IP:8545 -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
# query for Net version (json-rpc)
curl -X POST http://$EXTERNAL_IP:8545 -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"net_version","params":[],"id":1}'
Result example
Current block height
{"jsonrpc":"2.0","id":1,"result":"0x66972"}
Net version (evm chain-id)
{"jsonrpc":"2.0","id":1,"result":"16600"}
Congratulation!! π»
Now you have completed your node for 0gchain and we will move on to creating your storage node next.
NodeGuru's explorer for checking latest block height
| | - use your 0x address to request
Once your validator is created you can look up your validator . Most likely it will be in inactive set as you will need enough stake to reach top 125 TVL validator. This is normal ~~~
Go to this step if you haven't already
Update the 0gd.service with additional setting
Once your node is fully synced do get token from the and again.