State sync
State sync lets a new node join a network without fetching and replaying all historical blocks. Instead, the node fetches a snapshot of the application state at a recent height. This can reduce the time 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 the node is not new, back up and clean up the existing node first.Skip this step on a new node.
$HOME/.sei, back up priv_validator_key.json and priv_validator_state.json:
priv_validator_state.json. Before you remove them, print the state-store section from app.toml:
ss-db-directory or evm-ss-db-directory points outside
$HOME/.sei/data, back up what you need from that directory. Then clear the
old state-store data there too. 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 the primary and secondary endpoints. You can use one of these RPC endpoints for state sync. ForSTATE_SYNC_RPC, use one of these endpoints:
- Sei Mainnet (pacific-1):
https://sei-rpc.polkachu.com:443orhttps://rpc.sei-apis.com:443 - Sei Testnet (atlantic-2):
https://sei-testnet-rpc.polkachu.com:443orhttps://rpc-testnet.sei-apis.com:443
STATE_SYNC_PEER, use these values as persistent-peers:
- Sei Mainnet (pacific-1):
- Sei Testnet (atlantic-2):
trust_height and trust_hash automatically. Each state sync snapshot is taken at a specific block height. The script follows best practice and sets the trust height earlier than the latest snapshot block height. This avoids backward verification.
Use this script:
state_sync.sh
ss-backend = "pebbledb". If the key
is missing, add it directly below [state-store] before you start seid.
Finally, start the daemon:
Trust period
Since v6.7.3, state sync uses a trust period built intoseid for each chain: 112h on Sei Mainnet, Sei Testnet, and the arctic-1 devnet, and 168h on other chains. The block that you set with trust-height and trust-hash must fall within this period. The script above picks a trust height within the last 100,000 blocks, which is well inside it.
seid ignores trust-period in the [statesync] section of config.toml. If the key is present, seid logs this warning at startup: statesync.trust-period is set in config.toml, but state sync uses the trust period built into seid for this chain; the setting is ignored and can be removed. Remove the key to clear the warning.
Snapshot format
Since v6.8.0, nodes produce state-sync snapshots in format2 and restore formats 1 and 2. Earlier releases reject format 2 snapshots, so state sync a node with the current release.
Troubleshooting statesync
Q: I cannot connect to the state sync URL. A: Try a different state sync URL, and report the problem in the Sei Tech Chat. Q: State sync finishes, but I getAppHash errors as soon as regular block sync starts.
A: Make sure that you use the latest version of the chain node when you run state sync.
Q: State sync stops at random.
A: State sync is sometimes unreliable. If it stops, start it again. It can take approximately 4 to 5 attempts. If you still have problems, ask for help in the Sei Tech Chat.