Skip to content

Sync state with snapshots


Apologies to zkEVM users

We don’t have snapshots from the time we moved from AWS to GCP. That’s since February, 2024.

As we are moving towards an Erigon-based CDK, which has no PostgreSQL, the task to prepare snapshots is on-hold.

Also, it is expected to take only hours, instead of days, for Erigon to sync from scratch.

So, there will be no need for snapshots.

As a result, this document will soon be deprecated.

Follow the instructions below to run a fast state sync on a node database using the relevant snapshot. Snapshot URLs are available in the snapshots subsection below.

Sync a database

  1. Run the following command to download the snapshot with the correct snapshot-url and db-name:

    curl <snapshot-url> -o <db-name>.sql.gz

    For example:

    curl -o statedb.sql.gz
  2. Stop/start the database:

    docker compose stop
    docker compose start zkevm-state-db
  3. Remove data from the database, keeping the schema and a raw backup copy:

    docker compose exec -it zkevm-state-db pg_dump -U state_user -v -Fc -s -f /tmp/statedb.schema state_db
    docker compose exec -it zkevm-state-db dropdb -U state_user state_db
    docker compose exec -it zkevm-state-db createdb -U state_user state_db
    docker compose exec -it zkevm-state-db pg_restore -U state_user -v -d state_db /tmp/statedb.schema
  4. Import the backup file into the database:

    gunzip -c statedb.sql.gz | docker compose exec -T zkevm-state-db psql -U state_user -d state_db
  5. Clean up:

    docker compose exec zkevm-state-db rm /tmp/statedb.schema
    rm statedb.sql.gz
  6. Start everything again:

    docker compose up -d


The snapshot for the bridge, state, and hash databases are given below for mainnet and testnet.

Mainnet (315MB) (6GB) (160GB)

Testnet (312MB) (1.9GB) (49GB)