Cronos zkEVM Mainnet

This guide covers running a node for Cronos zkEVM mainnet (Chain ID: 388) with external-node v24.9.0 on docker.

Pre-requisites

Prepare your machine

This configuration is approximate and should be considered as minimal requirements:

  • 8-core of CPU

  • 64GB of RAM

  • 1TB of SSD storage

Step 1: Download the DB Dump

1.1 - Download the DB dump

Create a new folder and download the dump file into it:

wget https://storage.googleapis.com/cronos-zkevm-mainnet-en-pgdump/external_node_20240802.dump

Step 2: Docker Preparations

2.1 - Pull Docker Image

Under the same directory, pull docker image from Github Container Registry:

docker pull ghcr.io/cronos-labs/external-node:mainnet-v24.9.0

2.2 - Create Docker Compose Configuration

Inside that directory, create and edit docker-compose.yml :

nano docker-compose.yml

Add the following configuration to docker-compose.yml:

services: 
  cronoszk:
    image: "ghcr.io/cronos-labs/external-node:mainnet-v24.9.0"
    network_mode: host
    restart: unless-stopped
    stop_grace_period: "120s"
    user: 0:0  
    volumes:
      - "${PWD}:/db"  
    environment:
      DATABASE_POOL_SIZE: 10
      DATABASE_URL: "postgresql://zksync:password@localhost:5432/zksync"
      EN_ETH_CLIENT_URL: "https://ethereum-rpc.publicnode.com"
      EN_HEALTHCHECK_PORT: 3081
      EN_HTTP_PORT: 3060
      EN_L1_BATCH_COMMIT_DATA_GENERATOR_MODE: "Validium"
      EN_L1_CHAIN_ID: 1
      EN_L2_CHAIN_ID: 388
      EN_MAIN_NODE_URL: "https://seed.zkevm.cronos.org"    
      EN_MERKLE_TREE_PATH: "./db/ext-node/lightweight"
      EN_PROMETHEUS_PORT: 3312
      #EN_PRUNING_ENABLED: true  #Note: Default value is false, i.e. no purning
      EN_REQ_ENTITIES_LIMIT: 1000
      EN_SNAPSHOTS_RECOVERY_ENABLED: "false"
      EN_STATE_CACHE_PATH: "./db/ext-node/state_keeper"
      EN_WS_PORT: 3061
      RUST_LOG: "warn,zksync=info,zksync_core::metadata_calculator=debug,zksync_state=debug,zksync_utils=debug,zksync_web3_decl::client=error"
  postgres:
    image: postgres:16
    restart: unless-stopped
    stop_grace_period: "120s"
    network_mode: host
    environment:
      POSTGRES_DB: zksync
      POSTGRES_USER: zksync
      POSTGRES_PASSWORD: password
    ulimits:
      nofile: 60000
      nproc: 60000
      memlock: -1
    volumes:
      - "${PWD}/pgsql_data:/var/lib/postgresql/data/"
      - "${PWD}:/dump"

Step 3: Database Restoration

3.1 - Start PostgreSQL Container:

docker compose up -d postgres

Please note postgres was named in docker-compose.

When container is running, list containers to find the container ID:

docker ps

Below is the example output:

CONTAINER ID   IMAGE         COMMAND                  CREATED          STATUS          PORTS     NAMES
addfe6748b97   postgres:16   "docker-entrypoint.sā€¦"   10 seconds ago   Up 9 seconds              zkmainnet-postgres-1

3.2 - Restore Database from Dump

Run the following and docker retrieve and manipulate the data from data dump:

docker exec -it <container_name> psql -U <username> -d <database> -f <path_to_dump_you_attached_in_volumes_docker_compose> 

Example:

docker exec -it addfe6748b97 psql -U zksync -d zksync -f "/dump/external_node_20240802.dump"

NOTE

  • <container_name> refers to the Container ID you obtained in the previous step. For example, in our case, it is addfe6748b97.

  • The username and database names were defined in thedocker-compose; in this example, they are zksync and zksync, respectively.

  • The path_to_dump_you_attached_in_volumes_docker_compose refers to the path specified in the volumes section of the docker-compose file. In our example, it is /dump/external_node_20240802.dump.

During the process, on the docker side, you should see:

Depending on the specs, the process might take several hours.

Step 4: Run everything

Once the pg restore completed, start the cronoszk node service:

docker compose up -d 

Example output should be like:

[+] Running 3/0
 āœ” Container zkmainnet-cronoszk-1                                                                                                                          
 Started0.1s 
 āœ” Container zkmainnet-postgres-1                                                                                                                          
 Running0.0s 

You should see in the Docker logs that the node is fetching block data from the RPCs.

For example:

Once the node is synchronized, you may use EN_HTTP_PORT: 3060 as defined for ETH-JSON RPC calls.

Last updated