Skip to content

Commit

Permalink
Merge pull request #214 from ayo-klaytn/add/kaiascan-hardhat-verify
Browse files Browse the repository at this point in the history
kaiascan verification guide added
  • Loading branch information
praveen-kaia authored Jan 20, 2025
2 parents 66644ad + afec497 commit ada1951
Show file tree
Hide file tree
Showing 8 changed files with 3,803 additions and 1,925 deletions.
87 changes: 0 additions & 87 deletions docs/build/smart-contracts/verify/hardhat.md

This file was deleted.

153 changes: 153 additions & 0 deletions docs/build/smart-contracts/verify/hardhat.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
---
id: hardhat
title: Using Hardhat
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

# 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

<Tabs>
<TabItem value="kaia-mainnet" label="Mainnet">
```js
module.exports = {
etherscan: {
apiKey: {
kaia: "unnecessary",
},
customChains: [
{
network: "kaia",
chainId: 8217,
urls: {
apiURL: "https://mainnet-api.kaiascan.io/hardhat-verify",
browserURL: "https://kaiascan.io",
}
},
]
}
}
```
</TabItem>

<TabItem value="kairos-testnet" label="Kairos">
```js
module.exports = {
etherscan: {
apiKey: {
kairos: "unnecessary",
},
customChains: [
{
network: "kairos",
chainId: 1001,
urls: {
apiURL: "https://kairos-api.kaiascan.io/hardhat-verify",
browserURL: "https://kairos.kaiascan.io",
}
},
]
}
}
```
</TabItem>
</Tabs>

## Kaiascope

<Tabs>
<TabItem value="kaia-mainnet" label="Mainnet">
```js
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/",
},
},
]
}
}
```
</TabItem>

<TabItem value="kairos-testnet" label="Kairos">
```js
module.exports = {
networks: {
kairos: {
chainId: 1001,
url: "RPC_URL",
},
},
etherscan: {
apiKey: {
kairos: "unnecessary",
},
customChains: [
{
network: "kairos",
chainId: 1001,
urls: {
apiURL: "https://api-baobab.klaytnscope.com/api",
browserURL: "https://kairos.kaiascope.com",
},
},
]
}
}
```
</TabItem>
</Tabs>

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

```bash
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](https://kairos.kaiascan.io/address/0x3e360fC99c4383e3adaAE9742c0fC983fDAa0535?tabId=contract&page=1) and [Kaiascope](https://baobab.klaytnscope.com/account/0x3e360fC99c4383e3adaAE9742c0fC983fDAa0535?tabId=contractCode) respectively.

**Kaiascan**

![](/img/build/smart-contracts/verify/kaiascan-terminal.png)
![](/img/build/smart-contracts/verify/kaiascan-verify.png)

**Kaiascope**

![](/img/build/smart-contracts/verify/kaiascope-terminal.png)
![](/img/build/smart-contracts/verify/kaiascope-verify.png)

## Useful links

- [Configuration for Hardhat Verify Plugin on Kaiascan](https://docs.kaiascan.io/hardhat-verify)
- [Configuration for Hardhat Verify Plugin on Kaiascope](https://docs.klaytnscope.com/contract/configuration-for-hardhat-verify-plugin)
- [Verifying contracts using Hardhat on Kaiascan](https://klaytn.foundation/verifying-contracts-using-hardhat-on-klaytnscope)


Loading

0 comments on commit ada1951

Please sign in to comment.