Contract Verification

Modular Cloud enables NautScan users to verify contracts on the Proteus network, powered by Sourcify. This feature will be released generally to all chains in the future.


Verifying your contract

You can quickly verify contracts from this web page.

Watch this video tutorial and follow the instructions below.

Prerequisites

  • A contract that has been deployed
  • Solidity file(s) used in the contract
  • The associated metadata.json file -- if it was deployed using Hardhat, then upload the .json output file generated under artifacts/build-info

Step by Step guide for verification

1. Upload the Solidity Contract metadata file

If the contract is deployed through hardhat, the metadata file is located under artifacts/build-info.

This file contains the necessary details about the compiled contract.

Note: If the Hardhat version is earlier than 2.6.8, you should follow this additional step:

  • Modify the hardhat-config.js manually to output metadata inside the build-info/ file:
// hardhat-config.js
module.exports = {
  ...
  solidity: {
    settings: {
      version: ...,
      optimizer: {...},
      outputSelection: {
        "*": {
          "*": [
            "abi",
            "evm.bytecode",
            "evm.deployedBytecode",
            "metadata", // <-- add this
            ...
          ]
        },
      },
    },
  },
  ...
};

2 . Upload the Solidity Contract File

  • Click on the designated area or button to browse your File Explorer.
  • Locate and select the .sol contract file you wish to verify.

3. Input the Contract Address

  • In the provided field, paste the corresponding contract address that you'd like to verify. This address should be where your contract is currently deployed.

4. Select the Appropriate Chain

  • Using the dropdown menu, select the blockchain on which your contract is deployed.

5. Initiate Verification

  • Click on the 'Verify' button to begin the verification process.

6. Choose the Main Contract

  • After clicking on the 'Verify' button, if the contract was deployed via Hardhat, a pop-up will appear listing all the contracts present in your .sol file.
  • From the list, select the main contract you wish to verify.

7. Confirmation

  • Wait for the interface to present a pop-up response with feedback.
  • Once the verification is successful, you should receive a confirmation message, and others will be able to view the source code when they access your contract on the dedicated block explorer.

Interacting with verified contracts

NautScan will display the verification status to users when they view the contract page.

It is possible for your contract to be fully or partially verified. Partial verification refers to cases when the deployed bytecode of the onchain contract matches the bytecode resulting from the recompilation with the metadata and the source files but does not match the metadata hash.

The explorer will also show the source code for verified contracts in the explorer. In future updates, users will be able to create transactions based on the contract's ABI.