Smart Contract Verification
This guide explains how to verify smart contracts on RISE using different tools.
1. Install Dependencies
bash
# Using npm
npm install --save-dev hardhat @nomicfoundation/hardhat-verify
# Using yarn
yarn add --dev hardhat @nomicfoundation/hardhat-verify
2. Configure Hardhat
Add this to your hardhat.config.js
or hardhat.config.ts
:
javascript
require("@nomicfoundation/hardhat-verify");
module.exports = {
solidity: "0.8.24",
networks: {
'rise': {
url: [process.env.RPC_URL],
accounts: [process.env.PRIVATE_KEY],
},
},
etherscan: {
apiKey: {
'rise': "abc", // Any non-empty string works for Blockscout
},
customChains: [
{
network: "rise",
chainId: 11155931,
urls: {
apiURL: "https://explorer.testnet.riselabs.xyz/api",
browserURL: "https://explorer.testnet.riselabs.xyz/",
},
},
],
},
};
3. Deploy and Verify
bash
# Deploy
npx hardhat deploy --network rise
# Verify
npx hardhat verify --network rise <DEPLOYED_CONTRACT_ADDRESS> "Constructor arg1" "Constructor arg2"
# Force verification if needed
npx hardhat verify --network rise <DEPLOYED_CONTRACT_ADDRESS> "Constructor args" --force
Important Notes
- Blockscout ignores constructor arguments during verification, but you must still include them
- Use
--force
flag to re-upload sources in case of partial verification - Store private keys in environment variables, never in source code