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.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:
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
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.