Autonomous DeFi raffle protocol on Celo, operated entirely by a verified AI agent.
Live: celottery.vercel.app
Contract (V3): 0x8a5859aB584f9b6F64769550862c58B9C5761C25
Agent Identity: ERC-8004 #34 | SelfClaw
An AI agent creates raffles, sells tickets, draws winners with verifiable randomness, and splits fees — no human operator in the loop. Every action is on-chain, every draw is provably fair.
- Stablecoins: USDT, USDC, USDm on Celo
- Randomness: Aleph Cloud VRF — cryptographic proof stored on-chain
- Treasury: 2-of-2 Safe multisig (
0xaDA1...) - Fees: 95% winner / 3% platform / 2% organizer
- Payments: x402 HTTP-native micropayments for ticket purchases
- Organizers stake in the same token as the raffle — skin in the game
- Once tickets are sold, the organizer cannot cancel the raffle
- Per-token decimal handling (6 dec for USDT/USDC, 18 dec for USDm)
The agent operating Celottery is verified via:
- SelfClaw — passport-based ZK proof of human backing (Self.xyz)
- ERC-8004 — on-chain identity NFT (Token #34 on Celo)
- Ed25519 keypair — cryptographic agent identity
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Frontend │────▶│ x402 API │────▶│ Contract │
│ (Next.js) │ │ (Agent) │ │ (Solidity) │
└─────────────┘ └──────┬───────┘ └──────┬──────┘
│ │
┌──────▼───────┐ ┌──────▼──────┐
│ Aleph VRF │ │ Safe │
│ (Randomness)│ │ (Treasury) │
└──────────────┘ └─────────────┘
Built with Scaffold-ETH 2 — Next.js, Hardhat, wagmi, viem.
# Install
git clone https://github.com/clementfrmd/celottery
cd celottery
yarn install
# Local dev
yarn chain # Start local network
yarn deploy # Deploy contracts
yarn start # Start frontend at localhost:3000The draw uses Aleph Cloud VRF for verifiable randomness:
- Agent requests random number from Aleph VRF executor
- Aleph returns random number + cryptographic proof
- Agent calls
drawWinner(raffleId, randomNumber, vrfHash)on-chain - VRF proof hash stored on-chain for auditability
# TypeScript
npx ts-node scripts/draw-winner.ts <raffleId>
# Python
python scripts/draw_winner.py <raffleId>If Aleph is unreachable, scripts fall back to local randomness (not verifiable — for testing only).
| Contract | Address | Network |
|---|---|---|
| AgentRaffleV3 | 0x8a5859aB584f9b6F64769550862c58B9C5761C25 |
Celo Mainnet |
| Treasury (Safe) | 0xaDA1E751F2BB9b245Ca59a381f92394591233D71 |
Celo Mainnet |
| Variable | Description |
|---|---|
__RUNTIME_DEPLOYER_PRIVATE_KEY |
Agent wallet private key |
CELO_RPC_URL |
RPC endpoint (default: forno.celo.org) |
$CLWDBRG — the agent's native token on Celo.
- Token:
0xC7ED254128840fc3EA461FAEBaA2D9F08c54b59D - Supply: 1,000,000
- Pool: CLWDBRG/SELFCLAW on Uniswap V4
MIT