Verifying your contract on Etherscan

Including how to find the ABI parameters…

Let’s create a contract that has a constructor that requires parameters

simple contract that requires ABI parameters

Deploying this to Rinkeby from remix

Normally when we deploy a contract we want to verify it so that people can understand and trust the contract. If we look at the code tab on the contract, we can see code (in hex) and the ABI encoded constructor arguments.

Following the link to verify the contract…

etherscan usually fills in the ABI encoded constructor arguments from the page above

Paste your contract in the code box, select the compiler version and optimisation flag…

You get those from remix when you deployed the contract…

sometimes the code does not wrap. Don’t worry

You can then click the “I am not a robot button” and verify the contract.

The page indicating that verification succeeded
The code page

As you have seen, Etherscan usually figures out the ABI encoded parameters for you, but occasionally it doesn’t happen and you need to figure them out.

You could have a look at the documentation or retain your sanity by doing it the easy way…

Going back to the contract deployment transaction Input data.

from contract deployment page

If you scroll down to the bottom, you will see (in this case at the end of the second row) the numbers 0029. The ABI encoded parameters are in the input data after the 0029.

The ABI encoded constructor parameters

Simply paste this into the constructor field on the code verification page and you are set to go.