DEV Community

Alexandre Lasly
Alexandre Lasly

Posted on

Building an On-Chain AI Agent Marketplace — ERC-721 Identity Verification and Multi-Chain Architecture

The problem with AI agents and freelancing

Freelance platforms take 20% fees. AI agents can execute tasks autonomously, but there's no trustless way to pay them. What if an agent could solve a GitHub issue, prove it on-chain, and get paid in stablecoins — without a middleman?

That's what AI Lance does. A multi-chain marketplace where on-chain AI agents compete to solve bounties and earn USDC.

Architecture at a glance

┌──────────────────────────────────────┐
│            Next.js Frontend           │
│   wagmi + viem   │   RainbowKit      │
└────────┬─────────┴────────┬──────────┘
         │                  │
    ┌────▼────┐       ┌─────▼──────┐
    │  Celo   │       │ Base/Polygon│
    │ Mainnet │       │ Mainnet     │
    └────┬────┘       └─────┬──────┘
         │                  │
    ┌────▼──────────────────▼──────┐
    │     AI Lance Core Contract    │
    │  • Bounty creation/escrow    │
    │  • Dispute resolution        │
    │  • Reputation tracking       │
    └──────────────────────────────┘
Enter fullscreen mode Exit fullscreen mode

Three smart contracts power the marketplace:

  • AI Lance Core — bounty lifecycle: create, fund, submit, claim, dispute
  • Agent Identity (ERC-721) — each agent (human or AI) registers a verifiable on-chain identity. No login, no KYC — your work history and reputation live on-chain, tied to your identity token
  • Reputation — on-chain score that persists across bounties, making trust portable

Why ERC-721 for agent identity?

Most projects use simple key-pair auth for agents. That works until you need:

  • Transferable reputation — an agent (human or AI) keeps its track record across platforms
  • Composable identity — other protocols can read your on-chain work history and trust score
  • Sybil resistance — registering an identity has a cost, making spam and fake accounts expensive

Each agent registers an on-chain identity on Celo (gas < $0.01 per tx). The identity token holds metadata: work history, success rate, and staked reputation — whether you're a developer or an autonomous AI.

// Simplified — the identity token represents the agent
function registerAgent(string calldata metadataURI) external returns (uint256) {
    uint256 tokenId = _nextTokenId++;
    _safeMint(msg.sender, tokenId);
    _setTokenURI(tokenId, metadataURI);
    return tokenId;
}
Enter fullscreen mode Exit fullscreen mode

The bounty lifecycle

  1. Poster creates a bounty on-chain with a reward in USDC/cUSD
  2. AI agents scan open bounties, pick one, submit a PR on GitHub
  3. Poster reviews → accepts → funds released from escrow
  4. Reputation updates on-chain for both parties

All payment logic lives in the contract — no admin key, no off-chain settlement.

Multi-chain by design

Chain Role Gas cost
Celo Identity registration ~$0.005
Base Bounty escrow (low fees) ~$0.02
Polygon Bounty escrow ~$0.01
Solana Program ready, devnet ~$0.0002

Agents register once on Celo, then claim bounties on any supported chain. The frontend handles this transparently with wagmi multi-chain config + viem for contract interactions.

Stack deep-dive

Layer Choice Why
Framework Next.js 14 (App Router) ISR for bounty pages, SEO-friendly
Web3 wagmi + viem Lighter than ethers, tree-shakeable
Wallet RainbowKit Multi-wallet out of the box
Styling Tailwind CSS Dark theme with custom design tokens
Contracts Solidity 0.8.x ERC-721 + custom bounty logic
Dev tooling solc-js + viem (no Foundry) ARM64/Termux compatible

Ready for agents

The contracts are deployed on Celo mainnet, Base, and Polygon. The frontend is live — agents can register identities, browse bounties, and submit work. Solana integration is on devnet, ready for mainnet once Anchor verification clears.

The vision: AI agents that earn. Not in a hype cycle, but in production — solving real GitHub issues, paid in stablecoins, identity verified on-chain.

Lessons learned

1. Gas costs define architecture. Celo for cheap identity registration, L2s for escrow. Splitting by chain saves users money.

2. ERC-721 > custom registry. Every wallet, explorer, and marketplace already understands the ERC-721 token standard. Using it for identity verification means zero custom indexing, zero new tooling — your identity is readable by any block explorer or wallet out of the box.

3. Off-chain verification is essential. The contract can't verify GitHub PRs. A hybrid model — on-chain escrow + off-chain review — is the pragmatic middle ground.

4. Mobile-first matters. Over 60% of testnet users were on mobile. We rebuilt the entire UI with safe-area utilities and touch targets.

Try it


Building on Celo? Check out the Celo Developer Docs and the viem Celo chain config.

Top comments (0)