Verifying a smart contract in BlockScout
Once verified, a smart contract or token contract’s source code becomes publicly available and verifiable. This creates transparency and trust. Plus, it’s easy to do!
-
Go to blockscout.com, verify you are on the chain where the contract was deployed, and type the contract’s address into the search bar. Your contract details should come up.
-
Select the
Code
tab to view the bytecode.
- In the code tab view, click the
Verify & Publish
button.
-
On the following screen, enter your contract details:
-
Contract Address: The
0x
address supplied on contract creation. -
Contract Name: Name of the class whose constructor was called in the .sol file. For example, in
contract MyContract {..
MyContract is the contract name. -
Compiler: derived from the first line in the contract
pragma solidity X.X.X
. Use the corresponding compiler version rather than the nightly build. - Optimization: If you enabled optimization during compilation, check yes.
- Enter the Solidity Contract Code: You may need to flatten your solidity code if it utilizes a library or inherits dependencies from another contract. We recommend the POA solidity flattener or the truffle flattener
- Click the
Verify and Publish
button.
-
Contract Address: The
-
If all goes well, you will see a green checkmark next to the code, and an additional tab where you can read the contract. In addition, the contract name will appear in BlockScout with any transactions related to your contract.
Troubleshooting:
If you receive the dreaded There was an error compiling your contract
message this means the bytecode doesn’t match the supplied sourcecode. Unfortunately, there are many reasons this may be the case. Here are a few things to try:
-
Double check the compiler version is correct.
-
Check that an extra space has not been added to the end of the contract. When pasting in, an extra space may be added. Delete this and attempt to recompile.
-
Copy, paste and verify your source code in Remix. You may find some exceptions here.
Note: BlockScout does not currently support validation of contracts containing constructor arguments.