@qelt/hardhat-verify
v1.0.12
Published
Hardhat plugin for verifying smart contracts on QELT blockchain
Maintainers
Readme
@qelt/hardhat-verify
Hardhat plugin for verifying smart contracts on QELT blockchain.
Features
- ✅ Seamless Hardhat integration - Works just like
@nomicfoundation/hardhat-verify - ✅ Auto-detection - Automatically detects contract from compiled artifacts
- ✅ Multi-file support - Handles complex projects with imports
- ✅ Constructor arguments - Simple encoding of constructor parameters
- ✅ Library linking - Supports contracts with external libraries
- ✅ Progress tracking - Real-time verification status with spinners
- ✅ Async verification - Queued verification for large contracts
Installation
npm install --save-dev @qelt/hardhat-verifyUsage
1. Import the plugin in your hardhat.config.ts:
import "@qelt/hardhat-verify";
const config: HardhatUserConfig = {
solidity: "0.8.20",
networks: {
qelt: {
url: "https://mainnet.qelt.ai",
chainId: 770,
accounts: [process.env.PRIVATE_KEY!]
},
"qelt-testnet": {
url: "https://testnet.qelt.ai",
chainId: 771,
accounts: [process.env.PRIVATE_KEY!]
}
},
// Optional: Configure QELT verification
qeltVerify: {
networks: {
qelt: {
apiUrl: "https://mnindexer.qelt.ai",
chainId: 770,
explorerUrl: "https://qeltscan.ai"
},
"qelt-testnet": {
apiUrl: "https://testnet-indexer.qelt.ai",
chainId: 771,
explorerUrl: "https://testnet.qeltscan.ai"
}
}
}
};
export default config;2. Verify your contract:
# After deploying your contract
npx hardhat verify --network qelt 0x1234567890123456789012345678901234567890Examples
Simple Contract (No Constructor Arguments)
npx hardhat verify --network qelt 0x123...With Constructor Arguments
npx hardhat verify --network qelt 0x123... "My Token" "MTK" 1000000Specify Contract Name (if multiple contracts)
npx hardhat verify --network qelt \
--contract contracts/MyToken.sol:MyToken \
0x123... "My Token" "MTK" 1000000With Libraries
npx hardhat verify --network qelt \
--libraries "SafeMath:0xabc...,OtherLib:0xdef..." \
0x123... "arg1" "arg2"With Fully Qualified Library Names
npx hardhat verify --network qelt \
--libraries "contracts/libs/Math.sol:SafeMath:0xabc..." \
0x123...Configuration
Default Configuration
If you don't provide a qeltVerify configuration, the plugin uses these defaults:
- Mainnet (
qelt): https://mnindexer.qelt.ai - Testnet (
qelt-testnet): https://testnet-indexer.qelt.ai
Custom API URL
You can override the API URL globally or per-network:
qeltVerify: {
// Global default
apiUrl: "https://custom-api.example.com",
// Network-specific (overrides global)
networks: {
qelt: {
apiUrl: "https://mainnet-api.example.com",
chainId: 770
}
}
}Programmatic Usage
You can also use the plugin programmatically in your deployment scripts:
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { QeltVerifyClient, HardhatArtifactParser } from "@qelt/hardhat-verify";
async function main(hre: HardhatRuntimeEnvironment) {
// Deploy contract
const MyContract = await hre.ethers.getContractFactory("MyContract");
const myContract = await MyContract.deploy("arg1", "arg2");
await myContract.deployed();
console.log(`Contract deployed to: ${myContract.address}`);
// Verify programmatically
const parser = new HardhatArtifactParser(hre.config.paths.root);
const request = await parser.createVerificationRequest(
"contracts/MyContract.sol:MyContract",
myContract.address,
"0x..." // encoded constructor args
);
const client = new QeltVerifyClient("https://mnindexer.qelt.ai");
const response = await client.submitVerification(request);
if (response.success) {
console.log("✅ Contract verified!");
}
}How It Works
- Artifact Parsing: Reads your compiled Hardhat artifacts and build info
- Request Generation: Creates a verification request with all compiler settings
- Submission: Sends the request to the QELT verification API
- Polling: Tracks verification status until completion
- Success: Displays explorer link once verified
Comparison with Etherscan Plugin
This plugin is designed as a drop-in replacement for @nomicfoundation/hardhat-verify:
| Feature | Etherscan Plugin | QELT Plugin |
|---------|-----------------|-------------|
| Command | verify | verify ✅ |
| Constructor args | ✅ | ✅ |
| Libraries | ✅ | ✅ |
| Multi-file | ✅ | ✅ |
| Auto-detection | ✅ | ✅ |
| Async queue | ❌ | ✅ |
| Progress tracking | Limited | Enhanced ✅ |
Troubleshooting
"No compiled contracts found"
Make sure to compile your contracts first:
npx hardhat compile"Multiple contracts found"
Specify which contract to verify using --contract:
npx hardhat verify --contract contracts/MyContract.sol:MyContract ..."Bytecode mismatch"
Ensure:
- You're using the exact same compiler version
- Optimization settings match what you used during deployment
- Constructor arguments are correct and properly encoded
- All libraries are deployed and addresses provided
Enable Debug Logging
Set the DEBUG environment variable:
DEBUG=* npx hardhat verify ...API Reference
Task Parameters
address(required): Contract address to verifyconstructorArgsParams(optional): Constructor arguments (variadic)--contract(optional): Fully qualified contract name--libraries(optional): Comma-separated library mappings
Configuration Type
interface QeltVerifyConfig {
apiUrl?: string;
networks?: {
[networkName: string]: {
apiUrl: string;
chainId: number;
explorerUrl?: string;
};
};
}License
MIT
Support
- Documentation: https://docs.qelt.ai
- Explorer: https://qeltscan.ai
- Issues: https://github.com/qelt-blockchain/hardhat-qelt-verify/issues
Related Packages
qelt-verify- Standalone CLI toolhardhat- Ethereum development environment
Made with ❤️ by the QELT Team
