Checkpoint sync allows a new node to quickly synchronize by downloading the finalized state from a trusted peer instead of syncing from genesis.
- Build zeam repo
- Go to the linked lean-quickstart folder in the repo (pinned at the zeam_repo branch)
-
Start the first instance in a terminal:
NETWORK_DIR=local-devnet ./spin-node.sh --node zeam_0 --generateGenesis
This will set fresh genesis time and start the node. Wait for a few slots to allow finalization to occur.
-
Verify the first node has finalized state by checking its API:
curl -s http://localhost:9667/lean/v0/states/finalized -o /dev/null -w "%{http_code}\n"You should see
200once the node has finalized state available. -
Start the second instance in a new terminal with checkpoint sync enabled:
NETWORK_DIR=local-devnet ./spin-node.sh --node zeam_1 --checkpointSyncUrl http://localhost:9667
The second node will:
- Download the finalized state from zeam_0's API endpoint (
/lean/v0/states/finalized) - Verify the state matches the expected genesis configuration (validator count)
- Use this state as its anchor to sync forward
- Download the finalized state from zeam_0's API endpoint (
-
Observe the logs on zeam_1. You should see messages like:
checkpoint sync enabled, downloading state from: http://localhost:9667/lean/v0/states/finalized checkpoint state verified: slot=X, validators=N, state_root=0x..., block_root=0x... checkpoint sync completed successfully, using state at slot X as anchor -
Both nodes will peer and continue advancing with finalizations.
To test the fallback behavior when checkpoint sync fails:
-
Start zeam_1 with an invalid checkpoint URL:
NETWORK_DIR=local-devnet ./spin-node.sh --node zeam_1 --checkpointSyncUrl http://localhost:9999
-
The node should log a warning and fall back to loading from database or genesis:
checkpoint sync failed: ..., falling back to database/genesis
The checkpoint sync feature uses the /lean/v0/states/finalized endpoint which returns:
- Content-Type:
application/octet-stream - Body: SSZ-encoded
BeamState - Status 503: Returned if no finalized state is available yet