Skip to main content
MANTRA Chain is fully EVM-compatible, which means you can deploy Solidity smart contracts using familiar tools like Hardhat, Foundry, or Remix.
Full EVM Compatibility: Deploy Solidity smart contracts using standard EVM tooling - no need to learn new languages!

Prerequisites

Before deploying, make sure you have:
  • A funded wallet with OM tokens for gas fees
  • Your contract compiled and ready to deploy
  • Network configuration set up

Network Configuration

Testnet (DuKong)

Mainnet

Method 1: Using Hardhat

Hardhat is a popular development environment for Ethereum software.

Setup

  1. Install Node.js (version 18.0 or higher recommended)
  2. Create a new project:
    mkdir my-project
    cd my-project
    npm init -y
    npm install --save-dev hardhat
    npx hardhat init
    
  3. Configure Hardhat for MANTRA Chain by updating hardhat.config.js:
    require("@nomicfoundation/hardhat-toolbox");
    
    module.exports = {
      solidity: "0.8.23",
      networks: {
        mantra_mainnet: {
          url: "https://evm.mantrachain.io",
          chainId: 5888,
          accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
        },
        mantra_testnet: {
          url: "https://evm.dukong.mantrachain.io",
          chainId: 5887,
          accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
        },
      },
    };
    

Create Deployment Script

Create scripts/deploy.js:
const hre = require("hardhat");

async function main() {
  const MyContract = await hre.ethers.getContractFactory("MyContract");
  const myContract = await MyContract.deploy();
  
  await myContract.waitForDeployment();
  const address = await myContract.getAddress();
  
  console.log("Contract deployed to:", address);
  console.log("Explorer:", `https://explorer.dukong.io/address/${address}`);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

Deploy

npx hardhat run scripts/deploy.js --network mantra_testnet
For more details, see our Hardhat guide.

Method 2: Using Foundry

Foundry is a fast, portable, and modular toolkit for Ethereum application development.

Setup

  1. Install Foundry:
    curl -L https://foundry.paradigm.xyz | bash
    foundryup
    
  2. Create a new project:
    forge init my-contract
    cd my-contract
    

Deploy with Forge

forge create src/MyContract.sol:MyContract \
  --rpc-url https://evm.dukong.mantrachain.io \
  --private-key $PRIVATE_KEY \
  --chain-id 5887

Using Scripts

Create script/Deploy.s.sol:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Script, console} from "forge-std/Script.sol";
import {MyContract} from "../src/MyContract.sol";

contract DeployScript is Script {
    function run() external {
        vm.startBroadcast();
        
        MyContract myContract = new MyContract();
        
        console.log("Contract deployed to:", address(myContract));
        
        vm.stopBroadcast();
    }
}
Deploy:
forge script script/Deploy.s.sol:DeployScript \
  --rpc-url https://evm.dukong.mantrachain.io \
  --private-key $PRIVATE_KEY \
  --broadcast \
  --chain-id 5887
For more details, see our Foundry guide.

Method 3: Using Remix

Remix is a web-based IDE that makes it easy to deploy contracts without local setup.

Steps

  1. Go to Remix IDE
  2. Create or import your Solidity contract
  3. Compile your contract
  4. Go to the “Deploy & Run” tab
  5. Select “Injected Provider” (MetaMask)
  6. Make sure MetaMask is connected to MANTRA Chain
    • Add MANTRA Chain network if needed:
      • Network Name: MANTRA Chain Testnet
      • RPC URL: https://evm.dukong.mantrachain.io
      • Chain ID: 5887
      • Currency Symbol: OM
  7. Deploy your contract

After Deployment

Verify Your Contract

After deployment, verify your contract on the block explorer. This allows others to view and interact with your contract source code. See our Verifying Contracts guide for detailed instructions.

Interact with Your Contract

Once deployed, you can:
  • View your contract on the block explorer
  • Interact with it using the explorer’s contract interaction features
  • Build a frontend application to interact with your contract

Next Steps

Resources