Statesync

Network: Testnet | Chain ID: crossfi-evm-testnet-1 | Version: v.0.46.13

State Synchronization allows a new node to join the network by retrieving a snapshot of the application state at its current height, instead of retrieving and replaying all historical blocks. Since application states are generally much smaller than blocks, and recovering them is much faster than replaying blocks, it can reduce the time to synchronize with the network from several days to a few minutes.

Stop the service and reset the data

sudo systemctl stop crossfid
cp $HOME/.mineplex-chain/data/priv_validator_state.json $HOME/.mineplex-chain/priv_validator_state.json.backup
empowerd tendermint unsafe-reset-all --home $HOME/.empowerchain

Get and configure the state sync information

STATE_SYNC_RPC=https://rpc-crossfi-testnet.dexanode.com:443
STATE_SYNC_PEER=0835b028b7532599dd95fe97d1c01ea420b5bd0b@https://rpc-crossfi-testnet.dexanode.com/
LATEST_HEIGHT=$(curl -s $STATE_SYNC_RPC/block | jq -r .result.block.header.height)
SYNC_BLOCK_HEIGHT=$(($LATEST_HEIGHT - 2000))
SYNC_BLOCK_HASH=$(curl -s "$STATE_SYNC_RPC/block?height=$SYNC_BLOCK_HEIGHT" | jq -r .result.block_id.hash)

sed -i \
  -e "s|^enable *=.*|enable = true|" \
  -e "s|^rpc_servers *=.*|rpc_servers = \"$STATE_SYNC_RPC,$STATE_SYNC_RPC\"|" \
  -e "s|^trust_height *=.*|trust_height = $SYNC_BLOCK_HEIGHT|" \
  -e "s|^trust_hash *=.*|trust_hash = \"$SYNC_BLOCK_HASH\"|" \
  -e "s|^persistent_peers *=.*|persistent_peers = \"$STATE_SYNC_PEER\"|" \
  $HOME/.empowerchain/config/config.toml

mv $HOME/.empowerchain/priv_validator_state.json.backup $HOME/.mineplex-chain/data/priv_validator_state.json

Last updated