CLI
mud verify

mud verify

This command uploads the source code for the deployed contracts to a public repository, such as a block explorer. The repository then compiles the source code and verifies that the compiled version is identical to what is deployed onchain.

Using the command

  1. If using Blockscout, you need to specify the API key:

    export ETHERSCAN_API_KEY=<value goes here>
  2. Run the command.

    pnpm mud verify --worldAddress <address here> --verifier <verifier> --rpc <RPC to the blockchain>

    These are the command line options you can specify on mud verify:

    OptionMeaningTypeDefault value
    --worldAddressVerify the contracts of the World at the given addressstringnone, error if unspecified
    --configPathPath to the config filestringmud.config.ts
    --verifierThe verifier to use (sourcify, or blockscout)string
    --verifierUrlURL to use to access the verifier's APIstringdepends on the verifier used
    --profileThe foundry profile to usestringlocal
    --srcDirSource directorystringFoundry src directory
    --versionShow version numberbooleanfalse

    Note that it takes block explorers some time to process new contracts. You should wait 5-10 minutes past deployment before you verify the contract on Etherscan and/or Blockscout.

Examples

  • To verify the world at that address on Holesky (after adding the profile to foundry.toml) on sourcify (opens in a new tab):

    WORLD_ADDRESS=0x816038e244ff78b86a5e7dec9bf281634fb6d2a2
    pnpm mud verify --rpc https://ethereum-holesky.publicnode.com --worldAddress $WORLD_ADDRESS --verifier sourcify
  • To verify on Holesky on Blockscout (opens in a new tab):

    WORLD_ADDRESS=0x816038e244ff78b86a5e7dec9bf281634fb6d2a2
    export ETHERSCAN_API_KEY= ** blockscout API key goes here **
    pnpm mud verify --rpc https://ethereum-holesky.publicnode.com --worldAddress $WORLD_ADDRESS --verifier blockscout --verifier-url 'https://eth-holesky.blockscout.com/api?'