Verify Contract

Yan Ru Su

Etherscan API Key

https://etherscan.io/
到etherscan register 取得API Key

Use hardhat set API Key

npx hardhat vars set “varible name”

Example

varible name: ETHERSCAN

1
2
npx hardhat vars set ETHERSCAN
Enter value: · **********************************

Hardhat.config.js use etherscan api key

In module.exports add

1
2
3
etherscan: {
apiKey: vars.get("ETHERSCAN"),
},

Use verify commad

npx hardhat verify –network “network name” address

Example

network:arbitrumSepolia
address:0xE8F6DAb9045c9Ce68D37eA95e416D54E7E5678Ef

1
npx hardhat verify --network arbitrumSepolia 0xE8F6DAb9045c9Ce68D37eA95e416D54E7E5678Ef

If success

1
2
3
4
5
6
Successfully submitted source code for contract
contracts/token.sol:Token at 0xE8F6DAb9045c9Ce68D37eA95e416D54E7E5678Ef
for verification on the block explorer. Waiting for verification result...

Successfully verified contract Token on the block explorer.
https://sepolia.arbiscan.io/address/0xE8F6DAb9045c9Ce68D37eA95e416D54E7E5678Ef#code