Skip to content

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.


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:

Terminal window
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:

Terminal window
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.


Your node’s configuration file is on your host machine at:

./rp1d-data/.rp1/config/config.toml

Open 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 = true
rpc_servers = "https://testnet.rpc.rp.one,https://testnet.rpc.rp.one"
trust_height = TRUST_HEIGHT
trust_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.


If your node is already running, restart it to apply the state sync settings:

Terminal window
docker compose restart

If your node is not running yet, start it normally:

Terminal window
docker compose up -d

Watch the logs to confirm state sync is working:

Terminal window
docker compose logs -f

You 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:

Terminal window
docker exec rp1d rp1d status

When "catching_up" shows false, your node is fully synced.


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.

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.