Verify a Smart Contract on Etherscan
How to verify using build-info files in Hardhat ✅
It is very crypto to make everything transparent. In that spirit I am going to show you how to verify your smart contract and make the code available on Etherscan.
It can be beneficial for your project because it adds a layer of trust. Developers can check your contract and make sure there are no vulnerabilities or malicious features.
Verify
You’ve just deployed your contract with Hardhat and you want to verify your contract on Etherscan.
- Select ‘Verify and Publish’.
- Select ‘Standard-Json-Input’ for the Compiler Type.
- You can find your Compiler Version in
hardhat.config.js
. - MIT is the commonly used License Type for smart contract development.
Standard Json-Input
Create a new file standard.json
to store the Standard Json-Input of your smart contract.
In the artifacts
folder find the JSON file in build-info
.
ctrl+f
search for ‘settings’. Find the bit that ends [“ast”]}}}}
and copy
from there to just after “input”:
, and add to the standard.json file.
Upload your standard.json file.
Thank you for reading! 🙏
If you like this content, clap! 👏
If you don’t, comment 📝
I’ll be writing lots more articles in the future, so don’t forget to follow! If you know someone who would enjoy this article, please share it with them!