NomicFoundation / hardhat

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

Unable to verify through custom chain configs #3534

Closed bolpol closed 1 year ago

bolpol commented 1 year ago

Guide: https://hardhat.org/hardhat-runner/plugins/nomiclabs-hardhat-etherscan#adding-support-for-other-networks

My configs:

etherscan: {
    apiKey: {
      ethereum: process.env.ETHERSCAN_API_KEY,
      okx: process.env.OKX_URL
    },
    customChains: [
      {
        network: "okx",
        chainId: 66,
        urls: {
              apiURL: "https://www.oklink.com/api/explorer/v1/okc/contract/multipartVerify",
              browserURL: "https://www.oklink.com/en/okc"
        },
        httpHeaders: {
          "Ok-Access-Key": `${process.env.OKX_API_KEY}`
        }
      }
    ]
  },

Result (still the same):

NomicLabsHardhatPluginError: An etherscan endpoint could not be found for this network. ChainID: 66. The selected network is okx.

Possible causes are:

  • The selected network (okx) is wrong.
  • Faulty hardhat network config.
fvictorio commented 1 year ago

Hmm, that config looks correct to me. We don't support httpHeaders in the customChains config though (I opened #3536 for that).

But the error shouldn't be the one you got; you should get a message about the request failing. Can you help me reproduce this? Does OKX have a testnet with an explorer? If not, can you send me enough value to deploy a contract to 0xed57c53C505ccE57Cdee5872Ff1016024a45ef36?

bolpol commented 1 year ago

Sent you 1 testOKX https://www.oklink.com/en/okc-test/tx/0xb38faccb1cc565ad6883a8d4aba13f3fca80ebc5e0de73f1d5b912ba09a6922b

API key could be received on block explorer https://www.oklink.com/docs/en/#overview

fvictorio commented 1 year ago

Hey @gfijrb, sorry for not responding before. Is this still relevant? I feel like I tried to reproduce it but couldn't do it, but I forgot the details. I'll give it another try if you confirm that it's still an issue.

bolpol commented 1 year ago

Hey @gfijrb, sorry for not responding before. Is this still relevant? I feel like I tried to reproduce it but couldn't do it, but I forgot the details. I'll give it another try if you confirm that it's still an issue.

Hi yeah, it is still an issue.

fvictorio commented 1 year ago

Hey @bolpol, sorry for not responding to this before, but every time I try to look into this issue I run into some problem. Could you tell me which JSON-RPC url can I use for the testnet of this chain? The ones that they have in their docs don't seem to work.

bolpol commented 1 year ago

Hi @fvictorio

Network name OKC Testnet RPC https://exchaintestrpc.okex.org chain id 65 symbol OKT(TEST) Explorer https://www.oklink.com/okc-test/

fvictorio commented 1 year ago

Hey @bolpol, I gave this another try and there are several different things going on here.

  1. As mentioned before, we don't support httpHeaders for custom chains. We should, and that is tracked by https://github.com/NomicFoundation/hardhat/issues/3536
  2. I kept the issue open because I was particularly interested in the "An etherscan endpoint could not be found" error, since that seemed incorrect given your config. But I couldn't reproduce that; in my case it does attempt to send requests to the server.
  3. Even taking that into account, I don't think the explorer supports an etherscan-compatible contract verification endpoint, does it? If they do, their docs don't mention it.

Sorry for taking so long to give a disappointing "can't reproduce" answer. I'm going to close this now, but if you still think there's something wrong in our end, please let me know.