Contract Deployment and Verification
Last updated
Last updated
Like zkSync Era, Cronos zkEVM recommends the use of:
Hardhat for smart contract development
Node Typescript with the ethers library for backend and frontend development
While the are the most comprehensive and up to date source of information, you can also refer to , created especially for Cronos zkEVM Chain, which shows how to read the blockchain, write on the blockchain, and develop smart contracts:
Refer to the file for a list of frequently used commands.
The typical network configuration parameters are shown in the file.
The scripts directories contain some useful examples of scripts and functions that you may need to execute calls and transactions.
In order to enable users and fellow developers to do their own research, it is imperative that you publish your smart contract code on Cronos zkEVM Explorer.
The Cronos zkEVM Explorer supports smart contract verification either through the web interface or programmatically via Hardhat (we recommend to use Hardhat).
Cronos zkEVM is supported by Hardhat out of the box, to verify contract using Hardhat, we will need:
Configure the network parameters in hardhat.config.js
, referring to this . As an example, the verifyURL
for mainnet should be set as
A "Developers Portal" API key, refer to below guides on how to register and obtain one.
Note: During the contract verification Via Hardhat - Please install and use @matterlabs/hardhat-zksync-verify
version 1.7.1+ instead of hardhat-etherscan
For verification via the web interface, visit the following URLs:
If you are planning to deploy a ERC20 token on Cronos zkEVM, keep in mind that there are two ways to do this:
Deploy directly on the L2: this approach is simple to implement, but in that case, the ERC20 token wonβt be supported natively by the hyperbridge between L1 and L2, and between hyperchains. A custom bridge will be required to withdraw or transfer tokens from the L2.
Deploy first on the L1, then deposit to the L2: this approach requires two steps, but its advantage is that the tokens will be natively supported by the hyperbridge between L1 and L2. They can be deposited into the L2, or withdrawn from the L2, at will. When the first token is deposited from L1 to L2, the hyberbridge automatically creates a ERC20 smart contract on L2, which is the representation of the L1 token on the L2.
After deploying your smart contract, you will need to publish and verify its code in the block explorer:
If you have deployed directly on the L2, the deployment script included in the boilerplate project performs the contract code publication and verification automatically.
If you deploy first on the L1 (Ethereum Sepolia), you can publish and verify the contract code on the Etherscan Sepolia block explorer as usual. With respect to publishing and verifying the code of the L2 smart contract created by the hyperbridge, this is not yet supported.
Cronos zkEVM Mainnet:
Cronos zkEVM Testnet:
We can also refer to the example provided in .
After the contract verification is complete, the will display details about your smart contract code.
Mainnet:
Testnet:
Note that when using contract verification via the explorer interface, Standard-Json-Input
method is required. Reference for the JSON file format: