How to verify Smart Contracts using Remix and Etherscan?

 Verifying a Smart Contract is may seem easy.

Verifying a Smart Contract with Constructor Arguments can be more complicated




Verifying a Smart Contract with imported libraries AND *Constructor Arguments* (Using Remix + Etherscan)



What are Smart Contracts?

Read my Blog HERE.


 


1) From Remix, compile and deploy your contract (keep contract address for later)




2) Install FLATTENER plugin and use it to get the flattened code for your contract (keep flattened code for later)





3) Search your contract on Etherscan (using contract address) and look for the first transaction (Contract Creation).











What is Etherscan? How to become an Etherscan PRO?


Read my Blog HERE.




 

4) Scroll down -> "Click to see more" -> "Input Data" 


5) Browse down into Input Data until you find a string with many 000000s (close to the end of data) 


6) keep/store for later the data from the beginning of the 000000... to end (that's the encoded Constructor arguments)










7) Back to Contract tab -> Verify and Publish




8) Select Compiler Type (Solidity Single File) / Compiler Version and Open Source License: same as the contract and click Continue




9) Paste the *flattened* code on "Enter the Solidity Contract Code below" box. 


10) Paste the encoded Constructor arguments data (from step 6) on "Constructor Arguments" box (delete all the previous data) 


11) Verify and Publish







12) You contract should be now Verified (green checkmark next to "Contract") and now you can interact directly from Etherscan.




That's it. You're done!



Did it work?


Let me know in the comments



credit: GdG



Thank you for reading!


Hi! I'm Adil

Let’s stay in touch:


Comments