원클릭으로
contract-verification
// Verify smart contracts on Celo. Use when publishing contract source code to Celoscan or Blockscout.
// Verify smart contracts on Celo. Use when publishing contract source code to Celoscan or Blockscout.
| name | contract-verification |
| description | Verify smart contracts on Celo. Use when publishing contract source code to Celoscan or Blockscout. |
| license | Apache-2.0 |
| metadata | {"author":"celo-org","version":"1.0.0"} |
This skill covers verifying smart contracts on Celo block explorers, making source code publicly readable.
| Method | Best For |
|---|---|
| Hardhat | Automated deployment workflows |
| Foundry | Foundry-based projects |
| Celoscan UI | Quick manual verification |
| Blockscout UI | Alternative explorer UI |
| Blockscout API | Programmatic verification |
| Sourcify | Decentralized verification |
| Remix | Browser-based verification |
Source: https://docs.celo.org/developer/verify/hardhat
// hardhat.config.js
require("dotenv").config();
require("@nomicfoundation/hardhat-verify");
module.exports = {
solidity: "0.8.28",
networks: {
celo: {
url: "https://forno.celo.org",
accounts: [process.env.PRIVATE_KEY],
chainId: 42220,
},
celoSepolia: {
url: "https://forno.celo-sepolia.celo-testnet.org/",
accounts: [process.env.PRIVATE_KEY],
chainId: 11142220,
},
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
customChains: [
{
network: "celo",
chainId: 42220,
urls: {
apiURL: "https://api.etherscan.io/v2/api",
browserURL: "https://celoscan.io/",
},
},
{
network: "celoSepolia",
chainId: 11142220,
urls: {
apiURL: "https://api.etherscan.io/v2/api",
browserURL: "https://sepolia.celoscan.io",
},
},
],
},
};
# .env
PRIVATE_KEY=0xYOUR_PRIVATE_KEY
ETHERSCAN_API_KEY=your_celoscan_api_key
Get an API key from Etherscan or Celoscan.
Mainnet:
npx hardhat verify --network celo <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS>
Testnet:
npx hardhat verify --network celoSepolia <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS>
# Contract with constructor: constructor(string memory name, uint256 value)
npx hardhat verify --network celo 0x1234...5678 "MyToken" 1000000
For complex arguments, create a file:
// arguments.js
module.exports = [
"MyToken",
"MTK",
1000000,
"0x1234567890123456789012345678901234567890",
];
npx hardhat verify --network celo 0x1234...5678 --constructor-args arguments.js
Source: https://docs.celo.org/developer/verify/foundry
# foundry.toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc_version = "0.8.28"
[rpc_endpoints]
celo = "https://forno.celo.org"
celoSepolia = "https://forno.celo-sepolia.celo-testnet.org"
export ETHERSCAN_API_KEY=<your_etherscan_api_key>
Mainnet (Chain ID 42220):
forge verify-contract \
--chain-id 42220 \
<CONTRACT_ADDRESS> \
src/MyContract.sol:MyContract \
--etherscan-api-key $ETHERSCAN_API_KEY \
--watch
Testnet (Chain ID 11142220):
forge verify-contract \
--chain-id 11142220 \
<CONTRACT_ADDRESS> \
src/MyContract.sol:MyContract \
--etherscan-api-key $ETHERSCAN_API_KEY \
--watch
forge verify-contract \
--chain-id 42220 \
--etherscan-api-key $ETHERSCAN_API_KEY \
<CONTRACT_ADDRESS> \
src/MyContract.sol:MyContract \
--constructor-args $(cast abi-encode "constructor(string,uint256)" "MyToken" 1000000) \
--watch
forge create \
--rpc-url https://forno.celo.org \
--private-key $PRIVATE_KEY \
--etherscan-api-key $ETHERSCAN_API_KEY \
--verify \
src/MyContract.sol:MyContract \
--constructor-args "MyToken" 1000000
Celo has a Blockscout explorer at celo.blockscout.com that supports contract verification.
| Network | Explorer URL | API Base |
|---|---|---|
| Mainnet | https://celo.blockscout.com | https://celo.blockscout.com/api/v2 |
| Sepolia | https://celo-sepolia.blockscout.com | https://celo-sepolia.blockscout.com/api/v2 |
Blockscout provides a REST API for programmatic verification.
Flattened Source Code:
curl -X POST "https://celo.blockscout.com/api/v2/smart-contracts/0xYOUR_ADDRESS/verification/via/flattened-code" \
-H "Content-Type: application/json" \
-d '{
"compiler_version": "v0.8.28+commit.7893614a",
"source_code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n...",
"is_optimization_enabled": true,
"optimization_runs": 200,
"contract_name": "MyContract",
"evm_version": "paris",
"license_type": "mit"
}'
Standard JSON Input:
curl -X POST "https://celo.blockscout.com/api/v2/smart-contracts/0xYOUR_ADDRESS/verification/via/standard-input" \
-F "compiler_version=v0.8.28+commit.7893614a" \
-F "contract_name=MyContract" \
-F "license_type=mit" \
-F "files[0]=@standard-input.json"
API Endpoints:
POST /api/v2/smart-contracts/{address}/verification/via/flattened-codePOST /api/v2/smart-contracts/{address}/verification/via/standard-inputPOST /api/v2/smart-contracts/{address}/verification/via/multi-partPOST /api/v2/smart-contracts/{address}/verification/via/sourcifySource: https://docs.blockscout.com/devs/verification
Sourcify provides decentralized contract verification that works across multiple explorers.
Source: https://docs.celo.org/developer/verify/remix
curl -X POST "https://sourcify.dev/server/verify" \
-F "address=0xYOUR_ADDRESS" \
-F "chain=42220" \
-F "files[0]=@MyContract.sol" \
-F "files[1]=@metadata.json"
Verify contracts directly from Remix IDE using the Etherscan plugin.
Source: https://docs.celo.org/developer/verify/remix
In Remix settings, add custom network:
Causes:
Solutions:
Contract is already verified. Check the explorer to see the source code.
Causes:
Solutions:
For proxy contracts, verify both:
Then link them on Celoscan:
| Network | API URL |
|---|---|
| Mainnet | https://api.celoscan.io/api |
| Sepolia | https://api-sepolia.celoscan.io/api |
For Hardhat:
{
"devDependencies": {
"@nomicfoundation/hardhat-verify": "^2.0.0",
"hardhat": "^2.19.0"
}
}
ERC-8004 Agent Trust Protocol for AI agent identity, reputation, and validation on Celo. Use when building AI agents that need identity registration, reputation tracking, or trust verification across organizational boundaries.
x402 HTTP-native payment protocol for AI agents on Celo. Use when implementing pay-per-use APIs, agent micropayments, or HTTP 402 Payment Required flows with stablecoins.
Integrate wallets into Celo dApps. Covers RainbowKit, Dynamic, and wallet connection patterns.
Pay gas fees with ERC-20 tokens on Celo. Covers supported tokens, implementation, and wallet compatibility.
Use viem for Celo development. Includes fee currency support, transaction signing, and Celo-specific configurations.
Use wagmi React hooks for Celo dApps. Includes wallet connection, transaction hooks, and React integration patterns.