agentleFS
celo-orgcelo-org/agent-skills/skills/contract-verification/SKILL.md

contract-verification

Skill8 starsChanged 2 months agoApache-2.0View on GitHub

Verify smart contracts on Celo. Use when publishing contract source code to Celoscan or Blockscout.

  • Reads credentials
  • Sends data out

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After deploying a contract to Celo

    line 16
  2. Distinctive:

    Add constructor arguments (ABI-encoded)

    line 210
  3. Distinctive:

    Search for your contract address

    line 228
  4. Distinctive:

    Search for "Sourcify" and activate it

    line 290
  5. Distinctive:

    Verify contracts directly from Remix IDE using the Etherscan plugin.

    line 310
  6. Distinctive:

    Verify constructor args are ABI-encoded correctly

    line 351
  7. Distinctive:

    Wait a few minutes for indexing

    line 365

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Contract Verification on Celo

This skill covers verifying smart contracts on Celo block explorers, making source code publicly readable.

When to Use

  • After deploying a contract to Celo
  • Publishing open-source contracts
  • Enabling contract interaction via explorer UI
  • Building trust with users

Verification Methods

MethodBest For
HardhatAutomated deployment workflows
FoundryFoundry-based projects
Celoscan UIQuick manual verification
Blockscout UIAlternative explorer UI
Blockscout APIProgrammatic verification
SourcifyDecentralized verification
RemixBrowser-based verification

Hardhat Verification

Configuration

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",
        },
      },
    ],
  },
};

Environment Variables

# .env
PRIVATE_KEY=0xYOUR_PRIVATE_KEY
ETHERSCAN_API_KEY=your_celoscan_api_key

Get an API key from Etherscan or Celoscan.

Verify Commands

Mainnet:

npx hardhat verify --network celo <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS>

Testnet:

npx hardhat verify --network celoSepolia <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS>

Example with Constructor Arguments

# Contract with constructor: constructor(string memory name, uint256 value)
npx hardhat verify --network celo 0x1234...5678 "MyToken" 1000000

Complex Constructor Arguments

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

Foundry Verification

Source: https://docs.celo.org/developer/verify/foundry

Configuration

# 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"

Environment Setup

export ETHERSCAN_API_KEY=<your_etherscan_api_key>

Verify Commands

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

With Constructor Arguments

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

Deploy and Verify in One Command

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

Celoscan UI Verification

  1. Go to your contract on Celoscan
  2. Click the Contract tab
  3. Click Verify & Publish
  4. Select compiler settings:
    • Compiler Type (Solidity Single/Multi-file)
    • Compiler Version
    • License Type
  5. Paste your source code
  6. Add constructor arguments (ABI-encoded)
  7. Complete CAPTCHA
  8. Click Verify and Publish

Blockscout Verification

Celo has a Blockscout explorer at celo.blockscout.com that supports contract verification.

Blockscout URLs

UI Verification

  1. Go to celo.blockscout.com (or celo-sepolia.blockscout.com for testnet)
  2. Search for your contract address
  3. Click Code tab
  4. Click Verify & Publish
  5. Select verification method:
    • Via flattened source code - Single file with all imports inlined
    • Via standard input JSON - Compiler standard JSON input
    • Via Sourcify - Decentralized verification
  6. Fill in compiler settings (version, optimization, EVM version)
  7. Submit verification

API Verification

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:

  • Flattened: POST /api/v2/smart-contracts/{address}/verification/via/flattened-code
  • Standard JSON: POST /api/v2/smart-contracts/{address}/verification/via/standard-input
  • Multi-part: POST /api/v2/smart-contracts/{address}/verification/via/multi-part
  • Sourcify: POST /api/v2/smart-contracts/{address}/verification/via/sourcify

Source: https://docs.blockscout.com/devs/verification

Sourcify Verification

Sourcify provides decentralized contract verification that works across multiple explorers.

Source: https://docs.celo.org/developer/verify/remix

Benefits

  • Decentralized storage of verified source code
  • Works with Blockscout and other explorers
  • Metadata hash verification ensures exact source match

Using Remix Sourcify Plugin

  1. Open Remix IDE
  2. Go to Plugin Manager (plug icon)
  3. Search for "Sourcify" and activate it
  4. Deploy your contract to Celo
  5. In the Sourcify plugin:
    • Select the deployed contract
    • Choose the network (Celo Mainnet: 42220, Sepolia: 11142220)
    • Click Verify
  6. Contract will be verified on Sourcify and visible in Blockscout

Programmatic Sourcify Verification

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"

Remix Verification

Verify contracts directly from Remix IDE using the Etherscan plugin.

Source: https://docs.celo.org/developer/verify/remix

Setup

  1. Open Remix IDE
  2. Go to Plugin Manager
  3. Activate Etherscan - Contract Verification plugin

Verification Steps

  1. Deploy your contract to Celo via Remix
  2. Open the Etherscan plugin (checkmark icon)
  3. Enter your Celoscan API key
  4. Select the contract to verify
  5. Choose network:
    • Celo Mainnet (Chain ID: 42220)
    • Celo Sepolia (Chain ID: 11142220)
  6. Click Verify

Configuration for Celo

In Remix settings, add custom network:

Troubleshooting

"Unable to verify"

Causes:

  • Compiler version mismatch
  • Optimizer settings mismatch
  • Wrong constructor arguments

Solutions:

  • Match exact compiler version used in deployment
  • Match optimizer settings (enabled, runs)
  • Verify constructor args are ABI-encoded correctly

"Already verified"

Contract is already verified. Check the explorer to see the source code.

"Contract not found"

Causes:

  • Wrong contract address
  • Contract not yet indexed

Solutions:

  • Double-check the address
  • Wait a few minutes for indexing

Proxy Contracts

For proxy contracts, verify both:

  1. The implementation contract
  2. The proxy contract

Then link them on Celoscan:

  1. Go to proxy contract
  2. Click "More Options"
  3. Select "Is this a proxy?"
  4. Follow verification steps

API Endpoints

Dependencies

For Hardhat:

{
  "devDependencies": {
    "@nomicfoundation/hardhat-verify": "^2.0.0",
    "hardhat": "^2.19.0"
  }
}

Additional Resources

  • verification-config.md - Complete configuration examples

Source of truth: Celopedia

These skills are focused, task-level references. For anything broader — verified contract addresses, ecosystem and protocol data, listing requirements, grants, governance, migration guides, or cross-cutting Celo questions — Celopedia is the canonical source and is kept current. Where this skill and Celopedia disagree, Celopedia wins.

npx skills add celo-org/celopedia-skills

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.