跳至主要內容
本頁面使用機器翻譯自英語,可能包含錯誤或不清楚的語言。如需最準確的信息,請參閱英文原文。由於更新頻繁,部分內容可能與英文原文有出入。請加入我們在 Crowdin 上的努力,幫助我們改進本頁面的翻譯。 (Crowdin translation page, Contributing guide)

How to Verify Smart Contracts Using Hardhat

This guide allows you to automatically verify your smart contracts' source code on Kaiascope straight from your CLI using the Hardhat Verify Plugin.

To verify your contract on Kaia, you need to add the following configuration to your hardhat.config.js:

Kaiascan


module.exports = {
etherscan: {
apiKey: {
kaia: "unnecessary",
},
customChains: [
{
network: "kaia",
chainId: 8217,
urls: {
apiURL: "https://mainnet-api.kaiascan.io/hardhat-verify",
browserURL: "https://kaiascan.io",
}
},
]
}
}

Kaiascope


module.exports = {
networks: {
kaia: {
chainId: 8217,
url: "RPC_URL",
},
},
etherscan: {
apiKey: {
kaia: "unnecessary",
},
customChains: [
{
network: "kaia",
chainId: 8217,
urls: {
apiURL: "https://api-cypress.klaytnscope.com/api",
browserURL: "https://kaiascope.com/",
},
},
]
}
}

To verify the contract, you will run the verify command and pass in the address of the deployed contract, network and parameters if any.


npx hardhat verify –network <network> <deployed_address> <parameters>
// example
npx hardhat verify --network kairos 0x3e360fC99c4383e3adaAE9742c0fC983fDAa0535

In your terminal you should see the source code for your contract was successfully submitted for verification.

If the verification was successful, you should see Successfully verified contract and there will be a link to the contract code on Kaiascan and Kaiascope respectively.

Kaiascan

Kaiascope

讓這個頁面變得更好