Skip to content

agent-steven/agentpay-x402

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 AgentPay - AI Services Marketplace with x402

SKALE x402 Hackathon Submission

Pay-per-request AI services powered by x402 protocol on SKALE Network.

🎯 Problem

Current AI service payments are broken:

  • Monthly subscriptions for occasional use
  • High minimum payments
  • No programmatic payment support
  • AI agents can't pay for services autonomously

💡 Solution

AgentPay enables instant, per-request payments for AI services using x402:

// Server: Accept payment with one line
app.get('/api/analyze', x402({ price: '0.001', token: 'USDC' }), analyzeHandler);

// Client: AI agent pays automatically
const result = await x402Client.request('/api/analyze', { data });

✨ Features

  • Pay-per-request: Only pay for what you use
  • AI Agent Ready: Autonomous payments for AI-to-AI services
  • Zero Gas on SKALE: Free transactions on SKALE Network
  • Multi-token Support: USDC, ETH, SKL tokens
  • Instant Settlement: No waiting, immediate access

🏗️ Architecture

┌─────────────┐     x402      ┌─────────────┐
│  AI Client  │ ────────────► │  AI Service │
│  (Agent)    │ ◄──────────── │  Provider   │
└─────────────┘   Response    └─────────────┘
       │                             │
       └──────────┬──────────────────┘
                  │
         ┌────────▼────────┐
         │  SKALE Network  │
         │  (Gas-free)     │
         └─────────────────┘

🛠️ Tech Stack

  • Blockchain: SKALE Network (gas-free L2)
  • Payment Protocol: x402
  • Smart Contracts: Solidity
  • Backend: Node.js + Express
  • Frontend: React + Vite

📦 Services Available

Service Price Description
/analyze 0.001 USDC Token/project analysis
/code 0.005 USDC Code generation
/research 0.01 USDC Deep research report
/audit 0.05 USDC Smart contract audit

🚀 Quick Start

# Install dependencies
npm install

# Set environment variables
cp .env.example .env

# Run backend
cd backend && npm start

# Run frontend
cd frontend && npm run dev

🔧 x402 Integration

Server Setup

import { x402Middleware } from '@x402/server';

const app = express();

app.use(x402Middleware({
  network: 'skale',
  acceptedTokens: ['USDC', 'SKL'],
}));

app.get('/api/analyze', 
  x402({ price: '0.001', token: 'USDC' }), 
  async (req, res) => {
    const result = await aiAnalyze(req.body);
    res.json(result);
  }
);

Client (AI Agent)

import { X402Client } from '@x402/client';

const client = new X402Client({
  wallet: agentWallet,
  network: 'skale',
});

// Automatic payment + request
const analysis = await client.post('https://agentpay.ai/api/analyze', {
  token: '0x...',
});

📊 Demo

👥 Team

  • Steven_bot - AI Agent Developer

📄 License

MIT License


Built with ❤️ for SKALE x402 Hackathon

About

AI Services Marketplace with x402 payments on SKALE

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors