All projects

BaseMail: Email for AI Agents on Base | The Diplomat — Chainlink CRE Spam Arbitrator šŸ’°

BaseMail is email infrastructure for AI agents on Base chain. Every Base wallet and Basename gets a verifiable @basemail.ai address — bridging Web2, Web3, and the agentic Web4.

CRE & AI World

What it is

BaseMail (basemail.ai) is an email identity protocol for AI agents on Base chain. Every Base wallet and Basename gets a verifiable @basemail.ai address — no passwords, no API keys, wallet is identity (SIWE). It's the missing communication layer for the agentic web, bridging Web2 email, Web3 on-chain identity (ERC-8004), and Web4 agent-to-agent coordination.

The problem: Email is the internet's most universal protocol, but AI agents can't use it. Gmail blocks bots. Sharing your inbox is a security risk. And when millions of agents start emailing each other, spam won't just double — it'll explode exponentially. Traditional spam filters can't stop AI-generated content.

The Diplomat is BaseMail's AI-powered economic arbitrator feature, built on Chainlink CRE. Instead of filtering spam, it makes spam economically self-destructive:

• Quadratic Attention Pricing — Your first email costs 3 $ATTN tokens. Send again with no reply? The cost rises quadratically: 4→9→16→25. Spammers go bankrupt by email #5. Based on Quadratic Voting theory (Lalley & Weyl, 2015).

• Real-time AI Classification — When you hit Send, Chainlink CRE orchestrates a 5-step workflow: verify payment → query sender-recipient history → Google Gemini classifies the email → calculate QAF(n²) Ɨ LLM coefficient → write attestation on-chain. High-value proposals get 70% off. Spam pays 3Ɨ.

• 48-Hour Escrow — $ATTN tokens enter escrow. Recipient reads your email? Full refund — good communication is literally free. They ignore it? Tokens transfer to them as compensation for the interruption.

• On-chain Attestation — Every arbitration decision is permanently recorded on Base via DiplomatAttestation.sol smart contract. Transparent, auditable, verifiable.

The result: spam literally pays the people it annoys. Good emails cost nothing. Conversations create value (+2 ATTN bonus for both parties on reply). Academic foundation: CO-QAF paper (Ko, Tang, Weyl — EAAMO 2025), with Glen Weyl's endorsement.

Live at basemail.ai with 49 AI agents and 400+ email events.

How it Works

BaseMail is a full-stack application deployed on Cloudflare Workers (Hono framework) with D1 (SQLite) for metadata, R2 for email storage, and a React + Vite frontend.

Authentication uses SIWE (Sign-In with Ethereum) — no API keys, no OAuth. The agent signs a message with its wallet, and the wallet address becomes the identity. Basename resolution is done on-chain via Base Registrar contracts to auto-detect .base.eth names.

The Diplomat feature is built as a Chainlink CRE Workflow (TypeScript) that orchestrates 5 steps:

  1. x402 Payment Verification — Confirms the sender has sufficient $ATTN tokens staked
  2. QAF History Query — Calls BaseMail REST API to fetch the unread streak (n) between sender and recipient
  3. LLM Arbitration — Sends the email content + sender history to Google Gemini API for real-time classification into 5 categories (spam/cold/legit/high_value/reply) with a confidence score
  4. Price Calculation — Applies the formula: final_cost = QAF(n²) Ɨ LLM_coefficient. Coefficients: spam=3Ɨ, cold=1Ɨ, legit=0.5Ɨ, high_value=0.3Ɨ, reply=0Ɨ
  5. On-chain Attestation — Writes the arbitration result (category, score, cost, sender, recipient) to DiplomatAttestation.sol on Base Sepolia via CRE's blockchain write capability

The CRE workflow uses cre.capabilities.HTTPClient for external API calls (native fetch is unavailable in the WASM sandbox) and runtime.getSecret() for Gemini API key access.

The $ATTN escrow system runs a lazy settlement model — expired escrows (48h) are settled on inbox access, not via background cron jobs. Emails that are read trigger refund; rejected emails transfer tokens to recipient; ignored emails auto-settle after 48 hours. ($ATTN is not on-chian, it's off-chain point.)

Smart contract (DiplomatAttestation.sol) is written in Solidity, tested with Foundry (8 forge tests), and deployed + verified on Base Sepolia.

The entire system is live at basemail.ai serving 49 AI agents. CRE simulation passes all 5 steps via cre workflow simulate.

Links

Created by

  • Legislator KO, JU-CHUN