Every day, 3.4 billion email accounts receive 100+ billion messages they didn't ask for. Spam filters guess. Unsubscribe links lie. The real problem? Sending a message costs nothing, but reading it costs you.
BaseMail flips the model: senders stake money to reach you. Reply → they get it back. Ignore → you keep it. Built on Base with USDC escrow, powered by mechanism design from Quadratic Funding.
For humans, it's an inbox that pays you to read. For AI agents, it's a native email identity (agent@basemail.ai) with a 3-call API. For the attention economy, it's a new primitive: Attention Bonds.
"Basename is identity. BaseMail is Æmail — agentic email with humans in the loop."
basemail.ai · Contract · Paper: CO-QAF · ERC-8004 Compatible
Email is the oldest open protocol on the internet — and the most broken. Filters are heuristic. They can't measure intent. With billions of AI agents coming online, the flood is about to get 1000x worse.
Attention Bonds fix this at the protocol level:
| The Problem | The Fix |
|---|---|
| Sending is free → spam is rational | Senders stake USDC to reach you |
| No cost to waste someone's time | Bonds are forfeited if you're ignored |
| Legit senders treated like spammers | Bonds are refunded (minus 10% fee) on reply |
| Sybil attacks on attention | CO-QAF discounts correlated senders |
Spam becomes economically irrational. Genuine outreach becomes provably valuable.
Sender BaseMail Recipient
│ │ │
├── Approve USDC ─────────>│ │
├── Deposit Bond ─────────>│ (on-chain escrow) │
├── Send Email ───────────>│───── Email arrives ───────>│
│ │ │
│ │ Recipient replies? ────┤
│ │ │ │
│ ┌─────┴─────┐ │ │
│ │ YES │ │ NO (7 days) │
│ │ │ │ │
│<── Bond Refunded ──┤ -10% fee │ ├── Bond Forfeited │
│ (90% back) └───────────┘ │ (recipient keeps)
│ └──────────────────┘
- AttentionBondEscrow contract on Base Mainnet (verified source)
- USDC escrow with 7-day response window (configurable 1–30 days)
- Dynamic pricing:
p(t,s) = p₀ · (1 + α·D(t))^β · (1 - γ·R̄ₛ(t)) - Whitelist support — trusted senders skip bonding
- 10% protocol fee on refunds (configurable up to 20%)
BaseMail implements CO-QAF — a Sybil-resistant extension of Quadratic Funding for attention allocation:
- α_ij estimation: Jaccard similarity of recipient overlap between senders
- Sybil resistance: CO-QAF bounds the Sybil premium at
1/α(constant), vs. unbounded growth in standard QAF - Bridging capital amplified: Senders who connect otherwise-separate communities get full quadratic weight
- Bonding capital discounted: Correlated senders (same social circles) receive diminished matching
Reference: "Connection-Oriented Quadratic Attention Funding" — Ko, Tang, Weyl (2026)
┌─────────────┐ ┌──────────────────┐ ┌────────────┐
│ Frontend │────>│ Cloudflare │────>│ D1 (SQL) │
│ (Pages) │ │ Worker (Hono) │ │ R2 (MIME) │
│ React+Vite │ │ api.basemail.ai │ │ KV (nonce)│
└─────────────┘ └──────────────────┘ └────────────┘
│ │ │
wagmi/SIWE Hono REST API AttentionBondEscrow
Wallet Connect 11 attention (Base Mainnet)
Basename buy endpoints USDC escrow
| Component | Stack |
|---|---|
| Worker | Cloudflare Workers, Hono, viem |
| Frontend | React, Vite, Tailwind, wagmi |
| Database | Cloudflare D1 (SQLite) |
| Email Storage | Cloudflare R2 |
| Auth Nonces | Cloudflare KV |
| Inbound Email | Cloudflare Email Routing |
| Outbound Email | Resend.com API |
| Smart Contract | Solidity 0.8.34, OpenZeppelin, Base Mainnet |
| Token | USDC (Base) |
- SIWE Authentication — Sign-In with Ethereum, no passwords
- Agent-friendly API — 2 calls to register, 1 to send
- Basename Integration — Auto-detect, claim, or purchase Basenames on-chain
- Internal Email — Free, unlimited @basemail.ai ↔ @basemail.ai
- External Email — Via Resend.com, credit-based pricing
- Pre-storage — Emails to unregistered 0x addresses are held for 30 days
- Attention Bonds — USDC escrow for inbound emails, on-chain via
AttentionBondEscrow.sol - Dynamic Pricing — Attention price adjusts based on demand and response rate
- CO-QAF Scoring — Quadratic attention funding with Sybil resistance
- Compose Detection — Auto-detects if recipient has bonds enabled, shows deposit prompt
- 3-Step Deposit Flow — Approve USDC → Deposit to Escrow → Record bond via API
- Email Activity Stats — Dashboard shows received/sent/unique senders/reply rate
- Whitelist Management — Exempt trusted senders from bonding
AttentionBondEscrow.sol — Verified on BaseScan
// Core functions
function deposit(address recipient, bytes32 emailId, uint256 amount) external;
function reply(bytes32 emailId) external; // Recipient replies → refund sender
function forfeit(bytes32 emailId) external; // No reply after window → recipient keeps bond
// Configuration (per-user)
function setAttentionPrice(uint256 price) external;
function setWhitelist(address sender, bool status) external;
function setResponseWindow(uint256 window) external; // 1-30 days
// View
function getAttentionPrice(address recipient) public view returns (uint256);
function getBond(bytes32 emailId) external view returns (...);Parameters:
- USDC:
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913(Base) - Protocol fee: 10% (on refunds only)
- Min bond: 0.001 USDC
- Default price: 0.01 USDC
- Response window: 7 days (default)
# 1. Get SIWE message
curl -X POST https://api.basemail.ai/api/auth/start \
-H "Content-Type: application/json" \
-d '{"address":"YOUR_WALLET_ADDRESS"}'
# 2. Sign message + register (returns JWT token)
curl -X POST https://api.basemail.ai/api/auth/agent-register \
-H "Content-Type: application/json" \
-d '{"address":"...","signature":"0x...","message":"..."}'
# 3. Send email
curl -X POST https://api.basemail.ai/api/send \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"to":"someone@basemail.ai","subject":"Hello","body":"Hi!"}'| Method | Endpoint | Description |
|---|---|---|
| GET | /api/attention/config |
Get your attention bond config |
| PUT | /api/attention/config |
Enable/configure attention bonds |
| GET | /api/attention/price/:handle |
Get recipient's current attention price |
| POST | /api/attention/bond |
Record a bond (after on-chain deposit) |
| GET | /api/attention/bonds |
List your bonds (sent/received) |
| GET | /api/attention/stats |
QAF score, demand, response rate |
| GET | /api/attention/qaf |
CO-QAF scoring with α_ij matrix |
| POST | /api/attention/whitelist |
Add sender to whitelist |
| DELETE | /api/attention/whitelist/:address |
Remove from whitelist |
| GET | /api/attention/whitelist |
List whitelisted addresses |
| GET | /api/attention/leaderboard |
Top accounts by QAF score |
Full API docs: GET https://api.basemail.ai/api/docs
BaseMail/
├── worker/ # Cloudflare Worker (API)
│ ├── src/
│ │ ├── index.ts # Routes + API docs
│ │ ├── auth.ts # JWT + SIWE verification
│ │ ├── email-handler.ts # Inbound email processing
│ │ └── routes/
│ │ ├── attention.ts # Attention bond endpoints (11 routes)
│ │ ├── auth.ts # /api/auth/*
│ │ ├── register.ts # /api/register/* + Basename check
│ │ ├── send.ts # /api/send
│ │ ├── inbox.ts # /api/inbox/*
│ │ ├── identity.ts # /api/identity/*
│ │ └── credits.ts # /api/credits/*
│ └── wrangler.toml
├── web/ # Frontend (Cloudflare Pages)
│ ├── src/
│ │ ├── pages/
│ │ │ ├── Landing.tsx # Landing + Basename availability check
│ │ │ └── Dashboard.tsx # Email client + Attention Bonds UI
│ │ └── wagmi.ts # Wallet config (Base Mainnet)
│ └── vite.config.ts
├── contracts/ # Smart contracts
│ ├── contracts/
│ │ └── AttentionBondEscrow.sol # USDC escrow contract
│ └── hardhat.config.ts
└── skill/ # OpenClaw AI agent skill
└── handlers/
└── index.ts # Agent email integration
- Node.js 20+
- Cloudflare account (Workers, D1, R2, KV, Email Routing)
- Wrangler CLI
# Install dependencies (npm workspace — must run from root)
npm install
# Configure secrets (create worker/.dev.vars)
# JWT_SECRET=your-secret-here
# WALLET_PRIVATE_KEY=0x...
# RESEND_API_KEY=re_...
# Run worker locally
cd worker && npx wrangler dev
# Run frontend locally
cd web && npx vite dev# Deploy worker
cd worker && npx wrangler deploy
# Build + deploy frontend
cd web && npx vite build && npx wrangler pages deploy dist --project-name=basemail-webBaseMail implements ERC-8004 (Trustless Agents) — the emerging Ethereum standard for AI agent identity, reputation, and discovery.
How it maps:
| ERC-8004 Registry | BaseMail Implementation |
|---|---|
| Identity (ERC-721) | Basename NFT — every agent gets a portable, transferable on-chain identity |
| Reputation | CO-QAF score — quadratic attention funding measures sender diversity and trust |
| Validation | Attention Bonds — USDC escrow as stake-based proof of genuine intent |
| Discovery | Registration file at /api/agent/:handle/registration.json |
Endpoints:
# Agent registration file (ERC-8004 format)
GET https://api.basemail.ai/api/agent/cloudlobst3r/registration.json
# Platform discovery
GET https://api.basemail.ai/.well-known/agent-registration.jsonEvery BaseMail agent is automatically discoverable by any ERC-8004 compatible system. The registration file includes email endpoint, wallet, Basename, attention bond config, and CO-QAF reputation data.
- Quadratic Funding — Buterin, Hitzig, Weyl (2019)
- Plural Funding — Connection-Oriented Quadratic Funding
- Attention Markets — Loder & Van Alstyne (2006)
- Sender-Pays Email — Rao & Reiley (2012)
MIT