hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

Error trying to verify on blast mainnet network etherscan: "Please report this issue to the Hardhat team."

Open kneelsdev opened this issue 10 months ago • 8 comments

Version of Hardhat

2.12.4

What happened?

Error details

hardhat-verify found one or more errors during the verification process:

Etherscan:
An unexpected error occurred during the verification process.
Please report this issue to the Hardhat team.
Error Details: Unexpected token '<', "

<!DOCTYPE "... is not valid JSON

Minimal reproduction steps

Hardhat config can be found here: https://github.com/guminc/contracts

set sourcify enabled: false, try to verify contract on custom chain.

Search terms

error, verify, etherscan

kneelsdev avatar Apr 12 '24 01:04 kneelsdev

chain info:

    customChains: [
      {
        network: "blast_mainnet",
        chainId: 81457,
        urls: {
          apiURL: "https://api.blastscan.io/",
          browserURL: "https://blastscan.io/",
        },
      },

kneelsdev avatar Apr 12 '24 01:04 kneelsdev

Is this just not working?

luisanton-io avatar Apr 24 '24 10:04 luisanton-io

@luisanton-io this looks as if blastscan is returning an error as html (so not a hardhat-verify issue).

What are you seeing? The same <!DOCTYPE "... is not valid JSON?

kanej avatar Apr 24 '24 10:04 kanej

Yes, <!DOCTYPE etc error. I tried with another config though, which returns an apparently encouraging message:

Successfully submitted source code for contract

This is my config now:

      {
        network: "blast-mainnet",
        chainId: 81457,
        urls: {
          apiURL:
            "https://api.routescan.io/v2/network/mainnet/evm/81457/etherscan",
          browserURL: "https://blastscan.io/",
        },
      },

Too bad it's hanging forever and ultimately failing. Open to suggestions if anyone got it working

luisanton-io avatar Apr 24 '24 16:04 luisanton-io

Do you need to set an API key for blastscan?

It would need to under the same name as you use for the network (i.e. blast-mainnet):

https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify#multiple-api-keys-and-alternative-block-explorers

kanej avatar Apr 25 '24 10:04 kanej

Thanks for helping @kanej yes I do have api keys set

  etherscan: {
    apiKey: {
      "blast-mainnet": "...",
    },

luisanton-io avatar Apr 25 '24 13:04 luisanton-io

The correct endpoint should include the /api path, try correcting your config to

customChains: [
      {
        network: "blast_mainnet",
        chainId: 81457,
        urls: {
          apiURL: "https://api.blastscan.io/api",
          browserURL: "https://blastscan.io/",
        },
      },

0xV4L3NT1N3 avatar Apr 25 '24 16:04 0xV4L3NT1N3

@0xV4L3NT1N3 Thanks, unfortunately, still no luck

luisanton-io avatar Apr 28 '24 11:04 luisanton-io

Hey, we believe this is a blast api issue. We are working on improving our error reporting to provide more information in these cases, but we don't think there is more for Hardhat to do here.

kanej avatar May 09 '24 15:05 kanej

The correct endpoint should include the /api path, try correcting your config to

customChains: [
      {
        network: "blast_mainnet",
        chainId: 81457,
        urls: {
          apiURL: "https://api.blastscan.io/api",
          browserURL: "https://blastscan.io/",
        },
      },

Perfect this did the trick for me, thank you

kneelsdev avatar May 20 '24 02:05 kneelsdev