πŸ’ 0G_Lab

First Modular AI chain: Starting with the fastest programmable DA layer for AI dapps

Info

https://x.com/0G_labs

https://discord.gg/0glabs

https://linktr.ee/0g_labs

Explorer

https://explorer.validator247.com/zero-gravity-testnet/staking

https://0g-testnet-rpc.validator247.com

Hardware Requirement

- Memory: 64 GB
- CPU: 8 cores
- Disk: 1 TB NVME SSD
- Bandwidth: 100 MBps for Download / Upload

Installation guide

Install required packages

sudo apt update && \
sudo apt install curl git jq build-essential gcc unzip wget lz4 -y

Install Go

cd $HOME && \
ver="1.21.3" && \
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz" && \
sudo rm -rf /usr/local/go && \
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz" && \
rm "go$ver.linux-amd64.tar.gz" && \
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile && \
source $HOME/.bash_profile && \
go version

Install 0gchaind

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

Set Chain ID

0gchaind config chain-id zgtendermint_16600-1

Initialize Node

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

Download Genesis File & Download Addrbook

wget https://raw.githubusercontent.com/Validator247/0G-Lab-chain-id-16600-1/main/genesis.json
wget https://raw.githubusercontent.com/Validator247/0G-Lab-chain-id-16600-1/main/addrbook.json

Seeds & Peers

PEERS="[email protected]:26656,[email protected]:26656"
SEEDS=""
sed -i -e "s/^seeds =./seeds = "$SEEDS"/; s/^persistent_peers =./persistent_peers = "$PEERS"/" $HOME/.0gchain/config/config.toml

Create Service

sudo tee /etc/systemd/system/0gchaind.service > /dev/null << EOF
[Unit]
Description=0G node service
After=network-online.target
[Service]
User=root
ExecStart=/root/go/bin/0gchaind start
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

sudo systemctl enable 0gchaind
sudo systemctl daemon-reload

State Sync

sudo systemctl stop 0gchaind

SNAP_RPC="https://0g-testnet-rpc.validator247.com"

cp $HOME/.0gchain/data/priv_validator_state.json $HOME/.0gchain/priv_validator_state.json.backup
0gchaind tendermint unsafe-reset-all --home ~/.warden/ --keep-addr-book

LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" ~/.0gchain/config/config.toml
more ~/.0gcaind/config/config.toml | grep 'rpc_servers'
more ~/.0gchain/config/config.toml | grep 'trust_height'
more ~/.0gchain/config/config.toml | grep 'trust_hash'

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

sudo systemctl restart 0gchaind && journalctl -u 0gchaind -f -o cat

Launch Node

sudo systemctl restart 0gchaind && journalctl -u 0gchaind -f -o cat

Service command

sudo systemctl daemon-reload

sudo systemctl enable 0gchaind

sudo systemctl disable 0gchaind

sudo systemctl start 0gchaind

sudo systemctl stop 0gchaind

sudo systemctl restart 0gchaind

sudo systemctl status 0gchaind

sudo journalctl -u 0gchaind -f -o cat

Create wallet

0gchaind keys add wallet --eth

get your key’s private key

0gchaind keys unsafe-export-eth-key wallet

Convert from Cosmos wallet to evm

echo "0x$(0gchaind debug addr 0g1dywsndf7xh5n3l690cpgw67j8ekjy9wlp8z8dg | grep hex | awk '{print $3}')"    

Create Validator

0gchaind tx staking create-validator \
--amount=1000000ua0gi \
--pubkey=$(0gchaind tendermint show-validator) \
--moniker="nodename" \
--identity="keybase" \
--website="zzzzzzz" \
--security-contact="[email protected]" \
--details="love validator247" \
--chain-id=zgtendermint_16600-1 \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation=1 \
--from=wallet \
--fees=10000ua0gi \
--gas=300000 \
-y

Delegate your validator ( Change the information as appropriate for your node )

0gchaind tx staking delegate 0gvaloper1yrxeg4symqpfv5r3p9jemkwkgm284j5xgusn6g 980000ua0gi --chain-id=zgtendermint_16600-1 --from wallet --fees=20000ua0gi -y    

Last updated