用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/celo-org/agent-skills --skill contract-verification命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| 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: ,
},
},
],
},
};
# .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"
}
}