The Payment Layer for AI Agents
AgentPay is an MCP (Model Context Protocol) server that gives AI agents a financial API. Install it and your agent can send USDC payments, stream micropayments through state channels, and settle across chains—all gas-free.
Built for HackMoney 2026 (ETHGlobal DeFi Hackathon, Jan 30 — Feb 11, 2026).
AI agents are doing real work: writing code, analyzing data, calling APIs. But they can't pay for anything. When an agent needs a paid service, a human must step in. That breaks the autonomous flow.
AgentPay gives agents money superpowers:
- Send USDC to any address or ENS name (gas-free via Circle Paymaster)
- Stream micropayments through state channels (250x cheaper than on-chain via Yellow Nitrolite)
- Check balance across 7 chains instantly (Circle Gateway)
- Agent identity via ENS (.eth names)
Flow: AI Agent → MCP Tools → AgentPay Server → Circle/Yellow/ENS → On-chain Settlement
AgentPay exposes 7 tools to AI agents:
Check USDC balance across all supported chains (unified via Circle Gateway).
Returns: Total USDC balance, breakdown by chain
Send USDC to an address or ENS name. Gas paid in USDC via Circle Paymaster.
Parameters:
to— Recipient address (0x...) or ENS name (vitalik.eth)amount— Amount in USDC (e.g., "10.50")chain— Target chain (default: base)
Returns: Transaction hash, gas payment method
Get the agent's wallet addresses (EOA and Smart Account).
Returns: EOA address, Smart Account address
Open a state channel for instant micropayments. Off-chain, gas-free after opening.
Parameters:
counterparty— Address of counterparty (0x...)amount— Initial deposit in USDC (e.g., "5.00")
Returns: Channel session ID, deposit amount
Send an instant micropayment through an open channel. No gas, no on-chain transaction.
Parameters:
amount— Amount to send in USDC (e.g., "0.001")sessionId— Channel session ID (uses active channel if omitted)
Returns: New balance, counterparty balance, version
Close a state channel and settle on-chain. Final balances are paid out.
Parameters:
sessionId— Channel session ID (uses active channel if omitted)
Returns: Final allocations, settlement transaction
Look up an ENS name or address. Bidirectional resolution (name to address and address to name). Returns full ENS profile including text records and social accounts.
Parameters:
name— ENS name (e.g.vitalik.eth) or address (0x...)
Returns: Resolved address/name, avatar, description, URL, social records (Twitter, GitHub, Discord)
- MCP SDK —
@modelcontextprotocol/sdk(TypeScript) - Yellow Nitrolite —
@erc7824/nitrolite(state channels, ERC-7824) - Circle Paymaster — Gas-free USDC transactions (ERC-4337)
- Circle Gateway — Unified USDC balance across 7 chains
- ENS —
.ethname resolution via viem - Chain — Base Sepolia (testnet)
- Node.js 18+
- npm or yarn
- Test USDC on Base Sepolia
git clone https://github.com/Cassxbt/Hackmoney2026.git
cd Hackmoney2026
npm installCreate .env file:
AGENT_PRIVATE_KEY=0x...
AGENT_ADDRESS=0x...
NETWORK=testnetGet test USDC:
- Visit Circle Faucet (Base Sepolia)
- Enter your
AGENT_ADDRESS - Receive test USDC
npm run buildnpm startThe MCP server will start on stdio transport, ready for AI agents to connect.
-
Install Claude Desktop
-
Add AgentPay to your MCP config (
~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"agentpay": {
"command": "node",
"args": ["/path/to/agentpay/dist/index.js"]
}
}
}-
Restart Claude Desktop
-
Test:
Check my USDC balance
Claude should call agentpay_balance and return your balance.
- Try a payment:
Send 1 USDC to vitalik.eth
Claude will resolve the ENS name and send via Paymaster.
- Open a channel:
Open a micropayment channel with 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb and deposit 5 USDC
Then stream payments:
Send 10 micropayments of 0.001 USDC each through the channel
Close when done:
Close the channel and settle on-chain
- 1000 micropayments × $0.25 gas = $250
- 1 channel open: $0.01
- 1000 off-chain micropayments: $0.00
- 1 channel close: $0.01
- Total: $0.02
250x cheaper.
The project includes a standalone web demo showing real-time micropayments between two wallets:
cd demo && npm install && npm run dev
# Open http://localhost:5173The demo walks through four steps:
- Generate Wallets — Two fresh wallets (agent + service provider)
- Fund via Faucet — Request testnet USDC from Yellow's faucet
- Connect to ClearNode — WebSocket auth + EIP-712 challenge-response
- Stream Micropayments — Click to send instant off-chain payments, watch balances update in real time
- Two wallets authenticating to Yellow Network's ClearNode via WebSocket
- A state channel opening between them with 1 USDC locked
- Micropayments of $0.01 streaming instantly — no on-chain transactions, no gas
- Real-time balance updates on both sides
- Full protocol logs visible in terminal panels
Yellow Network's Nitrolite protocol enables off-chain state channels for instant micropayments. Here's how we use it:
Authentication Flow:
- Generate wallet keypair + session key
- Connect to ClearNode WebSocket (
wss://clearnet.yellow.com/ws) - Send
auth_requestwith wallet address and session key - Receive
auth_challenge— an EIP-712 typed message - Sign challenge with
createEIP712AuthMessageSignerand sendauth_verify - ClearNode confirms authentication
State Channel Lifecycle:
- Open —
createAppSessionMessage()creates a channel between two participants with initial allocations (e.g., agent: 1 USDC, service: 0 USDC) - Update —
createSubmitAppStateMessage()sends signed state updates that rebalance allocations (e.g., agent: 0.99, service: 0.01). Each update increments the version number. No on-chain transactions. - Close — Final state is submitted on-chain for settlement
Key functions used: createAuthRequestMessage, createAuthVerifyMessageFromChallenge, createEIP712AuthMessageSigner, createECDSAMessageSigner, createAppSessionMessage, createSubmitAppStateMessage, createGetLedgerBalancesMessage
Code: src/lib/nitrolite.ts, src/tools/channel.ts, demo/src/Demo.tsx
Two Circle products working together to make agent payments gas-free and cross-chain:
Circle Gateway (Balance API):
- POST to
https://gateway-api-testnet.circle.com/v1/balances - Accepts array of
{ domain, depositor }sources for multi-chain lookup - Returns unified USDC balance across Base, Ethereum, Arbitrum, Optimism, Polygon, Avalanche (7 chains)
- Used by
agentpay_balancetool
Circle Paymaster (ERC-4337):
- Paymaster contract:
0x31BE08D380A21fc740883c0BC434FcFc88740b58on Base Sepolia - Creates a Circle Smart Account via
toCircleSmartAccount()(account abstraction) - Gas is paid in USDC using EIP-2612 permits — agent signs a permit allowing the paymaster to deduct USDC for gas
- Transactions sent as UserOperations through Pimlico bundler
- Agents never hold ETH, never manage gas nonces
Transaction flow: Agent calls agentpay_send → Paymaster signs permit for gas in USDC → Bundler submits UserOperation → USDC transfer executes on-chain → Gas deducted from agent's USDC balance
Code: src/lib/paymaster.ts, src/lib/balance.ts, src/lib/config.ts
ENS enables agents to use human-readable names instead of raw addresses:
Forward Resolution (name → address):
- Agent receives a payment request: "Send 0.01 USDC to vitalik.eth"
- AgentPay normalizes the ENS name using
normalize()fromviem/ens - Resolves to an Ethereum address via
getEnsAddress()on mainnet - Uses the resolved address for the USDC transfer
Reverse Resolution (address → name):
- Agent receives an address:
0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 agentpay_resolvecallsgetEnsName()to find the primary ENS name- Returns
vitalik.eth— making raw addresses human-readable
ENS Profile Lookups:
agentpay_resolvefetches full ENS profiles: avatar, description, URL, and social records (Twitter, GitHub, Discord)- Agents build a complete counterparty profile before transacting
- Social records enable identity verification across platforms
Why it matters for agents:
- Agents can reference other agents/services by name, not 42-character hex addresses
- Reverse resolution makes transaction logs and balance outputs readable
- Full profile lookups enable agent discovery and trust assessment before payment
- Social records cross-reference identity across Twitter, GitHub, Discord
- Any
.ethname resolves automatically with full metadata
Code: src/tools/send.ts (forward resolution in payments), src/tools/resolve.ts (dedicated ENS lookup tool)
- EOA:
0x66d71a8612Fbf6ab69340Bf82aB431e1Ad30b5c3 - Smart Account:
0xc3A8c8fe8430877317207fd5e50Fa0F458014D80 - Network: Base Sepolia (testnet)
- First Paymaster TX: 0xcd30ddbc...
MVP (HackMoney 2026):
- MCP server with 7 tools
- Circle Gateway integration (multi-chain balance)
- Circle Paymaster integration (gas-free USDC transfers)
- Yellow Nitrolite state channels (micropayments)
- ENS resolution (name-based payments)
- React demo (real-time micropayment streaming UI)
- Landing page
- Demo video
Post-Hackathon:
- Publish to npm as
@agentpay/mcp - Support more chains (Polygon, Arbitrum, Optimism)
- Agent registry via ENS subdomains
- Mainnet deployment
- WebSocket API for non-MCP clients
- Multi-agent payment routing
This project was built during HackMoney 2026. Contributions welcome after the hackathon ends (Feb 11, 2026).
This project was built with assistance from Claude Code (Anthropic's AI). AI was used for code generation and debugging assistance. Architecture decisions and testing were human-driven.
MIT License. See LICENSE for details.
- HackMoney 2026: https://ethglobal.com/events/hackmoney2026
- Yellow Network: https://yellow.org/
- Circle Developers: https://developers.circle.com/
- ENS: https://ens.domains/
- MCP Protocol: https://modelcontextprotocol.io/
Built with Yellow Nitrolite + Circle Gateway/Paymaster + ENS
"HTTP gave agents data. AgentPay gives them money."