> For the complete documentation index, see [llms.txt](https://docs.validator247.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.validator247.com/testnet/0g_lab.md).

# 0G\_Lab

Info

> <https://x.com/0G_labs>
>
> <https://discord.gg/0glabs>
>
> <https://linktr.ee/0g_labs>

Explorer&#x20;

> <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="f878d40c538c8c23653a5b70f615f8dccec6fb9f@54.215.187.94:26656,9d88e34a436ec1b50155175bc6eba89e7a1f0e9a@213.199.61.18: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="vzzzzzz@gmail.com" \
--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    
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.validator247.com/testnet/0g_lab.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
