Hardhat

使用 Hardhat npx hardhat verify --network matic 在 Matic 上的合約驗證問題

  • June 14, 2022

我正在嘗試在 Matic 網路上部署契約,我在我的環境中設置了 API 密鑰和元遮罩的正確私鑰。(我已經部署了許多合約並多次以這種方式驗證它們。但是我無法讓我的合約在 matic 網路上進行驗證,我在 Mumbai 上以相同的方式執行確切的腳本並且它工作正常。

我成功部署後執行以下腳本

npx hardhat verify --network matic 0x488a79ca15b51d4deb7a2c45a25f32650cbaeb15

我收到的錯誤如下:

Error in plugin @nomiclabs/hardhat-etherscan: Failed to send contract verification request.
Endpoint URL: https://api.polygonscan.com/api
Reason: The Etherscan API responded that the address 0x488a79ca15b51d4deb7a2c45a25f32650cbaeb15 does not have bytecode.
This can happen if the contract was recently deployed and this fact hasn't propagated to the backend yet.
Try waiting for a minute before verifying your contract. If you are invoking this from a script,
try to wait for five confirmations of your contract deployment transaction before running the verification subtask.

我很沮喪,我知道有一種方法可以通過 remix 進行驗證,但是這個安全帽命令是我過去使用過的並且一直有效。

有誰知道為什麼會發生這種情況?

雖然您似乎解決了它,但我懷疑您只是需要等待幾分鐘,以便 polyscan 在契約驗證之前為部署數據編制索引。

引用自:https://ethereum.stackexchange.com/questions/130157