Mandala Chain
Build on Mandala

Verify a contract

Three ways to verify on Blockscout: Hardhat plugin, Foundry CLI, and the explorer UI.

Verifying a contract publishes its source code to Blockscout so users can read it, decode calls, and interact with the contract directly from the explorer. Three paths, pick the one that matches your toolchain.

With Hardhat

If you used the etherscan.customChains config from the Hardhat page:

npx hardhat verify --network mandalaTestnet 0xYourAddress

With constructor arguments:

npx hardhat verify --network mandalaTestnet 0xYourAddress "0xArg1" 42

For mainnet, swap mandalaTestnet for mandala.

With Foundry

If you used the [etherscan] config from the Foundry page:

forge verify-contract \
  --rpc-url mandala_testnet \
  --verifier blockscout \
  --verifier-url https://explorer.testnet.mandalachain.io:443/api/ \
  0xYourAddress \
  src/Counter.sol:Counter

For mainnet, swap mandala_testnet for mandala and the verifier URL to https://explorer.mandalachain.io:443/api/.

With the explorer UI

When the CLI flow fails or you only have the source files, use Blockscout directly.

  1. Open your contract address on explorer.mandalachain.io (or the testnet equivalent).
  2. Click the Contract tab.
  3. Click Verify and Publish.
  4. Pick the verification method: flattened source, multi-part files, or Sourcify metadata.
  5. Provide source, compiler version, optimizer settings, and constructor arguments.
  6. Submit. Blockscout compiles the source and compares the bytecode.

If they match, the contract is verified and the source appears in the Code tab.

Sourcify

Blockscout accepts Sourcify metadata. If your CI publishes to Sourcify, the contract is auto-verified on Mandala once the metadata propagates. See Blockscout's Sourcify integration docs for the wiring.

When verification fails

The most common cause is a mismatched build environment. Verification recompiles your source and compares bytecode byte-for-byte against the deployed contract. Anything that changes the compiler output breaks it:

  • Wrong compiler version
  • Wrong optimizer runs setting
  • Different EVM target version (paris vs cancun, etc.)
  • Missing or extra imports
  • File order in multi-file verification

Use the exact build settings from when you deployed.

If you do not own the deploy environment (a colleague deployed, the CI pipeline is gone), pull the source from Sourcify if available, or reconstruct the original solidity settings from your version control.

On this page