afx402 Features
A complete platform for autonomous agent payments. Software as the primary user. No wallets, no checkout pages—just programmable settlement.
On-Chain Settlement
EIP-712 flash payments with escrow-based settlement on Monad.
Deploy the X402Settlement.sol contract to Monad Testnet. Supports escrow deposits, batch settlement, and automatic fee distribution.
// Open escrow with MON
contract.openEscrow{ value: 0.1 ether }();
// Settle signed promise
contract.settlePayment(payer, agentId, amount, nonce, expiresAt, signature);AI-Powered Agents
Real LLM integration via Google Gemini for intelligent tasks.
12 agents including 6 AI-powered (Research, Summarizer, Code Reviewer, Translator, Sentiment, Data Extractor) and 6 utility agents. Each charges per-call via x402.
// Execute AI research agent
const result = await fetch("/api/agents/execute", {
method: "POST",
body: JSON.stringify({ agent_id: "research", input: "Explain x402 protocol" })
});Agent-to-Agent Payments
Agents autonomously pay other agents with no human intervention.
Each agent has a virtual wallet. Agent A can call Agent B and pay automatically. Supports daily budgets and auto-topup from owner's balance.
// Agent calling another agent
const result = await agentCallAgent(db, {
callerAgentId: "research",
targetAgentId: "summarizer",
input: { text: longDocument }
});Self-Healing Escrow
Automatic balance top-up when agent funds drop below threshold.
Configure autoTopupThreshold and autoTopupAmount per agent. When balance is low, funds are automatically transferred from the owner's prepaid balance.
// Auto-topup triggers when balance < threshold
const result = await autoTopupIfNeeded(db, agentId);
// result: { topped_up: true, amount: 500000000000000n }Circuit Breaker & Failover
Automatic agent failover when primary service fails.
Implements circuit breaker pattern: closed → open → half-open. When an agent fails repeatedly, traffic routes to backup agents automatically.
// Execute with automatic failover
const result = await executeWithFailover("research", async (agentId) => {
return runBuiltinAgent(agentId, input);
});
// result.wasFailover tells if backup was usedStreaming Responses (SSE)
Real-time token streaming for AI agents via Server-Sent Events.
AI agents stream responses token-by-token. Perfect for chat interfaces and long-running tasks. Uses standard SSE protocol.
// Stream AI response
const es = new EventSource("/api/agents/stream?agent=research&input=...");
es.addEventListener("chunk", (e) => {
appendToOutput(JSON.parse(e.data).content);
});Live Mission Control
Real-time dashboard showing payment flows and agent activity.
SSE-powered dashboard with live stats: calls/24h, volume, active agents, pending settlements. Events stream in real-time.
// Connect to live dashboard
const es = new EventSource("/api/dashboard/stream");
es.addEventListener("stats_update", (e) => updateStats(JSON.parse(e.data)));
es.addEventListener("payment", (e) => addPaymentEvent(JSON.parse(e.data)));Autonomous Spend Policies
Machine-controlled budgets enforced before every payment.
Set daily_cap_wei and allow_agent_ids per wallet. Policies are checked before any payment executes. Humans set constraints, machines execute.
// Set spend policy
await fetch("/api/policy/set", {
method: "POST",
body: JSON.stringify({
daily_cap_wei: "1000000000000000000", // 1 MON/day
allow_agent_ids: ["research", "summarizer"]
})
});Monad Testnet Configuration
Network Details
Useful Links
Canonical Contracts
Wrapped MON
0xFb8b...C541
Multicall3
0xcA11...CA11
Permit2
0x0000...8ba3
Quick Start for Developers
2. Fund Prepaid Balance
Use our dev faucet to credit your prepaid balance for testing agents.
Go to Settings →# Install SDK and call an agent
npm install afx402-sdk
# Execute a paid agent call
curl -X POST https://your-app.vercel.app/api/agents/execute \
-d '{"agent_id": "research", "input": "Explain x402", "wallet": "0x..."}'
On-Chain Verification (Proof of Deployment)
Our X402Settlement contract is live on Monad Testnet. All flash payments, escrow operations, and settlements are verifiable on-chain.
Settlement Contract Address
0xd8a82b54b29ec35890976bf8db6b41a8fabb4ca4↗Network
Monad Testnet (Chain ID: 10143)
View on Explorer
Open in MonadVision Explorer →Contract Features (Deployed)
- EIP-712 Flash Payment Signatures
- Escrow Management (Open, Top-up, Close)
- Batch Settlement (Gas Optimized)
- Agent Registration & Earnings Withdrawal
- 1% Platform Fee Distribution
- Nonce Replay Protection
💡 For Judges: Click the explorer link above to verify the contract deployment, view transactions, and confirm on-chain activity.
# Contract Source Location
contracts/X402Settlement.sol
# Deployment Script
node scripts/deploy-settlement.mjs
# Settlement Integration
lib/chain/settlement.ts
Built for the x402 & Agent Economy Hackathon · January 2026
Powered by Monad · x402 Protocol · Gemini AI