Deploy and Verify Contracts
You can deploy contracts to Mezo matsnet targeting the London EVM Version and the network details on the Connect to Mezo matsnet page. The examples are tested using Hardhat, Foundry, and Remix, but you can try using other frameworks if you prefer.
Before you begin
Before you can deploy contracts, you will need an Ethereum wallet with matsnet BTC to pay for the gas fees.
Hardhat
If you are new to Hardhat, use the Hardhat Quick Start guide to learn how to install and initialize your project.
To configure Hardhat to work with Mezo matsnet, set the following items in your Hardhat config file:
Add an entry under
networks
for Mezo matsnet withurl: "https://rpc.test.mezo.org"
andchainId: 31611
.In the
solidity
settings, addevmVersion: "london"
.
As an example, see these basic Hardhat config files:
After your Hardhat project is configured, deploy the contact using Hardhat ignition or a deploy script. For example, use npx hardhat run
to call a deploy script and specify matsnet
as your target network.
Foundry
If you are new to Foundry, use the Foundry Getting Started guide to learn how to install and initialize your project.
To configure a Foundry project to work with Mezo matsnet, set the following items in your Foundry TOML file under [profile.default]
or a preferred profile:
Chain ID:
chain_id = 31661
RPC:
eth_rpc_url = "https://rpc.test.mezo.org"
EVM Version:
evm_version = 'london'
As an example, see the example Foundry TOML:
After the TOML is configured, deploy your contracts using forge create
:
Remix
Remix is a browser development environment. If you are new to Remix, see the Basics of Remix embedded guide to learn how to compile and deploy a contract.
Remix requires some extra configuration to work with Mezo matsnet:
Connect your browser wallet to Mezo matsnet so Remix can use it as an Injected Provider.
In Remix under the Solidity Compiler tab, open the Advanced Configurations menu and select
london
as the EVM version.
In Remix under the Deploy & Run Transactions tab, set the Environment to use an Injected Provider. Set the current network on your browser wallet to Mezo matsnet. Remix should detect the custom network with chain ID
31611
.
After you complete these settings, you can deploy contracts to Mezo matsnet using the standard process. See the Remix Documentation for more information about how to use Remix.
Verifying contracts
Currently, the explorer does not issue API keys to verify contracts using development frameworks. Use the contract verification UI at https://explorer.test.mezo.org/contract-verification.
Last updated