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:
tomlindexer = "null"
Snapshot Usage Instructions
- Prepare Your System
Make sure your system is up to date and install the necessary tools:
shellsudo apt update sudo apt install lz4 -y
- Stop the Node Service
Before applying the snapshot, stop the node service to prevent data corruption:
shellsudo systemctl stop 0gchaind
- Backup Important Files
Backup the
priv_validator_state.json file to ensure that your node's validator state is preserved:shellcp $HOME/.0gchain/data/priv_validator_state.json $HOME/.0gchain/priv_validator_state.json
- Reset the Node Data
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
- Download and Extract the Snapshot
Use the following command to download and extract the snapshot into the appropriate directory:
shellwget https://snapshots.murphynode.net/0g/0G-20240804.tar.lz4 -O - | lz4 -dc - | tar -xf - -C $HOME/.0gchain
- Restore the Backup
Restore the backup of the
priv_validator_state.json file to its original location:bashmv $HOME/.0gchain/priv_validator_state.json $HOME/.0gchain/data/priv_validator_state.json
- Clean Up
Remove any unnecessary files to keep your system tidy:
bashrm -v 0G-20240804.tar.lz4
- Restart the Node Service
Restart the node service and check the logs to ensure that everything is running smoothly:
shellsudo 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.