logo

0gchain Node Snapshot Guide

This guide provides step-by-step instructions on setting up your 0gchain node using the latest snapshot. Follow each step carefully to ensure a smooth and successful setup.

Overview

Snapshots are a convenient way to quickly set up a new node by downloading a pre-synced version of the blockchain. This reduces the time needed for a full sync from scratch.

Snapshot Details

LATEST
BLOCK HEIGHT
SIZE
TIMESTAMP
DOWNLOAD
Latest Snapshot
521,319
6.89 GB
2024/08/04

Configuration Settings

For optimal performance and storage efficiency, apply the following configuration settings to your config.toml file:
  • Pruning Settings:
    • Use custom pruning to manage disk space effectively:
      toml
      # Prune Type pruning = "custom" # Prune Strategy pruning-keep-recent = "100" pruning-keep-every = "0" pruning-interval = "10"
  • Indexer Settings:
    • Disable the indexer if it's not needed to save resources:
      toml
      indexer = "null"

Snapshot Usage Instructions

  1. Prepare Your System
    1. Make sure your system is up to date and install the necessary tools:
      shell
      sudo apt update sudo apt install lz4 -y
  1. Stop the Node Service
    1. Before applying the snapshot, stop the node service to prevent data corruption:
      shell
      sudo systemctl stop 0gchaind
  1. Backup Important Files
    1. Backup the priv_validator_state.json file to ensure that your node's validator state is preserved:
      shell
      cp $HOME/.0gchain/data/priv_validator_state.json $HOME/.0gchain/priv_validator_state.json
  1. Reset the Node Data
    1. Depending on your specific setup, use one of the following commands to reset the node data:
      bash
      # For most tendermint chains 0gchaind unsafe-reset-all # For specific tendermint chains 0gchaind tendermint unsafe-reset-all --home $HOME/.0gchain --keep-addr-book
  1. Download and Extract the Snapshot
    1. Use the following command to download and extract the snapshot into the appropriate directory:
      shell
      wget https://snapshots.murphynode.net/0g/0G-20240804.tar.lz4 -O - | lz4 -dc - | tar -xf - -C $HOME/.0gchain
  1. Restore the Backup
    1. Restore the backup of the priv_validator_state.json file to its original location:
      bash
      mv $HOME/.0gchain/priv_validator_state.json $HOME/.0gchain/data/priv_validator_state.json
  1. Clean Up
    1. Remove any unnecessary files to keep your system tidy:
      bash
      rm -v 0G-20240804.tar.lz4
  1. Restart the Node Service
    1. Restart the node service and check the logs to ensure that everything is running smoothly:
      shell
      sudo systemctl restart 0gchaind sudo journalctl -u 0gchaind -f --no-hostname -o cat

Conclusion

Following these steps will set up your 0gchain node efficiently using the latest snapshot. Regularly updating your node with the latest snapshots helps keep your node in sync with the network while minimizing the time and resources required.
If you encounter any issues, please consult the community forums or reach out for support.

Powered by Notaku