Skip to content

pcdkd/fastpay

Repository files navigation

FastPay ⚑

Pull Payment Protocol for AI Agent Commerce on Base L2

Deployed on Base Hackathon License

🎯 Hackathon Track: Most Novel Smart Contract πŸš€ Status: βœ… Deployed & Tested on Base Sepolia πŸ“… Deadline: February 8, 2026 - 12 PM PST


🎯 The Problem

AI agents can't easily make payments in crypto.

Current crypto payment flow:

  • ❌ Customer must have ETH for gas fees
  • ❌ Customer constructs and broadcasts transaction
  • ❌ Customer monitors gas prices and manages nonces
  • ❌ Complex transaction building interface

Result: AI agents need operational overhead (ETH, gas monitoring, transaction construction) just to spend USDC.


πŸ’‘ The Solution

FastPay inverts the payment flow: Customer signs, merchant executes.

Traditional Crypto:           FastPay Pull Payments:
Customer β†’ Constructs TX      Customer β†’ Signs Message (gasless)
Customer β†’ Pays Gas          Merchant β†’ Broadcasts TX
Customer β†’ Broadcasts        Merchant β†’ Pays Gas
                             βœ… Customer needs ONLY USDC!

Key Innovation

  1. Customer Agent: Signs EIP-712 authorization (off-chain, gasless)
  2. Merchant Agent: Executes pull payment (on-chain, pays gas)
  3. Smart Contract: Verifies signature, transfers USDC

Perfect for autonomous agents: Simple signing interface, no ETH required, no gas monitoring.


πŸš€ Live Deployment

Deployed Contract

  • Address: 0xa6Dde921ef709471C61a52c0faAf47a97D59c35a
  • Network: Base Sepolia Testnet (Chain ID: 84532)
  • Status: βœ… Verified on Basescan
  • Explorer: View on Basescan

Live Demo Transaction

  • Transaction: View on Basescan
  • Amount: 0.50 USDC transferred
  • Gas Used: 137,691 gas (~$0.0006)
  • Customer Cost: $0.00 (gasless!)
  • Time: < 10 seconds

πŸ—οΈ Architecture

Three-Component System

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    FastPay Ecosystem                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                              β”‚
β”‚  1. Smart Contract (contracts/)                             β”‚
β”‚     β”œβ”€ FastPayCore.sol - Pull payment execution            β”‚
β”‚     β”œβ”€ EIP-712 signature verification                       β”‚
β”‚     β”œβ”€ Nonce-based replay protection                        β”‚
β”‚     └─ Gas optimized (~137k gas per payment)                β”‚
β”‚                                                              β”‚
β”‚  2. Agent SDK (agents/)                                     β”‚
β”‚     β”œβ”€ MerchantAgent - Creates & executes payments          β”‚
β”‚     β”œβ”€ CustomerAgent - Signs authorizations (gasless)       β”‚
β”‚     └─ Policy engine for autonomous approval                β”‚
β”‚                                                              β”‚
β”‚  3. Terminal (terminal/) - Legacy NFC POS System            β”‚
β”‚     └─ Separate push payment system (not part of hackathon) β”‚
β”‚                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

  • Smart Contract: Solidity 0.8.24, OpenZeppelin, Foundry
  • Agent SDK: JavaScript, ethers.js v6, EIP-712
  • Blockchain: Base L2 (fast, cheap, EVM-compatible)
  • Token: USDC (works with any ERC-20)

πŸ“Š Hackathon Progress

  • βœ… Day 1 (Feb 5): Smart Contract - FastPayCore.sol deployed
  • βœ… Day 2 (Feb 6): Agent SDK - MerchantAgent & CustomerAgent classes
  • βœ… Day 3 (Feb 4): Deployment & Testing - Live on Base Sepolia ⭐
  • ⏳ Day 4 (Feb 5-7): Documentation & Submission

See: STATUS.md for detailed progress See: DEPLOYMENT-SUCCESS.md for deployment details


πŸš€ Quick Start

Run the Demo

# 1. Clone the repo
git clone <your-repo-url>
cd fastpay

# 2. Set up contracts (optional - already deployed)
cd contracts
forge build
forge test

# 3. Run agent demo
cd ../agents
npm install
cp .env.example .env
# Edit .env with your wallet keys
npm run demo

Deploy Your Own

cd contracts
cp .env.example .env
# Add your PRIVATE_KEY and ETHERSCAN_API_KEY
forge script script/Deploy.s.sol:DeployScript \
  --rpc-url base_sepolia \
  --broadcast \
  --verify

See: DEPLOYMENT-GUIDE.md for full deployment instructions


πŸ“ˆ Performance Metrics

Metric Value Notes
Gas per Payment 137,691 ~$0.0006 on Base L2
Customer Cost $0.00 Completely gasless after approval
Settlement Time < 10 seconds End-to-end
Token Support Any ERC-20 USDC, USDT, DAI, etc.
Security EIP-712 + Nonces Replay protection

🎯 Use Cases for AI Agents

  1. API Micropayments: Agent pays for API calls with USDC (no ETH needed)
  2. SaaS Subscriptions: Agent-to-agent recurring payments
  3. Agent Marketplaces: Autonomous commerce between AI services
  4. Data Purchases: Agents buy datasets with simple signatures
  5. Compute Resources: Pay for cloud compute without gas overhead

πŸ” Security Features

  • βœ… EIP-712 Typed Signatures: Human-readable payment details
  • βœ… Nonce-Based Replay Protection: Each payment uses unique nonce
  • βœ… ReentrancyGuard: Prevents reentrancy attacks
  • βœ… Expiration Times: Payments have validity windows
  • βœ… Signature Verification: Customer must authorize every payment
  • βœ… Audited Patterns: Uses OpenZeppelin contracts

πŸ“š Documentation


🀝 Contributing

This is an open-source project built for the OpenClaw USDC Hackathon.

Areas for contribution:

  • Additional ERC-20 token support
  • Gas optimization
  • Additional security features
  • Frontend integrations
  • Documentation improvements

πŸ“œ License

MIT License - See LICENSE for details


πŸ™ Acknowledgments


πŸ“ž Contact

  • Twitter: @pcdkd
  • Base: @pxaxm.base.eth

πŸŽ‰ FastPay: Enabling true autonomous agent commerce with pull payments on Base L2

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •