Verify Contracts
Method 1. Hardhat Verification (Recommended)
npm install --save-dev @nomicfoundation/hardhat-toolboxrequire("@nomicfoundation/hardhat-toolbox");
module.exports = {
solidity: "0.8.26",
networks: {
sonic: {
url: "https://rpc.soniclabs.com",
chainId: 146,
accounts: [SONIC_PRIVATE_KEY]
},
sonicTestnet: {
url: "https://rpc.testnet.soniclabs.com",
chainId: 57054,
accounts: [SONIC_PRIVATE_KEY]
}
},
etherscan: {
apiKey: {
sonic: "YOUR_SONICSCAN_API_KEY",
sonicTestnet: "YOUR_SONICSCAN_TESTNET_API_KEY"
},
customChains: [
{
network: "sonic",
chainId: 146,
urls: {
apiURL: "https://api.sonicscan.org/api",
browserURL: "https://sonicscan.org"
}
},
{
network: "sonicTestnet",
chainId: 57054,
urls: {
apiURL: "https://api-testnet.sonicscan.org/api",
browserURL: "https://testnet.sonicscan.org"
}
}
]
}
};Method 2: Programmatic Verification
Method 3: Manual Verification
Method 4: Flattened Source
Troubleshooting
Last updated

