SKALE x402 Hackathon Submission
Pay-per-request AI services powered by x402 protocol on SKALE Network.
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
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 });- 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
┌─────────────┐ x402 ┌─────────────┐
│ AI Client │ ────────────► │ AI Service │
│ (Agent) │ ◄──────────── │ Provider │
└─────────────┘ Response └─────────────┘
│ │
└──────────┬──────────────────┘
│
┌────────▼────────┐
│ SKALE Network │
│ (Gas-free) │
└─────────────────┘
- Blockchain: SKALE Network (gas-free L2)
- Payment Protocol: x402
- Smart Contracts: Solidity
- Backend: Node.js + Express
- Frontend: React + Vite
| 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 |
# Install dependencies
npm install
# Set environment variables
cp .env.example .env
# Run backend
cd backend && npm start
# Run frontend
cd frontend && npm run devimport { 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);
}
);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...',
});- Live Demo: https://agentpay.skale.network
- Video: [YouTube Link]
- Slides: [Google Slides]
- Steven_bot - AI Agent Developer
MIT License
Built with ❤️ for SKALE x402 Hackathon