# How To: Checkpoint Sync This guide covers the additional steps required to checkpoint sync a beacon node from another beacon node that you trust. This guide _does not_ cover setting up an entire node from scratch. :::warning :warning: You should always verify that your beacon node is synced correctly after doing a checkpoint sync. Check [Step 4](#Step-4) for instructions ::: More reading on checkpoint sync: - https://www.symphonious.net/2022/05/21/checkpoint-sync-safety/ - https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/weak-subjectivity/ - https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity/ - https://notes.ethereum.org/@djrtwo/ws-sync-in-practice ## EF DevOps Endpoints The EF DevOps team runs a handful of endpoints to help with syncing a testnet node. `Goerli/Prater`: https://goerli.checkpoint-sync.ethdevops.io `Ropsten`: https://ropsten.checkpoint-sync.ethdevops.io `Sepolia`: https://sepolia.checkpoint-sync.ethdevops.io ## Tutorial ### Step 1 Note down the beacon endpoint you're planning to checkpoint sync from. This can be another beacon node you run, a beacon node that a friend runs, one of the endpoints above, or any beacon node you trust. > Note: The source beacon node *must* be for the same Ethereum network as your beacon node. For this tutorial we will use the EF DevOps Goerli endpoint (https://goerli.checkpoint-sync.ethdevops.io) ### Step 2 Add the checkpoint sync argument to your client. The flag is different between clients. #### Prysm ``` --checkpoint-sync-url=https://goerli.checkpoint-sync.ethdevops.io --genesis-beacon-api-url=https://goerli.checkpoint-sync.ethdevops.io ``` #### Lighthouse ``` --checkpoint-sync-url=https://goerli.checkpoint-sync.ethdevops.io ``` #### Teku ``` --initial-state=https://goerli.checkpoint-sync.ethdevops.io/eth/v2/debug/beacon/states/finalized ``` #### Lodestar ``` --weakSubjectivitySyncLatest=true --weakSubjectivityServerUrl=https://goerli.checkpoint-sync.ethdevops.io ``` #### Nimbus Requires the `trustedNodeSync` command to be run before the beacon is launched. Read more here: https://nimbus.guide/trusted-node-sync.html ### Step 3 Start your client. Once started, check your logs for details surrounding the checkpoint process. > Note: You must be starting your client with a fresh data directory/database #### Prysm ``` level=info msg="requesting https://goerli.checkpoint-sync.ethdevops.io/eth/v2/debug/beacon/states/genesis" level=info msg="requesting https://goerli.checkpoint-sync.ethdevops.io/eth/v2/debug/beacon/states/finalized" ``` #### Lighthouse ``` INFO Starting checkpoint sync remote_url: https://goerli.checkpoint-sync.ethdevops.io, service: beacon INFO Loaded checkpoint block and state state_root: 0xb6e8c25393411f252775f82b4907298572003ac37acf9422dd2500b5c368a08d, block_root: 0xefe19ea0d99bf45d50d4302f6bbc3feb2c1ec46f8d6e112594ec86b9581596ae, slot: 3480832, service: beacon ``` #### Teku ``` INFO - Loading initial state from https://goerli.checkpoint-sync.ethdevops.io/eth/v2/debug/beacon/states/finalized INFO - Loaded initial state at epoch 11348 (state root = 0x08dab651bd667b166a0c99b7a21ee455f4f9fadfce0e37dbcee490f5ec841477, block root = 0xa5bd8b3eaadd81f892f120219f3bcee6565a37d045bf0cee4c4023a51def430c, block slot = 363136). Please ensure that the supplied initial state corresponds to the latest finalized block as of the start of epoch 11348 (slot 363136). ``` #### Lodestar ``` info: Fetching weak subjectivity state weakSubjectivityServerUrl=https://goerli.checkpoint-sync.ethdevops.io info: Download completed ``` #### Nimbus ``` Starting trusted node sync databaseDir=/data/consensus/db restUrl=https://goerli.checkpoint-sync.ethdevops.io blockId=finalized backfill=false reindex=false Downloading checkpoint block restUrl=https://goerli.checkpoint-sync.ethdevops.io blockId=finalized Downloading checkpoint state restUrl=https://goerli.checkpoint-sync.ethdevops.io checkpointSlot=370528 Writing checkpoint state Writing checkpoint block Database initialized, historical blocks will be backfilled when starting the node ``` ### Step 4 Validate that your node is on the expected chain. To do this we'll check the state root of the finalized checkpoint against another source. For this guide we'll use `prater.beaconcha.in` (the beaconcha.in instance for Goerli) but any source that you trust is fine. You will need to know the IP & Port of your beacon node. Default ports: > Lighthouse: 5052 Nimbus: 5052 Teku: 5051 Prysm: 3500 Lodestar: 9596 #### 1. Obtaining finalized checkpoint & state root ##### Option A 1. Open `http://YOUR_NODE_IP:YOUR_NODE_PORT/eth/v1/beacon/headers/finalized` in your browser. 2. Find the `slot` number. 3. Find the `state_root` value. ##### Option B 1. Install `curl` and `jq`. 2. In a new terminal window run: ``` curl -s http://YOUR_NODE_IP:YOUR_NODE_PORT/eth/v1/beacon/headers/finalized | jq .'data.header.message' ``` 3. Find the `slot` and `state_root` values. #### 2. Validate against a known source - In a new tab/window, open https://prater.beaconcha.in/block/SLOT, replacing `SLOT` with the number from step 1. - Check that the `State Root` for the slot matches the value you found in step 1. If it's a match, congratulations :tada:. If it's not a match you should start from scratch by wiping your beacon node and starting from the top.