NomicFoundation / hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
https://hardhat.org
Other
7.21k stars 1.38k forks source link

Hardhat Etherscan API failing #2247

Closed biznickman closed 2 years ago

biznickman commented 2 years ago

When submitting npx hardhat verify the application has suddenly stopped verifying successfully. It then states "Error in plugin @nomiclabs/hardhat-etherscan: The Etherscan API responded with a failure status." Sometimes it replies "Forbidden" and other times just hangs with no error.

Nothing has changed in the project and the workflow is the same. The hardhat etherscan discord also is reporting similar issues with no response.

DavitMkhitaryan commented 2 years ago

what a pity 😢

here is my deps:

"dependencies": {
    "dotenv": "^16.0.1",
    "hardhat": "^2.10.1"
  },
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.1.0",
    "@nomiclabs/hardhat-etherscan": "^3.1.0",
    "ethers": "^5.6.9"
  }

here is the minimal repo that can reproduce this issue: https://github.com/FrankFan/hello-world-hardhat

I tried from ropsten , rinkeny to goerli, all was failed ,the error msg still was Error in plugin @nomiclabs/hardhat-etherscan: Invalid API Key

I have no idea where the problem was. I'm confuesd.

any expert can help us ?

thank you 😮‍💨

You can find my code here for reference: https://github.com/DavitMkhitaryan/opensea-nft-tutorial

Yes, I have reached the third page of Google already looking for any solution, but no result. I think there are problems with Etherscan API Keys, because as I said it is alos failing when sending raw API Requests using Postman, cURL, etc.

FrankFan commented 2 years ago

@DavitMkhitaryan maybe it's a problem with Etherscan itself. Could you share your test raw API Request snippet using Postman, cURL ?let me try.

DavitMkhitaryan commented 2 years ago

@DavitMkhitaryan maybe it's a problem with Etherscan itself. Could you share your test raw API Request snippet using Postman, cURL ?let me try.

yes, that's what I am saying, I think it is a problem with Etherscan itself, I have written to their support today and waiting for reply.

Here is the cURL snippet: curl --location --request POST 'https://api-goerli.etherscan.io/api?module=contract&action=verifyproxycontract&address=0x14a3B5cCf85DA7eF880eE07bE7356b378bd74425&apikey=APIKEY'

Screen Shot 2022-07-24 at 18 13 14
DavitMkhitaryan commented 2 years ago

@FrankFan were you able to verify a contract using cURL or Postman request?

FrankFan commented 2 years ago

I tested with getBalance action in Terminal: curl https://api-goerli.etherscan.io/api?module=account&action=balance&address=0x_address&tag=latest&apikey=my_apiKey, returns:

{"status":"0","message":"NOTOK","result":"Invalid API Key"}

then use your snippet to check verifyproxycontract with PostMan, the result was the same:Invalid API Key, see my screenshot: image

so It's turn out to be that may be the root cause of Invalid API Key is Etherscan itself 😢

what we have to do is waiting? or where to report the etherscan's issue, let them hep us.

DavitMkhitaryan commented 2 years ago

I tested with getBalance action in Terminal: curl https://api-goerli.etherscan.io/api?module=account&action=balance&address=0x_address&tag=latest&apikey=my_apiKey, returns:

{"status":"0","message":"NOTOK","result":"Invalid API Key"}

then use your snippet to check verifyproxycontract with PostMan, the result was the same:Invalid API Key, see my screenshot: image

so It's turn out to be that may be the root cause of Invalid API Key is Etherscan itself 😢

what we have to do is waiting? or where to report the etherscan's issue, let them hep us.

I have already reported the issue to etherscan support, you can do it too, maybe they will reply faster. - https://etherscan.io/contactus

ASHISHKUMAR2411 commented 2 years ago

Is there any other alternative as of now like if not etherscan then what we can use?

0xV4L3NT1N3 commented 2 years ago

gm all, can confirm that we had an issue with recently generated API Keys on all ETH testnets. Would everyone be able to give your verification or calls a try once again ?

Sorik98 commented 2 years ago

gm all, can confirm that we had an issue with recently generated API Keys on all ETH testnets. Would everyone be able to give your verification or calls a try once again ? My API key works on Ether mainnet but not with rinkeby test net. So I guess it because of etherscan itself.

0xV4L3NT1N3 commented 2 years ago

@Sorik98 do you mind forwarding the query string you used ? New keys do take a minute or two to be activated, I've just given a fresh key a try with Rinkeby and it went through.

DavitMkhitaryan commented 2 years ago

Would everyone be able to give your verification or calls a try once again ?

I still have the same issue, I tried with old API Keys and also with newly generated API Key. Is there any estimation when this issue will be resolved?

LeoAnt02 commented 2 years ago

Hello, I have the same issue I know that my API key is working because when I go to https://api-rinkeby.etherscan.io/api?module=account&action=balance&address=CONTRACT_ADRESS&tag=latest&apikey=API_KEY

I have this answer : {"status":"1","message":"OK","result":"8253563484904202995"} But when trying to verify with hardhat and @nomiclabs/hardhat-etherscan": "^3.1.0" , I get an error : Error in plugin @nomiclabs/hardhat-etherscan: Invalid API Key

Sorik98 commented 2 years ago

just wait guys, my API key is now working

DavitMkhitaryan commented 2 years ago

Finally, worked for me too. If for some of you it still fails, try generating new API Key and wait for some time.

LeoAnt02 commented 2 years ago

Everything work now, I was able to verify my contract

etherpan commented 2 years ago

I al glad to your success. Hope you are doing well

nolanjacobson commented 2 years ago

Took me ~15 mins after creating the API key for this error to stop being thrown.

BarneyChambers commented 2 years ago

This is still an issue for me on Ropsten, no update from Etherscan team yet.

EDIT: The solution was just to wait a while and then the API key magically was accepted :/

bolisteward commented 2 years ago

Hi, I got the same issue. Error in plugin @nomiclabs/hardhat-etherscan: Invalid API Key How I can solve this issue??. I want to validate my smart contract on etherscan.

0xV4L3NT1N3 commented 2 years ago

@bolisteward would you be able to try if your key works with other API endpoints on web ?

bolisteward commented 2 years ago

@0xV4L3NT1N3 yes, but I get the same error.

0xV4L3NT1N3 commented 2 years ago

Thanks, that likely indicates authentication is working fine on Etherscan's end, and may have something to do with your Hardhat config file

deadex-ng commented 1 year ago

When submitting npx hardhat verify the application does not verify successfully. It then states Error in plugin @nomiclabs/hardhat-etherscan: The Etherscan API responded with a failure status. When I generate a new key, it says Error in plugin @nomiclabs/hardhat-etherscan: Invalid API Key

moderate3012 commented 1 year ago
When submitting npx hardhat verify the application has suddenly stopped verifying successfully. It then states "Error in plugin @nomiclabs/hardhat-etherscan: The Etherscan API responded with a failure status." Sometimes it replies "Forbidden" and other times just hangs with no error.
Nothing has changed in the project and the workflow is the same. The hardhat etherscan discord also is reporting similar issues with no response.

same issue for me, please help me? Thanks!