Chain ID: core-1 | Current Node Version: v11.16.0
State-sync does not take care of the wasm folder on Persistence, so you need to preserve your own current wasm folder, or follow the instruction to download our wasm folder. It is best to just use our Persistence snapshot service since it is more reliable. However, read on if you insist on using state-sync.
Our app.toml
settings related to state-sync is as follows.
This is for you information only. You do not need to follow the same
setup on your node.
# Prune Type
pruning = "custom"
# Prune Strategy
pruning-keep-every = 2000
# State-Sync Snapshot Strategy
snapshot-interval = 2000
snapshot-keep-recent = 5
Our state-sync RPC server for Persistence is:
https://persistence-rpc.polkachu.com:443
We assume that you use Cosmovisor to manage your node. If you do not use Cosmovisor, you will need to customize the following instruction slightly.
Create a reusable shell script such as state_sync.sh
with
the
following code. The code will fetch important state-sync information
(such as block height and trust hash) from our server and
update your config.toml
file accordingly.
#!/bin/bash
SNAP_RPC="https://persistence-rpc.polkachu.com: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)
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\"|" $HOME/.persistenceCore/config/config.toml
Grant user the privilege to execute script and then run the script:
chmod 700 state_sync.sh
./state_sync.sh
Stop the node:
sudo service persistence stop
Reset the node
# Reset node state
persistenceCore tendermint unsafe-reset-all --home $HOME/.persistenceCore --keep-addr-book
The above unsafe-reset-all
command does not reset your
wasm
folder. Now it is time to double-check that you indeed
have a wasm
folder with content under the
.persistenceCore
folder. If so, you can
proceed to restart your node right away. If not, you can download our
wasm
folder. Notice that we have taken out the
cache
sub-folder to ensure the
wasm
folder is compatible for all CPUs.
# Remove the empty wasm folder if you have an empty one
rm -r ~/.persistenceCore/wasm
# Get our wasm folder
wget -O persistence_wasmonly.tar.lz4 https://snapshots.polkachu.com/wasm/persistence/persistence_wasmonly.tar.lz4 --inet4-only
# Extract the wasm folder into the right place
lz4 -c -d persistence_wasmonly.tar.lz4 | tar -x -C $HOME/.persistenceCore
# Clean up
rm persistence_wasmonly.tar.lz4
Restart the node:
sudo service persistence start
If everything goes well, your node should start syncing within 10 minutes.
ALTERNATIVE ROUTE: We also have Persistence Snapshot Service to help you bootstrap a node.
First, visit our state-sync server landing page to ensure it is not down.
Second, add Polkachu's state-sync server as your peer. You can find Polkachu's peer info here.
Make sure that you use the latest version of the chain node when you state-sync.
State-sync can be flaky at times. Join our Discord Server if you have any issues. Happy State-Syncing!