Skip to main content
Configure your Hardhat or Foundry development environment for Mezo to start building and deploying smart contracts.

Before You Begin

Before you can deploy applications, you will need an Ethereum wallet with BTC to pay for gas fees.

Connect Your Wallet

Learn how to connect your wallet to Mezo
For advanced chain configuration and network parameters, see the Chains Configuration Guide.

Testnet Configuration

Network Details

ParameterValue
Network NameMezo Testnet
Chain ID31611
CurrencyBTC (18 decimals)
Block Explorerexplorer.test.mezo.org

RPC Endpoints

ProtocolURL
HTTPShttps://rpc.test.mezo.org
WSSwss://rpc-ws.test.mezo.org

Get Testnet BTC

To pay for gas fees on the Testnet, you will need Testnet BTC.
1

Visit the Mezo Faucet

Obtain Testnet BTC from the official Mezo Faucet.
The faucet is protected by a CAPTCHA to prevent abuse.
2

Setup Your Wallet

Ensure you have a browser wallet installed that supports Ethereum (EVM), such as MetaMask.

Hardhat Configuration

1

Install Hardhat

If you are new to Hardhat, use the Hardhat Quick Start guide to learn how to install and initialize your project.
2

Configure Network

To configure Hardhat for Mezo Testnet, modify your hardhat.config.js (or .ts) file:
hardhat.config.js
module.exports = {
  defaultNetwork: "mezotestnet",
  networks: {
    mezotestnet: {
      url: "https://rpc.test.mezo.org",
      chainId: 31611,
      accounts: ["YOUR_PRIVATE_WALLET_KEY"] // Use environment variables for security
    }
  },
  solidity: {
    version: "0.8.28",
    settings: {
      evmVersion: "london",
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  },
};
Always use environment variables to store private keys. Never commit private keys to version control.

Foundry Configuration

1

Install Foundry

If you are new to Foundry, use the Foundry Getting Started guide to learn how to install and initialize your project.
2

Configure Network

To configure a Foundry project for Mezo Testnet, set the following in your foundry.toml:
foundry.toml
[profile.default]
chain_id = 31611
eth_rpc_url = "https://rpc.test.mezo.org"
evm_version = 'london'

Mainnet Configuration

Network Details

ParameterValue
Network NameMezo Mainnet
Chain ID31612
CurrencyBTC (18 decimals)
Block Explorerexplorer.mezo.org

RPC Providers

For production deployments, it is recommended to use a dedicated RPC provider for higher rate limits and stability.
ProviderHTTPSWSS
Boarhttps://rpc-http.mezo.boar.networkwss://rpc-ws.mezo.boar.network
Imperatorhttps://rpc_evm-mezo.imperator.cowss://ws_evm-mezo.imperator.co
Validation Cloudhttps://mainnet.mezo.public.validationcloud.iowss://mainnet.mezo.public.validationcloud.io
dRPC NodeCloudhttps://mezo.drpc.orgwss://mezo.drpc.org

Hardhat Configuration

To configure Hardhat for Mezo Mainnet, modify your hardhat.config.js (or .ts) file:
hardhat.config.js
module.exports = {
  defaultNetwork: "mezomainnet",
  networks: {
    mezomainnet: {
      url: "https://rpc-http.mezo.boar.network",
      chainId: 31612,
      accounts: ["YOUR_PRIVATE_WALLET_KEY"] // Use environment variables for security
    }
  },
  solidity: {
    version: "0.8.28",
    settings: {
      evmVersion: "london",
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  },
};
Always use environment variables to store private keys. Never commit private keys to version control.

Foundry Configuration

To configure a Foundry project for Mezo Mainnet, set the following in your foundry.toml:
foundry.toml
[profile.default]
chain_id = 31612
eth_rpc_url = "https://rpc-http.mezo.boar.network"
evm_version = 'london'

Multi-Network Configuration

For projects that need to support both Testnet and Mainnet, you can configure multiple networks:
module.exports = {
  networks: {
    mezotestnet: {
      url: "https://rpc.test.mezo.org",
      chainId: 31611,
      accounts: [process.env.TESTNET_PRIVATE_KEY]
    },
    mezomainnet: {
      url: "https://rpc-http.mezo.boar.network",
      chainId: 31612,
      accounts: [process.env.MAINNET_PRIVATE_KEY]
    }
  },
  solidity: {
    version: "0.8.28",
    settings: {
      evmVersion: "london",
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  },
};

Next Steps

Deploy Contracts

Start deploying your smart contracts to Mezo using your configured environment

Mezo Passport

Integrate wallet support for both Bitcoin and EVM wallets

MUSD Integration

Integrate MUSD stablecoin into your dApp

dApp Requirements

Review requirements for featuring in Mezo Market

Build docs developers (and LLMs) love