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
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 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 theSolidity 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
andera_version
. Both version values are available from thehardhat.config.ts
if using hardhatThe 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 azkVM
version.
On
ZkSync Compiler Version
<v1.5.0
, only Solidity Compiler Version exists during compilation. Before zksolcv1.5.0
where zksolc is the ZKsync compiler, the compiler version is the same as the solidity version.Compiler Version
includes only one componentsolidity_version
. Version value is available from thehardhat.config.ts
if using hardhatThe 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 keysolcVersion.
Compiler version dependency list:
Zksolc compiler version | Solc compiler version | Era 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
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
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.Look for json file under the
artifacts-zk/build-info/
directory if using hardhatLook for
input
field inside the json fileCopy the field value as a seperated json file
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
andtypechain-types
directories every time that you change the smart contract code.
FAQ
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
andtypechain-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