State sync

State sync allows a new node to join a network by fetching a snapshot of the network state at a recent height, instead of fetching and replaying all historical blocks

Some blockchains do not yet know how to transfer wasm along with State sync. Download wasm if necessary

Important - different blockchains need a different amount of RAM to successfully start with State sync. Average 4 GB RAM

State sync

# stop the service and clear the database
systemctl stop dorad
dorad unsafe-reset-all --home $HOME/.dora --keep-addr-book
# download wasm if necessary
curl -L https://share.utsa.tech/dora/wasm-dora.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.dora --strip-components 2
# add peer
peers="0fcc76f46c1e438fd12cf9d4cb0ebcce1a5edd9b@144.76.29.90:60556"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.dora/config/config.toml
SNAP_RPC=https://m-dora.rpc.utsa.tech:443

LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)

echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ; \
s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.dora/config/config.toml

after echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH you should see something like this

# restart node
systemctl restart dorad && journalctl -u dorad -f -o cat

Attention. You may see the following errors ERR snapshot manager not configured ERR State sync failed err="state sync aborted" module=statesync

In this case, set the value of snapshot-interval to be greater than zero

Last updated