verify smart contracts on etherscan

~ 5 min.

26.03.2023
edit
image

Clone this repo -- maintained by your fellow shipper :)

git clone https://github.com/shipends/verify-etherscan

Go inside the folder + install packages.

npm install

  • Go here + Sign Up / Sign In.
  • After logging in, head over here and create your API key.
  • Copy that API Key + create .env file + paste it there.
  • ETHERSCAN_API_KEY = A6NY2IUQX43A2F3PK9AU46PWXN8V5X6FPS
    
  • Create an Alchemy account from here.
  • Go to dashboard from here, then click on Create App.
  • Go to dashboard again, then click on View Key + copy the HTTPS url.
  • Paste that copied URL in .env too.
  • ALCHEMY_RPC_URL = https://polygon-mumbai.g.alchemy.com/v2/HXjU_LEQGsJdorj0WvERDM33FLGv5tnk
    
  • Drop your smart contract in contracts folder
  • If your smart contract has any constructor arguments, open arguments.js + put those over there.
  • module.exports = ["Helu Shipper!", "Shipends"];

    Note -- Arguments must be exactly same as when your contract was deployed.

  • If you have contructor arguments, run the command given below.
  • npx hardhat verify --constructor-args arguments.js 0xFB6dBBF6CA6445409D572D11Da2d38d8e97Ac7df --network mumbai
  • OR else run this one given below.
  • npx hardhat verify 0xFB6dBBF6CA6445409D572D11Da2d38d8e97Ac7df --network mumbai

    p.s., don't forget to replace given smart contract address with yours :)

    Go to Polygonscan Mumbai from here + paste your deployed contract address in search bar -- you will see a green check mark on Contract tab + anyone can connect their wallet & interact with it -- you don't need that hunky-funky frontend after all :)