Contract Verification on JuChain using the Hardhat framework
1. Environment Setup
1.1 Core Plugin: @nomicfoundation/hardhat-verify
@nomicfoundation/hardhat-verifynpm install --save-dev @nomicfoundation/hardhat-verify
# or
yarn add --dev @nomicfoundation/hardhat-verify1.2 hardhat.config.js Configuration Details
hardhat.config.js Configuration Detailsrequire("@nomicfoundation/hardhat-verify");// .env file example: PRIVATE_KEY=0x...
// Use dotenv to load environment variables like private keys
require("dotenv").config();
// ... other require statements ...
networks: {
JuChainTestnet: {
url: "https://testnet-rpc.juchain.org",
chainId: 202599,
// Strongly recommended to load private keys from environment variables, avoid hardcoding
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
},
JuChain: {
url: "https://rpc.juchain.org",
chainId: 210000,
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : [],
},
// ... other networks like mainnet, sepolia, etc.
},2. Contract Deployment (Prerequisite)
3. Executing the Verification Command
3.1 Verifying Example ContractA
ContractA3.2 Verifying Example ContractB
ContractB3.3 Checking the Result
4. Common Issues and Troubleshooting
4.1 Constructor Arguments Mismatch
4.2 Network Configuration Error
4.3 Incorrect Contract Address or Name
4.4 Compiler or Optimizer Settings Mismatch
4.5 Proxy Contracts
4.6 Verification Service Delay or Temporary Outage
5. Manual Verification (Optional)
Last updated