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. Follow the steps below to ensure accurate submission.

Input fields:

Contract Name

  • Contract name refer defined entry point contract of the contract deployment, or the name of the contract in the .sol file. On a simple erc20 token contract:

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

Contract entry point is MyERC20Token contract.

Contract Path

  • Relative path of defined entry point contract i.e. path to contact specified on Contract name .

Contract Address

  • The address where the contract has been deployed.

Compiler Type

  • Solidity Standard-Json-Input (Not the default option, but highly 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 on the Contract Files section.

  • Solidity Files

    • Only compile with 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.

ZkSync Compiler Version

A modified version of solc that operates on IR and metadata received from underlying solc compiler, refer to this for more details.

  • ZkSync Compiler Version chosen on compilation

  • For ZkSync Compiler Version >= v1.5.0, a additional EraVM compiler is introduced.

Compiler Version

Solidity Compiler version, refer to this for details.

Note: the Era version is usually set automatically, but it's possible to define it manually: https://github.com/matter-labs/hardhat-zksync/blob/main/examples/basic-example/hardhat.config.ts#L33

  • On ZkSync Compiler Version >= v1.5.0, Era version is introduced on Solidity Compiler, and the compiler version will be in the zkVM-{solidity_version}-{era_version} format.

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

      solidity: {
          version: "0.8.24",  // solidity_version
          eraVersion: "1.0.1" // era_version (use latest version by default if not specificed)
      },
      • The format: zkVM-{solidity_version}-{era_version}

      • Input example: zkVM-0.8.24-1.0.1

      • If the format appears like zkVM-0.8.24-1.0.1, it means that you need to select a zkVM version.

  • On ZkSync Compiler Version < v1.5.0, only Solidity Compiler Version exists during compilation. Before zksolc v1.5.0 where zksolc is the ZKsync compiler, the compiler version is the same as the solidity version.

    • Compiler Version includes only one component solidity_version. Version value is available from the hardhat.config.ts if using hardhat

      solidity: {
          version: "0.8.24", // solidity_version
      },
    • The format: {solidity_version}

    • Input example: 0.8.24

  • Compiler Version is also available on build information json file under artifacts-zk/build-info/ directory, with field key solcVersion.

    {
        "id": "b02558cd8ed94e8b0de42c4345fdc761",
        "_format": "hh-sol-build-info-1",
        "solcVersion": "0.8.24",
        "solcLongVersion": "0.8.24+commit.e11b9ed9",
        "input": ...,
        "output": ...
    }

Compiler version dependency list:

Zksolc compiler versionSolc compiler versionEra 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 Files

Json file if Compiler Type Solidity Standard-Json-input and Contract file(s) if Compiler Type Solidity Files. Here are some suggestion to get the corresponding file(s)

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

    1. Look for json file under the artifacts-zk/build-info/ directory if using hardhat

    2. Look for input field inside the json file

      ...
      "input" : {
          "language": "Solidity",
          "sources": {
              ...
          },
          "settings": {
              "optimizer": {
                  "enabled": true,
                  "mode": "3"
              },
              "outputSelection": {
                  "*": {
                      "*": [
                          "abi",
                          "evm.methodIdentifiers",
                          "metadata"
                      ],
                      "": [
                          "ast"
                      ]
                  }
              },
             ...
          }
      }
      ...
    3. Copy the field value as a seperated json file

      solidity-standard-Json-input.json
      {
          "language": "Solidity",
          "sources": {
              ...
          },
          "settings": {
              "optimizer": {
                  "enabled": true,
                  "mode": "3"
              },
              "outputSelection": {
                  "*": {
                      "*": [
                          "abi",
                          "evm.methodIdentifiers",
                          "metadata"
                      ],
                      "": [
                          "ast"
                      ]
                  }
              },
             ...
          }
      }
    4. Select the separated json file i.e. solidity.json in above example

  • For Solidity Files compiler type, multiple Solidity file(s) selection are available.

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

Example

We'll use this testnet smart contract Github Repo as an example with its deployed contract. Here are all the example inputs of the MyERC20Token contract on contract verification.

  • 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

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

  • Check with Cronos Labs that your solidity and zksolc versions are supported (should be up to the versions used in this repo)

  • 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.

FAQ

How long does the contract verification takes ?

Usually, it takes up to 10 minutes to verify a contract after submission. If it is not verified after 10 minutes, it means that there is an issue.

Where to check the contract verification result ?

After submitting the contract, it will be displayed on the Address Page if it has been verified. If no contract data appears on the Address Page within 10 mintues, the contract has not been verified. If using the Developer Portal , The contract verification status is available on the Contract Page.

How to 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.

What if the implementation address was upgraded ?

Our contract verification service will check and update the implementation address from time to time.

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