# Guide to Setting Up a 0g Validator Node

By [Carbon-12](https://paragraph.com/@carbon-12) · 2024-07-09

---

Follow Us
---------

[X](https://x.com/Carbon12nodes) | [Notion](https://snowy-toaster-c05.notion.site/Carbon-12-Blockchain-Validation-75eb266678344eb598c8af175bdfb703) | [Mirror](https://mirror.xyz/0xCe52723a9104C9AE78CaDC447eFa9c0B314751A8) | [Linktr](https://linktr.ee/carbon12nodes) | [Discord](https://discord.com/users/938709335784173588)

This guide will help you set up a 0g validator node based on the documentation available.

**Step 1: Hardware Requirements**

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

#### Step 2: Set Server Timezone to UTC

**Step 3: Install 0gchaind**

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

**Step 4: Set Chain ID**

    0gchaind config chain-id zgtendermint_16600-2
    

**Step 5: Initialize Node**

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

**Step 6: Copy Genesis File**

    sudo apt install -y unzip wget
    rm ~/.0gchain/config/genesis.json
    wget -P ~/.0gchain/config https://github.com/0glabs/0g-chain/releases/download/v0.2.3/genesis.json
    0gchaind validate-genesis
    

#### Step 7: Add Seed Nodes

Edit `$HOME/.0gchain/config/config.toml` and add the following 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"
    

**Step 8: Start Node**

    0gchaind start
    

**Step 9: Optimize Garbage Collection**

    export GOGC=900
    export GOMEMLIMIT=40GB
    0gchaind start
    

**Step 10: Create Validator**

    0gchaind keys add <key_name> --eth
    0gchaind keys unsafe-export-eth-key <key_name>
    0gchaind tx staking create-validator \
      --amount=<staking_amount>ua0gi \
      --pubkey=$(0gchaind tendermint show-validator) \
      --moniker="<your_validator_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=<key_name> \
      --gas=auto \
      --gas-adjustment=1.4
    0gchaind q staking validators -o json --limit=1000 | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '.tokens + " - " + .description.moniker' | sort -gr | nl
    

**Step 11: Unjail Validator (if necessary)**

    0gchaind tx slashing unjail --from <key_name> --gas=500000 --gas-prices=99999neuron -y
    

#### Step 12: Upgrade Node (if needed)

Reset data if upgrading to a breaking version:

Restart the node:

    rm $HOME/.0gchain/config/addrbook.json $HOME/.0gchain/config/genesis.json
    0gchaind tendermint unsafe-reset-all --home $HOME/.0gchain
    

#### Step 13: Migrate Node (if necessary)

Recover wallet account on the new server:

    0gchaind start
    

Transfer the following files to the new server:

*   `$HOME/xx.address`
    
*   `$HOME/xx.info`
    
*   `$HOME/keyhash`
    
*   `$HOME/config/priv_validator_key.json`
    

Ensure the node is synced to the latest block height before migration.

For detailed information and updates, refer to the [official 0g documentation](https://docs.0g.ai/0g-doc).

---

*Originally published on [Carbon-12](https://paragraph.com/@carbon-12/guide-to-setting-up-a-0g-validator-node)*
