State Sync
By default, a new node syncs by replaying every block from the beginning of the chain. State sync skips this and downloads a recent snapshot of the chain state instead. On the RP1 testnet this takes minutes rather than hours.
Use state sync when setting up a new node. Nodes that are already synced do not need it.
Step 1 — Get the trust parameters
Section titled “Step 1 — Get the trust parameters”State sync needs a recent block height and its hash from a trusted source. Run the following two commands to fetch them from the RP1 testnet:
TRUST_HEIGHT=$(curl -s https://testnet.rpc.rp.one/block | python3 -c "import sys,json; print(json.load(sys.stdin)['result']['block']['header']['height'])")TRUST_HASH=$(curl -s "https://testnet.rpc.rp.one/block?height=$TRUST_HEIGHT" | python3 -c "import sys,json; print(json.load(sys.stdin)['result']['block_id']['hash'])")
echo "Trust height: $TRUST_HEIGHT"echo "Trust hash: $TRUST_HASH"Copy both values — you will need them in the next step.
If python3 is not available, you can run the same commands through the setup container:
docker exec rp1d sh -c "TRUST_HEIGHT=\$(wget -qO- https://testnet.rpc.rp.one/block | grep -o '\"height\":\"[0-9]*\"' | head -1 | grep -o '[0-9]*');echo Trust height: \$TRUST_HEIGHT"Or simply visit https://testnet.rpc.rp.one/block in your browser and copy the height and hash values from the response.
Step 2 — Edit the config file
Section titled “Step 2 — Edit the config file”Your node’s configuration file is on your host machine at:
./rp1d-data/.rp1/config/config.tomlOpen this file in any text editor. Find the [statesync] section (search for statesync) and update it to match the following, replacing TRUST_HEIGHT and TRUST_HASH with the values from Step 1:
[statesync]enable = truerpc_servers = "https://testnet.rpc.rp.one,https://testnet.rpc.rp.one"trust_height = TRUST_HEIGHTtrust_hash = "TRUST_HASH"discovery_time = "15s"temp_dir = ""Note: rpc_servers requires two entries separated by a comma — repeating the same URL is fine.
Save the file.
Step 3 — Restart your node
Section titled “Step 3 — Restart your node”If your node is already running, restart it to apply the state sync settings:
docker compose restartIf your node is not running yet, start it normally:
docker compose up -dStep 4 — Check sync status
Section titled “Step 4 — Check sync status”Watch the logs to confirm state sync is working:
docker compose logs -fYou should see messages about downloading snapshot chunks. Once complete, the node will continue syncing the remaining blocks normally.
To check whether your node has fully caught up:
docker exec rp1d rp1d statusWhen "catching_up" shows false, your node is fully synced.
Troubleshooting
Section titled “Troubleshooting””No snapshots available”
Section titled “”No snapshots available””The config.toml file was not saved correctly, or the node was not restarted after the change. Confirm the [statesync] section looks exactly as shown above, then run docker compose restart.
State sync starts but then fails partway through
Section titled “State sync starts but then fails partway through”The trust height may be too old. Snapshots are available at approximately every 1,000 blocks, and only the two most recent are kept. Repeat Step 1 to fetch fresh values and try again.
Node appears to be stuck at the same block height
Section titled “Node appears to be stuck at the same block height”State sync may have completed but the node is still catching up on newer blocks. Check the logs — if blocks are being processed (even slowly), the node is working correctly. Full sync after a snapshot typically takes a few minutes.
Config file cannot be found
Section titled “Config file cannot be found”The config file is only created after running the join command in the Run a Validator Node guide. Complete that guide first, then return here.