What you’ll build
A verified contract on BOTScan, with its source on the Code tab.Prerequisites
- The deployed contract address.
- The exact source and the settings you compiled with: compiler version, optimizer on or off, optimizer runs and EVM version.
- The constructor arguments, if the contract has any.
Pick a verification method
BOTScan testnet offers these methods for Solidity:
Vyper methods are also listed. You can check the current list at
https://scan.bohr.life/api/v2/smart-contracts/verification/config.
Steps
1
Prepare the source
For a single file with no imports, use it as it is.For a contract with imports, flatten it into one file. In Foundry:In Remix, right-click the file and choose Flatten. Hardhat can produce a standard JSON input instead; it is in the build info file under
artifacts/build-info/.2
Open the verification form
Go to your contract on BOTScan, for example
https://scan.bohr.life/address/0xYOUR_CONTRACT. Open the Contract tab and choose Verify & publish.3
Fill in the form
- Choose Solidity (Flattened source code) or Solidity (Standard JSON input).
- Pick the exact compiler version, for example
v0.8.28+commit.7893614a. - Set EVM version to
cancun. - Match the Optimization setting and runs to your build.
- Paste the source or upload the JSON file.
- Enter the contract name, for example
Greeter. - If there are constructor arguments, paste them ABI-encoded without the
0xprefix, or let BOTScan detect them.
Verify it worked
The Code tab shows a verified badge and your source. Read contract and Write contract now show forms for each function.Troubleshooting
The bytecode doesn't match
The bytecode doesn't match
One of the settings differs from the deploy. Check them in this order: compiler version, optimizer and runs, EVM version, constructor arguments. In Remix, the settings are on the Solidity compiler tab under Advanced configurations.
The contract already shows as verified
The contract already shows as verified
BOTScan can match new contracts to identical bytecode it has verified before. Nothing else to do.
Encoding constructor arguments
Encoding constructor arguments
Use
cast abi-encode, for example cast abi-encode "constructor(string)" "Hello", and remove the 0x prefix. You can also copy them from the end of the deploy transaction’s input data on BOTScan.Next steps
Verify with Foundry
Verify from the command line next time.
Verify with Hardhat
One command for Hardhat projects.