Hardhat is a full-featured development environment for contract compilation, deployment and verification. The Hardhat Etherscan plugin supports contract verification on kcc scan.
Get Started
1) Install Hardhat
If you are starting from scratch, create an npm project by going to an empty folder, running npm init, and following the instructions. Recommend npm 7 or higher.
Once your project is ready:
npm instructions
npm install --save-dev hardhat
yarn instructions
yarn add --dev hardhat
pnpm instructions
pnpm add -D hardhat
2) Create a project
Run npx hardhat in your project folder and follow the instructions to create (more info here).
Your basic Hardhat config file (hardhat.config.js or hardhat.config.ts) will be setup to support the network you are working on. In this example we use the kcc test network and a .js file.
You can add a customChains object to the config file. It includes:
chainID - Network chain ID
apiURL - Block explorer API URL
browserURL - Block explorer URL
Deploy and Verify
Deploy
Verify
You can include constructor arguments with the verify task.
KCC Testnet example (has constructors).
Note the verify task will not be listed in the available tasks lists at npx hardhat --config but should work as expected.
If not, check you have the minimum required version of the nomiclabs-hardhat-etherscan plugin (v3.0.0+) installed
Confirm Verification on KCC Scan
Go to KCC Scan instance and paste the contract address into the search bar. If verified, the code tab will display a green checkmark.
Selecting the Code tab will provide additional information about your contract.
D:\hardhat>npx hardhat verify --network kt 0x3F0A49981D3204A8E7bD7871aDEFBC6379A05410 "0x0576a174D229E3cFA37253523E645A78A0C91B57,0xae3DB39196012a7bF6D38737192F260cdFE1E7Ec"
Nothing to compile
Compiling 1 file with 0.8.0
Successfully submitted source code for contract
contracts/KCCPaymaster.sol:KCCPaymaster at 0x3F0A49981D3204A8E7bD7871aDEFBC6379A05410
for verification on the block explorer. Waiting for verification result...
Successfully verified contract KCCPaymaster on Etherscan.
https://scan-testnet.kcc.network/address/0x3F0A49981D3204A8E7bD7871aDEFBC6379A05410#code