πŸ’»Develop smart contracts and dapps

Overview

Considering that Cronos zkEVM is based on zkSync technology, the zkSync docs at https://docs.zksync.io/ apply to Cronos zkEVM as well.

As far as the Cronos zkEVM testnet is concerned, the main differences with zkSync Era are:

Please expect the JSON-RPC URL to be rate limited. Rate limits will change over time.

Whereas zkSync Era uses ETH as the token to pay for transaction fees on the Layer 2, Cronos zkEVM uses zkTCRO. This means that the gas token of Cronos zkEVM (zkTCRO) is different from the gas token on the Layer 1 (Ethereum Sepolia testnet). This is a major difference that developers need to take into account when they create cross-chain transactions.

Demo repository

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 zkSync docs are the most comprehensive and up to date source of information, you can also refer to this linked repository, created especially for Cronos zkEVM testnet, which shows how to read the blockchain, write on the blockchain, and develop smart contracts:

  • Refer to the README.md file for a list of frequently used commands.

  • The typical network configuration parameters are shown in the hardhat.config.ts file.

  • The scripts directories contain some useful examples of scripts and functions that you may need to execute calls and transactions.

Important note about tokens

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.

Last updated