Deploy a Smart Contract on Cronos zkEVM

Cronos zkEVM is a ZKsync ZK Stack chain, so its EVM is compatible at the application level but contracts must be compiled with the ZKsync Solidity compiler (zksolc) and deployed with the ZKsync toolchain — standard solc/vanilla Foundry bytecode is not deployed directly. Use @matterlabs/hardhat-zksync (or foundry-zksync). Gas is paid in zkCRO. This guide covers adding the network to a wallet and deploying with Hardhat + ZKsync.

Do not deploy Cronos zkEVM contracts with vanilla solc/Foundry as you would on a standard EVM chain. Cronos zkEVM requires the zksolc compiler; deploy and verify through @matterlabs/hardhat-zksync or foundry-zksync.

Prerequisites

  • Node.js 18+ and a package manager
  • An EVM wallet (such as MetaMask) with zkCRO for gas — see Add Network to Your Wallet and Funding Your Deployer
  • A GetBlock access token — the endpoint is https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/
  • A funded deployer address with zkCRO

Network Details

PropertyValue
Network NameCronos zkEVM Mainnet
RPC URLhttps://shared.eu-central-1.getblock.io//
Chain ID388 (0x184)
Currency SymbolzkCRO
Block Explorerexplorer.zkevm.cronos.org

Add Network to Your Wallet

Cronos zkEVM is not pre-configured in MetaMask by default, so it must be added manually — follow the steps below:

  1. Open your wallet

    Open MetaMask (or your EVM wallet of choice).

  2. Add a custom network

    Open the network selector and choose Add a custom network.

  3. Enter the network details

    Enter the values from the Network Details table above.

  4. Confirm the chain ID

    Confirm the Chain ID resolves to 388.

  5. Save and switch networks

    Save and switch to the newly added Cronos zkEVM network.

Funding Your Deployer

Cronos zkEVM gas is paid in zkCRO.

  • Mainnet — bridge to Cronos zkEVM through the official bridge, or acquire zkCRO from a supported exchange.

Deploy with Hardhat + ZKsync

  1. Create the project and install the ZKsync toolchain

    bashmkdir hello-cronos-zkevm && cd hello-cronos-zkevm
    npm init --yes
    npm install --save-dev hardhat @matterlabs/hardhat-zksync zksync-ethers ethers
  2. Configure zksolc and the network

    hardhat.config.js

    javascriptrequire('@matterlabs/hardhat-zksync');
    
    module.exports = {
      zksolc: {
        version: 'latest',
        settings: {}
      },
      defaultNetwork: 'cronosZkevm',
      networks: {
        cronosZkevm: {
          url: process.env.RPC_URL,
          ethNetwork: 'mainnet',
          zksync: true,
          verifyURL: 'https://explorer.zkevm.cronos.org/api'
        }
      },
      solidity: { version: '0.8.24' }
    };
  3. Write the contract

    contracts/Hello.sol

    solidity// SPDX-License-Identifier: MIT
    pragma solidity ^0.8.24;
    
    contract Hello {
        string public greeting = "Hello, Cronos zkEVM";
    
        function setGreeting(string calldata greeting_) external {
            greeting = greeting_;
        }
    }
  4. Compile with zksolc

    bashnpx hardhat compile
  5. Deploy

    deploy/deploy.js

    javascriptconst { Deployer } = require('@matterlabs/hardhat-zksync');
    const { Wallet } = require('zksync-ethers');
    
    module.exports = async function (hre) {
      const wallet = new Wallet(process.env.PRIVATE_KEY);
      const deployer = new Deployer(hre, wallet);
      const artifact = await deployer.loadArtifact('Hello');
      const contract = await deployer.deploy(artifact, []);
      console.log('Deployed to:', await contract.getAddress());
    };
    bashexport RPC_URL=https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/
    export PRIVATE_KEY=0xyour_deployer_private_key
    
    npx hardhat deploy-zksync --script deploy.js
  6. Verify on the block explorer

    bashnpx hardhat verify --network cronosZkevm <DEPLOYED_ADDRESS>

After Deploying

  • Read contract state through the eth_call method against your GetBlock endpoint.
  • Watch contract events with eth_getLogs.
  • Explore your contract and transactions on the Cronos zkEVM explorer.