Statesync
Got questions or need help with using state-sync properly?
Visit the Secret Network Discord here and ask in #node-discussion or #node-support for help
A complete to go command that should fit most needs can be found at Fast State-sync script. Be aware that this script can also fail or cause problems. In that case please ask for help in the channels above.
Statesync is a module built into the Cosmos SDK to allow validators to rapidly join the network by syncing your node with a snapshot enabled RPC from a trusted block height.
This greatly reduces the time required for a node to sync with the network from days to minutes. The limitations of this are that there is not a full transaction history, just the most recent state that the state-sync RPC has stored. An advantage of state-sync is that the database is very small in comparison to a fully synced node, therefore using state-sync to re-sync your node to the network can help keep running costs lower by minimizing storage usage.
By syncing to the network with state-sync, a node can avoid having to go through all the upgrade procedures and can sync with the most recent binary only.
Mainnet Statesync
This documentation assumes you have followed the instructions for Running a Full Node.
First, adjust the configuration to be compatible with state-sync:
Set IAVL-disable-fastnode
IAVL fast node must be disabled, otherwise the daemon will attempt to upgrade the database whil state sync is occuring.
Set correct snapshot-interval
To ensure that state-sync works on your node, it has to look for the correct snapshots that the snapshot RPC provides.
Assign And Verify Variables
SNAP_RPC is the RPC node endpoint that is used for statesyncing
Set the state-sync BLOCK_HEIGHT
and fetch the TRUST_HASH
from the snapshot RPC. The BLOCK_HEIGHT
to sync is determined by finding the latest block that's a multiple of snapshot-interval.
The output should be similar to:
Set Variables In ~/.secretd/config/config.toml
Reset Database And Stop Node
Got questions or need help with using statesync properly?
You can find help in Telegram here
Visit the Secret Network Discord here and ask in #node-discussion or #node-support for help
This will erase your node database. If you are already running validator, be sure you backed up your config/priv_validator_key.json
prior to running unsafe-reset-all
.
It is recommended to copy the signing state of the node by coping data/priv_validator_state.json
and only running unsafe-reset-all
to avoid potential double signing.
The code below stops the node, resets the temporary directory and resets the node into a fresh state.
Restart Node And Check Logs
This generally takes several minutes to complete, but has been known to take up to 24 hours. To better help the process along, add seeds.
In case state-sync fails
When state-sync fails, you can restart the process and try again using the condensed script below. This usually fixes some of the random problems with it:
Fast State-sync script
To safe time, you can use this script to quickly init everything you need for statesync. Please be aware that this might be dangerous if you have a validator.
Last updated
Was this helpful?