InuX Dev
  • 🤝Introduction
  • Getting started
    • Blockchain Node
    • Prerequisites
  • Artela
    • Installation
    • State Sync
    • Useful Commands
  • 0g
    • Installation
    • Sync
    • Public
Powered by GitBook
On this page
  • Snapshot
  • State Sync
  • Address Book
  • Genesis
  1. 0g

Sync

Snapshot

updated every 6 hours, starting from 00:00 UTC

# install dependencies, if needed
sudo apt update && sudo apt install lz4 -y

sudo systemctl stop 0gchaind
cp $HOME/.0gchain/data/priv_validator_state.json $HOME/.0gchain/priv_validator_state.json.backup
rm -rf $HOME/.0gchain/data

URL=https://snapshot.inux.dev/0g/zgtendermint_16600-1_latest.tar.lz4
curl -L $URL | lz4 -dc - | tar -xf - -C $HOME/.0gchain

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

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

State Sync

sudo systemctl stop 0gchaind

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

SNAP_RPC="https://0g-testnet-rpc.stake-town.com:443"

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

PEERS="dfcad28c8ba5162690b5cc11ef6c3acd4f1da964@65.109.65.248:40656"
sed -i 's|^persistent_peers *=.*|persistent_peers = "'$PEERS'"|' $HOME/.0gchain/config/config.toml

CONFIG_TOML=$HOME/.0gchain/config/config.toml
sed -i 's|^enable *=.*|enable = true|' $CONFIG_TOML
sed -i 's|^rpc_servers *=.*|rpc_servers = "'$SNAP_RPC,$SNAP_RPC'"|' $CONFIG_TOML
sed -i 's|^trust_height *=.*|trust_height = '$BLOCK_HEIGHT'|' $CONFIG_TOML
sed -i 's|^trust_hash *=.*|trust_hash = "'$TRUST_HASH'"|' $CONFIG_TOML

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

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

Address Book

curl -Ls https://snapshot.inux.dev/0g/addrbook.json > $HOME/.0gchain/config/addrbook.json

Genesis

curl -Ls https://snapshot.inux.dev/0g/genesis.json > $HOME/.0gchain/config/g
PreviousInstallationNextPublic

Last updated 11 months ago