Verify a Smart Contract on Etherscan

How to verify using build-info files in Hardhat ✅

Benjamin Duffield-Harding
Coinmonks
Published in
2 min readApr 8, 2024

--

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.

Photo by Bernard Hermant on Unsplash

Verify

You’ve just deployed your contract with Hardhat and you want to verify your contract on Etherscan.

  1. Select ‘Verify and Publish’.
  2. Select ‘Standard-Json-Input’ for the Compiler Type.
  3. You can find your Compiler Version in hardhat.config.js.
  4. 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 📝

Source

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!

--

--