Contract Verification Guide for the Cronos zkEVM Explorer

This guide provides explanations for input fields used in the contract verification process on Cronos zkEVM explorer and Developer Portal.

Input fields

Contract Name

Contract name refers to the defined entry point contract of the contract deployment, or the name of the contract in the .sol file. Taking a simple ERC20 token contract as an example, the contract entry point is MyERC20Token contract:

...
contract MyERC20Token is ERC20Burnable, ERC20Pausable, AccessControl {
  ...
}

This contract's entry point is MyERC20Token contract.

Contract Path

Relative path to the file which contains the defined entry point contract. In simpler terms, this is the path to contact specified on Contract name .

Contract Address

  • The address of the contract deployed on chain.

  • If you are unsure about the Constructor Arguments value you used, you can click the Get Suggested Constructor Arguments button.

Compiler Type

  1. Solidity Standard-Json-Input (Recommended)

    • Supports complex or customized compiler setups. Refer to Solidity Standard-Json-Input for more details.

    • A JSON file shall be specified as input JSON. More details in Contract Files section.

  2. Harthat Build-Map-Json (Not the default option, but recommended)

    • Supports complex or customized compiler setups.

    • Prefill the corresponding zkSync Compiler Version, Compiler Version and Era Version during contract compilation.

    • The build map JSON file generated by Hardhat during contract compilation.

  3. Solidity Files

    • Only applicable to simple contract setup. If you cannot verify the contract with Solidity Files compiler type, we recommend you to try with the Solidity Standard-Json-Input Compiler Type.

    • You need to upload the .sol file(s) to the Explorer.

Contract Files

Option
Contract Files to be Provided

Solidity Standard-Json-input

JSON file

Hardhat Build-Map-Json

JSON file

Solidity Files

Contract file(s)

Here are some suggestion to get the corresponding file(s):

  • For Solidity Standard-Json-input, only single JSON file is required.

    1. Look for the hash-named JSON file, i.e. {hash}.json, under the artifacts-zk/build-info/ directory if using hardhat

    2. Look for input field inside the JSON file

    3. Copy the field value as a separated JSON file

    4. Select the separated JSON file i.e. solidity.JSON in above example

  • For Hardhat Build-Map-Json, only single JSON file is required.

    • Look for the hash-named JSON file, i.e. {hash}.json, under the artifacts-zk/build-info/ directory if using hardhat

    • Select the hash-named JSON file directly

  • For Solidity Files compiler type, you can select multiple Solidity file(s).

  • Finally, agree to the terms and conditions, complete the "I'm not a robot" verification, and submit.

zkSync Compiler Version

zkSync Compiler is a modified version of solc that operates on IR and metadata received from underlying solc compiler, refer to zkSync documentation for more details.

  • This is the zkSync Compiler version chosen during compilation.

  • For zkSync Compiler Version >= v1.5.0, an additional EraVM compiler is introduced and you will have to select the right EraVM compiler version during verification. More details in Compiler Version section.

Compiler Version and Era Version

Solidity Compiler version and Era Version is usually set automatically, but it's possible to define it manually. Please refer to this documentation about ZKsync Era Solidity Compiler for setup details.

  1. After zkSync Compiler Version >= v1.5.0, EraVM compiler version is introduced on Solidity Compiler.

    • Version format: zkVM-{solidity_version}-{era_version}

    • Compiler Version consists of two parts, solidity_version and era_version. Both version values are available from the hardhat.config.ts if using hardhat

    • Example 1

      In this example:

      • Compiler Version is zkVM-0.8.24.

      • Era Version is 1.0.0.

    • Example 2

      At the time of writing, the latest EraVM version is 1.0.1, hence in this example:

      • Compiler Version is zkVM-0.8.24.

      • Era Version is 1.0.1.

  2. Before zkSync Compiler Version < v1.5.0, only Solidity Compiler Version exist during compilation.

    • Version format: {solidity_version}

    • Compiler Version only has one part solidity_version. Its value is available from the hardhat.config.ts if using hardhat

      In this example:

      • Compiler version is 0.8.24

      • There is no Era Version

Recovering Compiler Version from Build Metadata

Compiler Version is also available in the build map JSON file located under artifacts-zk/build-info/ directory. Look for the build map JSON file with your target contract under the input field key, the Compiler Version is specified at under the field key solcVersion.

  • Example 1 After zkSync Compiler Version >= v1.5.0

    In this example:

    • Compiler Version is zkVM-0.8.20.

    • Era Version is 1.0.1.

  • Example 2 Before zkSync Compiler Version < v1.5.0

    In this example:

    • Compiler Version is 0.8.24.

    • There is no Era Version

Compiler Version Dependency List

Here is a list of possible compiler version combinations list based on different ZkSolc versions.

ZkSolc version
Solc version
EraVM version

v1.5.3 - v1.5.0

<= 0.8.26

Existed

v1.4.1

<= 0.8.25

None

v1.4.0

<= 0.8.24

None

v1.3.23 - v1.3.15

<= 0.8.23

None

v1.3.14

<= 0.8.21

None

v1.3.13 - v1.3.11

<= 0.8.20

None

v1.3.10 - v1.3.6

<= 0.8.19

None

v1.3.5

<= 0.8.18

None

<= v1.3.4

<= 0.8.17

None

Constructor Arguments

Arguments that passed to the constructor when deploying the contract. This option applies ONLY to contracts that accept constructor arguments. If you're unsure, you can leave this field empty initially. Also, constructor arguments should be in ABI-ENCODED values WITHOUT 0x.

Contract Verification Example

We will use this smart contract on Github as an example. It is deployed on Cronos zkEVM Testnet at 0x8fc3246677f359f0c89c2c8103244b8256cdef5e.

Here are the parameters to be used for verifying the MyERC20Token contract.

  • Contract Name: "MyERC20Token"

  • Contract Path: "contracts/MyERC20Token.sol"

  • Contract Address: "0x8fc3246677f359f0c89c2c8103244b8256cdef5e"

  • Compiler Type: "Standard-Json-Input compiler"

  • Compiler Version: "0.8.24"

  • ZKSync Compiler Version: "v1.4.1"

  • Constructor Arguments: ""

  • Contract Files

Sample Standard-Json-Input file

FAQ

How long does contract verification takes ?

Usually, it takes up to 10 minutes to verify a contract after submission.

Where can I check the contract verification result ?

After submitting the contract, a corresponding Contract Verification ID will be provided. Search the result by the Contract Verification ID in Status Checker Page. If you are using the Developer Portal , the contract verification status is available in the Contract Page. Also the code will be available on the Address Page if it has been verified. If no contract code appears on the Address Page after 10 minutes, the contract verification may be failed.

Is there any demonstrations on verifying a contract ?

Yes, here is a sample smart contract Github project: cronos-zkevm-hardhat-boilerplate, which demonstrates the basic use of Cronos zkEVM to develop smart contract and implement on-chain transactions.

How can I verify a proxy contract ?

Same as a normal contract, you need to submit the proxy contract to our service using Cronos zkEVM Explorer or hardhat-zksync.

If I have a proxy contract, how do I update the explorer if the address of the implementation contract has been updated?

The contract verification service will periodically check and update the implementation contract address. It may take up to 1 hour to reflect the new address.

Troubleshooting

If you are still having issues with contract verification in the Cronos zkEVM explorer, here are a few pointers.

  • Make sure that you have registered for an API key and have added the key to the .env variables.

  • Deploy your smart contract with no constructor arguments (i.e. hard code the constructor values in the .sol file), as constructor arguments can sometimes be tricky to encode.

  • Delete the artifacts-zk, cache-zk, deployments-zk and typechain-types directories every time that you change the smart contract code.

  • Check with Cronos Labs that your solidity and zksolc versions are supported.

Last updated