Verify Your Truffle Compiled and Deployed Contract on Etherscan
When asking users to thrust your smart contract code it may be important to share the code of the contract with them. Linking to the project source code from Github may not be enough as there is no guarantee that the code you show is the same as the code that runs your smart contract. You can see a list of verified smart contracts on Etherscan.io.
First of all, once you published you smart contract to the main net or any test network you need to find it on Etherscan by using the search field.
Once on your smart contract page, navigate to the Contract code tab and click on Verify and publish .
As the truffle framework optimize your contract, you’ll need to verify your contract source code in the new interface by clicking new Beta Source Code Contract Verifier .
You will then need to enter the name of your contract. The name must exactly match the one in your source code.
Then select the version of your Solidity compiler. If you are not sure about which version you are running, you can get it by typing solc –version in your terminal.
You then need to paste the code of your contract in the code text box. At this point, if you have any import you will need to manually remove them and copy and paste the content of the file instead of the import statement. If you want to go faster, you may check Blockcat solidity-flattener, a tool that will automatically concatenate the files for you.
If you deployed a contract which contained constructor arguments, you’ll need to add them in the following input box. Constructor arguments are expected to be ABI-encoded. More information on ABI-encoding can be found on the page, but remember that the constructor arguments are written right to left.
In the additional parameters section, you should check the number of times the optimizer is runt. For contracts compiled with Truffle, the correct default value for runs is 0.