🔌 Installation

💻 Hardware Requirements

ComponentsMinimum Requirements
CPU4
RAM8+ GB
STORAGE400 GB SSD

1️⃣ Installation packeges and dependencies

sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y

➡️ Go Installation

cd $HOME
VER="1.22.6"
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"
[ ! -f ~/.bash_profile ] && touch ~/.bash_profile
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin

➡️ Set Vars

You can replace 56 with anything you want. Please write 3 digits.

echo "export OG_PORT="56"" >> $HOME/.bash_profile
source $HOME/.bash_profile

2️⃣ Install node

wget https://zgchaind-test.s3.ap-east-1.amazonaws.com/0gchaind-linux-v0.3.0
chmod +x ./0gchaind-linux-v0.3.0
mkdir -p /root/.0gchain/cosmovisor/upgrades/v0.3.0/bin
sudo mv ./0gchaind-linux-v0.3.0 /root/.0gchain/cosmovisor/upgrades/v0.3.0/bin/0gchaind
wget https://github.com/0glabs/0g-chain/releases/download/v0.3.1.alpha.1/0gchaind-linux-v0.3.1.alpha.1
chmod +x ./0gchaind-linux-v0.3.1.alpha.1
mkdir -p /root/.0gchain/cosmovisor/upgrades/v0.3.1/bin
sudo mv ./0gchaind-linux-v0.3.1.alpha.1 /root/.0gchain/cosmovisor/upgrades/v0.3.1/bin/0gchaind
wget https://github.com/0glabs/0g-chain/releases/download/v0.4.0/0gchaind-linux-v0.4.0
chmod +x ./0gchaind-linux-v0.4.0
mkdir -p /root/.0gchain/cosmovisor/upgrades/v0.4.0/bin
sudo mv ./0gchaind-linux-v0.4.0 /root/.0gchain/cosmovisor/upgrades/v0.4.0/bin/0gchaind
sudo ln -sfn $HOME/.0gchain/cosmovisor/upgrades/v0.4.0 $HOME/.0gchain/cosmovisor/current
sudo ln -sfn $HOME/.0gchain/cosmovisor/current/bin/0gchaind /usr/local/bin/0gchaind
go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]

➡️ Create a service

sudo tee /etc/systemd/system/0gchaind.service > /dev/null << EOF
[Unit]
Description=0gchaind node service
After=network-online.target

[Service]
User=$USER
ExecStart=$(which cosmovisor) run start --log_output_console
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_HOME=$HOME/.0gchain"
Environment="DAEMON_NAME=0gchaind"
Environment="UNSAFE_SKIP_BACKUP=true"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/.0gchain/cosmovisor/current/bin"

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable 0gchaind

➡️ Initialize the node

0gchaind config chain-id zgtendermint_16600-2
0gchaind config keyring-backend os
0gchaind config node tcp://localhost:${OG_PORT}657
0gchaind init MONIKER-NAME --chain-id zgtendermint_16600-2

➡️ Genesis

rm ~/.0gchain/config/genesis.json
curl -Ls https://github.com/0glabs/0g-chain/releases/download/v0.2.3/genesis.json > $HOME/.0gchain/config/genesis.json

➡️Addrbook

wget -O $HOME/.0gchain/config/addrbook.json "https://server-5.itrocket.net/testnet/og/addrbook.json"

➡️ Gas Settings

sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0ua0gi"|g' $HOME/.0gchain/config/app.toml

➡️ Port

sed -i.bak -e "s%:1317%:${OG_PORT}317%g;
s%:8080%:${OG_PORT}080%g;
s%:9090%:${OG_PORT}090%g;
s%:9091%:${OG_PORT}091%g;
s%:8545%:${OG_PORT}545%g;
s%:8546%:${OG_PORT}546%g;
s%:6065%:${OG_PORT}065%g" $HOME/.0gchain/config/app.toml
sed -i.bak -e "s%:26658%:${OG_PORT}658%g;
s%:26657%:${OG_PORT}657%g;
s%:6060%:${OG_PORT}060%g;
s%:26656%:${OG_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${OG_PORT}656\"%;
s%:26660%:${OG_PORT}660%g" $HOME/.0gchain/config/config.toml

➡️ Peers and Seeds

SEEDS="8f21742ea5487da6e0697ba7d7b36961d3599567@og-testnet-seed.itrocket.net:47656"
PEERS="[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:18456,[email protected]:18456,[email protected]:26656,[email protected]:56656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:34656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:16656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.0gchain/config/config.toml

➡️ Pruning

sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.0gchain/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.0gchain/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"10\"/" $HOME/.0gchain/config/app.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.0gchain/config/config.toml

➡️ Starter Snap (Thx Itrocket)

0gchaind tendermint unsafe-reset-all --home $HOME/.0gchain

SNAPSHOT_URL="https://server-5.itrocket.net/testnet/og/"
LATEST_SNAPSHOT=$(curl -s $SNAPSHOT_URL | grep -oP 'og_\d{4}-\d{2}-\d{2}_\d+_snap\.tar\.lz4' | sort | tail -n 1)

if [ -n "$LATEST_SNAPSHOT" ]; then
  FULL_URL="${SNAPSHOT_URL}${LATEST_SNAPSHOT}"
  if curl -s --head "$FULL_URL" | head -n 1 | grep "200" > /dev/null; then
    curl "$FULL_URL" | lz4 -dc - | tar -xf - -C $HOME/.0gchain
  else
    echo "Snapshot URL not accessible"
  fi
else
  echo "No snapshot found"
fi

➡️ Let’s get started

sudo systemctl restart 0gchaind
journalctl -fu 0gchaind -o cat

➡️ Create wallet

0gchaind keys add wallet-name --eth

➡️ Import wallet

0gchaind keys add wallet-name --eth --recover

➡️ Import private key

0gchaind keys unsafe-export-eth-key wallet-name

➡️ Faucet

Faucet

➡️ Create Validator

cd $HOME
0gchaind tx staking create-validator \
  --amount=1000000ua0gi \
  --pubkey=$(0gchaind tendermint show-validator) \
  --moniker=MONIKER-YAZ \
  --chain-id=zgtendermint_16600-2 \
  --commission-rate=0.05 \
  --commission-max-rate=0.10 \
  --commission-max-change-rate=0.01 \
  --min-self-delegation=1 \
  --from=wallet-name \
  --identity="" \
  --website="" \
  --details="" \
  --node=http://localhost:${OG_PORT}657 \
  -y

➡️ Delegation

0gchaind tx staking delegate $(0gchaind keys show wallet-name --bech val -a)  ammount000000ua0gi --from wallet-name --node=http://localhost:${OG_PORT}657 -y

➡️ Complete deletion

cd $HOME
sudo systemctl stop 0gchaind
sudo systemctl disable 0gchaind
sudo rm -rf /etc/systemd/system/0gchaind.service
sudo systemctl daemon-reload
sudo rm -f /usr/local/bin/0gchaind
sudo rm -f $(which 0gchaind)
sudo rm -rf $HOME/.0gchain
sed -i "/OG_PORT_/d" $HOME/.bash_profile

➡️ Block check

local_height=$(curl -s localhost:${OG_PORT}657/status | jq -r .result.sync_info.latest_block_height); network_height=$(curl -s https://0g-testnet-rpc.mictonode.com/status | jq -r .result.sync_info.latest_block_height); blocks_left=$((network_height - local_height)); echo "Your node height: $local_height"; echo "Network height: $network_height"; echo "Blocks left: $blocks_left"
  • Your node height - the current block of your node
  • Network height - the last block of the network
  • Blocks left - how many blocks your node has left to sync.