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
-
If using Blockscout, you need to specify the API key:
export ETHERSCAN_API_KEY=<value goes here>
-
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
:Option Meaning Type Default value --worldAddress
Verify the contracts of the World at the given address string none, error if unspecified --configPath
Path to the config file string mud.config.ts
--verifier
The verifier to use ( sourcify
, orblockscout
)string --verifierUrl
URL to use to access the verifier's API string depends on the verifier used --profile
The foundry profile to use string local
--srcDir
Source directory string Foundry src
directory--version
Show version number boolean false
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?'