How to Verify Contracts via Mantle's Mainnet Explorer

09/01/234 min read

Mantleby Mantle




How to Verify Contracts via Mantle's Mainnet Explorer


Verifying a smart contract on Mantle Network involves ensuring that the deployed contract's source code matches its bytecode, and that it has been deployed with the correct parameters. This verification process enhances transparency and trust in the smart contract ecosystem. In this guide, we will walk you through the steps to verify a smart contract on Mantle Network using a blockchain explorer.

This tutorial should help all developers and users trying to verify their contracts on Mainnet Network Mainnet.


  1. Deployed smart contracts on Mantle Network.
  2. Solidity source code for the deployed contract.
  3. Access to Mantle Mainnet explorer

Steps to verify a Smart Contract:

Sourcify is a service provided by BlockScout that aims to simplify and streamline the process of verifying smart contracts on different networks, including Mantle Network. This guide will walk you through the steps to verify your smart contract on Mantle Network using the Sourcify service.


Deployed smart contracts on Mantle Network. Before verifying the smart contract, ensure you have the smart contract that has been successfully deployed on Mantle Network. Use a Solidity compiler, such as the Solidity compiler online version or the Solidity compiler available in development tools like Truffle, to compile the source code.

If you're new to blockchain development, please refer to our guide to deploy a smart contract using a no-code tool like Remix.

  1. Open the deployed contract on Explorer. Open the address page for the contract you want to verify.

  2. Switch to Code tab, and click Verify & Publish button.

  3. Now there's 4 ways of verifying contracts on the explorer. Let's try to verify contracts using all options (pls note that we will deploy new contracts for verifying all options -- you just have to choose either one of 4)

Option 1: Verifying Via Flattened Source Code

What exactly is flattening you might ask?

Flattening a smart contract refers to the process of taking a complex, multi-file Ethereum smart contract and combining all its code into a single file. On blockchain platforms, smart contracts are often written in high-level programming languages like Solidity, and are composed of multiple files that contain various components and functionalities.

However, when it comes to deploying a smart contract on the blockchain, it's more efficient to have a single file containing all the code. Flattening the smart contract involves extracting the content of all the different files and merging them into one, removing any import statements that reference other files. This creates a single, self-contained code file that can be easily compiled and deployed onto blockchain.

Here's some guide to help you flatten your existing smart contract.

  1. For Truffle - Link
  2. For Hardhat - Link

Let's look at flattening via Remix for this tutorial:

Right click on the solidity file you wish to flatten, upon clicking — a new tab of the flattened version of the source code should be available.

Copy the flattened code and paste it in the explorer as shown in the pic below.

Hit "Verify" and wait for the contract to get verified.

Option 2: Verifying Via Standard Input JSON

Drag and drop (or click the button to add files from your computer) all .sol files used by the target contract you want to verify and the .json file containing the contract's metadata.

For example, if your .json is created by Truffle in ./build/contracts folder after truffle compile. If your contract has linked libraries, you should also drag & drop .JSON files _for those libraries. Once all files are added, start verification by clicking the _Verify & Publish button.

Hit "Verify". After several seconds, your contract should be verified through Sourcify's API (If verification fails, you will see the reason in the dropzone). Verification metadata will be saved in the Blockscout DBand wait for the contract to get verified.

Option 3: Verifying via Multi-Part Files

Multi-part files process is similar to the one mentioned above. Here, the user needs to upload their .sol files and click on verify.

Option 4: Verifying via Vyper Contract

If you're using Vyper instead of solidity, then you need to upload your smart contract and ABI. The steps remain the same.

By following these steps mentioned above, you should be able to successfully verify your smart contract on the Mantle Network using the Sourcify service provided by BlockScout. This verification process enhances transparency and allows users to trust in the contract's legitimacy and functionality.

Please note that the steps and options provided above might evolve over time. Always refer to the official documentation and guidelines provided by Mantle Network's Documentation on Mainnet explorer for the most accurate and up-to-date information.