State Sync
State sync allows a new node to join a network by fetching a snapshot of the application state at a recent height instead of fetching and replaying all historical blocks. This can reduce the time needed to sync with the network from days to minutes.Do not use state sync to migrate an archive node. State sync starts from a recent height and does not preserve the earlier state-store versions. Follow the archive-node guidance in Move off RocksDB.
Clean Up
If you are not starting a node from fresh, then you need to do some backups and clean ups.Note: This step is not needed for fresh nodes.
$HOME/.sei, back up priv_validator_key.json and priv_validator_state.json:
priv_validator_state.json:
First, print the state-store section from app.toml:
ss-db-directory or evm-ss-db-directory points outside
$HOME/.sei/data, back up anything you need and clear the old state-store
data there as well. The commands below do not remove custom directories. A
PebbleDB state sync must not reuse RocksDB data.
Statesync script
Set up the RPC servers for primary and secondary endpoints. You can use one of these RPC endpoints for Statesyning ForSTATE_SYNC_RPC, pick:
- mainnet (pacific-1):
https://sei-rpc.polkachu.com:443orhttps://rpc.sei-apis.com:443 - testnet (atlantic-2):
https://sei-testnet-rpc.polkachu.com:443orhttps://rpc-testnet.sei-apis.com:443
STATE_SYNC_PEER, pick the below as persistent-peers:
- mainnet (pacific-1):
- testnet (atlantic-2):
trust_height and trust_hash automatically. Each statesync snapshot is created at a certain block height. The script uses the best practice here and sets the trust height to be earlier than the latest snapshot block height to avoid backward verifications.
Script that you can use:
state_sync.sh
ss-backend = "pebbledb". If the key
is absent, add it directly below [state-store] before you start seid.
Finally start the daemon:
Troubleshooting statesync
Q: I can’t connect to the state sync url. A: Try another statesync url in that case and inform us in the Sei Tech Chat. Q: The statesync finishes, but immediately getAppHash errors upon regular block syncing:
A: Make sure that you use the latest version of the chain node when you state-sync.
Q: The statesync randomly stops.
A: State-sync can be flaky at times, just try again. Please give it around 4-5 tries. Join our Sei Tech Chat for help if you have any issues.