hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

@nomiclabs/hardhat-etherscan always throw no apikey error

Open DwGoing opened this issue 2 years ago • 12 comments

The plugin always throw error like "You are trying to verify a contract in 'polygonMumbai', but no API token was found for this network", when i execute "hardhat verify". I have provided a key and the operation was successful. image

DwGoing avatar Jun 16 '22 05:06 DwGoing

This issue is also being tracked on Linear.

We use Linear to manage our development process, but we keep the conversations on Github.

LINEAR-ID: 249d4f31-6d7e-48f3-b871-41b5f0b264d7

github-actions[bot] avatar Jun 16 '22 05:06 github-actions[bot]

@DwGoing You've to provide an API key for https://mumbai.polygonscan.com/ in case you haven't yet or provided etherscan's API key.

iKausik avatar Jun 17 '22 10:06 iKausik

@iKausik I have provided an API key. image

DwGoing avatar Jun 21 '22 09:06 DwGoing

Also getting this error running against etherscan on Rinkeby after a successful verification.

Importantly - the verification doesn't take place with an empty API key (with a similar error), but when there's a valid one it verifies successfully and then still shows the error afterwards.

"@nomiclabs/hardhat-etherscan": "^3.1.0"

If it helps, I'm also using an upgradeable contract, verifying the implementation. And I have a TypeScript config file for hardhat.

JasperTimm avatar Jun 21 '22 14:06 JasperTimm

if I'm not wrong, you're deploying on the Polygon Mumbai testnet, but you're using etherscan API keys which is for Ethereum and its testnets. You should be using the API key from PolygonScan

iKausik avatar Jun 21 '22 14:06 iKausik

if I'm not wrong, you're deploying on the Polygon Mumbai testnet, but you're using etherscan API keys which is for Ethereum and its testnets. You should be using the API key from PolygonScan

@iKausik - I'm using an Etherscan API key when deploying to Rinkeby and a Polygonscan API key when using Mumbai. To make this very clear - the issue is not that we cannot verify, it's simply that when we do verify successfully it STILL reports an error message in the logs.

JasperTimm avatar Jun 21 '22 17:06 JasperTimm

Im running into the same issue , running the script through hardhat using etherscan rinkeby works and gets deployed . But when running verify it claims no api token was found in the config.

KahunaCowboy avatar Jun 23 '22 17:06 KahunaCowboy

Same issue here, seems hardhat guys dont know cause i tracked all this issues

Aubuga avatar Jul 04 '22 23:07 Aubuga

gm all, joining in this thread from Etherscan. Had a quick go at it using "@nomiclabs/hardhat-etherscan": "^3.1.0", and it didn't run into any issues.

etherscan: {
    apiKey: {
      polygonMumbai: process.env.POLYGONSCAN_API_KEY
    },
 }

@DwGoing since you're using a JSON import, could you hardcode the key or check if the import is read correctly ?

0xV4L3NT1N3 avatar Jul 13 '22 07:07 0xV4L3NT1N3

gm all, joining in this thread from Etherscan. Had a quick go at it using "@nomiclabs/hardhat-etherscan": "^3.1.0", and it didn't run into any issues.

etherscan: {
    apiKey: {
      polygonMumbai: process.env.POLYGONSCAN_API_KEY
    },
 }

@DwGoing since you're using a JSON import, could you hardcode the key or check if the import is read correctly ?

Same problem.

DwGoing avatar Jul 13 '22 07:07 DwGoing

Can you try to use consistent network naming? I see mumbai in the network object, but polygonMumbai in etherscan. I encountered an error with such a configuration before.

coding-velociraptor avatar Aug 03 '22 06:08 coding-velociraptor

Hey @DwGoing, sorry for not responding before. Looking at your screenshot it does seem that something is going wrong here.

How can I reproduce this problem? Can you create a minimal reproducible example or share your repo with me?

Also, which plugins are you using? Are you overriding some tasks yourself?

fvictorio avatar Aug 03 '22 06:08 fvictorio

Closing for lack of MRE.

fvictorio avatar Oct 03 '22 13:10 fvictorio