hardhat
hardhat copied to clipboard
@nomiclabs/hardhat-etherscan always throw no apikey error
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.
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
@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 I have provided an API key.
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.
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
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.
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.
Same issue here, seems hardhat guys dont know cause i tracked all this issues
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 ?
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.
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.
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?
Closing for lack of MRE.