Ecosystem
Live: x402bazaar.org | API: x402-api.onrender.com | Dashboard: x402-api.onrender.com/dashboard
What is x402 Bazaar?
x402 Bazaar is an autonomous API marketplace built on the HTTP 402 Payment Required standard. AI agents discover services, pay in USDC on Base, SKALE on Base (ultra-low gas), or Polygon, and get instant access -- no API keys, no subscriptions, no accounts. The server verifies payments on-chain and enforces anti-replay protection, making every transaction trustless and permissionless.
Key Features
- HTTP 402 Protocol -- Standard-compliant payment flow. Call an endpoint, get a
402with payment details, pay USDC, retry with tx hash, done. - 69 Native API Wrappers -- Web search, URL scraper, Twitter/X, weather, crypto, jokes, DALL-E 3, translation, code execution, sentiment analysis, and 50+ more -- all behind micropayments.
- 43+ Marketplace Services -- Growing catalog of third-party APIs monetized through x402 (total: 112+ callable endpoints).
- LangChain + Python SDK --
pip install x402-bazaarfor agents built with LangChain/LangGraph/CrewAI. - Multi-Chain -- Base (mainnet) + SKALE on Base (ultra-low gas ~$0.0007/tx) + Polygon (EIP-3009 gas-free).
- MCP Server (v2.7.0, 15 tools) -- Plug into Claude Desktop, Cursor, VS Code, or Claude Code.
- One-Line Setup --
npx x402-bazaar initdetects your IDE and configures everything. - Anti-Replay Protection -- Every transaction hash is stored in Supabase and can only be used once.
- Budget Control -- Per-session spending caps for AI agents (configurable
MAX_BUDGET_USDC). - Security Hardened -- Helmet headers, CORS whitelist, rate limiting (3 tiers), input sanitization, SSRF protection, httpOnly admin sessions, HMAC'd IP hashing.
- 2136 Tests -- 398 suites, all passing (node:test, zero deps).
- Real-Time Monitoring -- 69 native endpoints checked every 5min, Telegram alerts on transitions, public
/api/statuspage. - Telegram Bot -- Interactive admin bot with 6 commands (/balance, /stats, /status, /recent, /services, /help).
- Auto-Test on Registration -- New services are pinged automatically, with Telegram notification on result.
- Public Stats --
GET /api/public-stats(no auth) for frontend homepage counters.
Quick Start
# One-line setup for AI IDEs (Claude Desktop, Cursor, VS Code)
npx x402-bazaar init
Or run the server locally:
git clone https://github.com/Wintyx57/x402-backend.git
cd x402-backend
npm install
cp .env.example .env # Fill in your keys
node server.js
How the x402 Payment Flow Works
Agent x402 Bazaar Base / SKALE / Polygon
| | |
| GET /api/weather?city=Paris | |
|------------------------------->| |
| 402 Payment Required | |
| { amount: 0.02, recipient } | |
|<-------------------------------| |
| | |
| Transfer 0.02 USDC ------------------------------------------>|
| tx: 0xabc123... | |
| | |
| GET /api/weather?city=Paris | |
| X-Payment-TxHash: 0xabc123 | |
|------------------------------->| |
| | verify tx on-chain ---------->|
| | mark tx used (anti-replay) |
| 200 OK { temperature: 15.2 } | |
|<-------------------------------| |
API Reference
Marketplace Endpoints
Native API Wrappers (69 endpoints, x402-powered)
Monitoring & Status (Free)
Dashboard (Admin, requires X-Admin-Token)
Payment Headers
MCP Server
The MCP server exposes x402 Bazaar as native tools for AI IDEs. Agents can discover, search, and pay for APIs directly from their conversation.
npx x402-bazaar init # Auto-detects your IDE and installs
MCP Tools (15 total)
Supported Networks
Tech Stack
Environment Variables
Scripts
npm start # Start the server
npm run mcp # Start the MCP server
npm run seed # Seed 112+ services into Supabase
npm run seed:wrappers # Register the 112 native wrappers
npm run demo # Run the autonomous agent demo
npm run demo:live # Live demo with terminal UI
Security
- Helmet -- Security headers (HSTS, X-Content-Type, X-Frame-Options)
- CORS -- Strict origin whitelist (no wildcards in production)
- Rate Limiting -- 3 tiers: general (500/15min), paid endpoints (30/min), registration (10/hr)
- Anti-Replay -- Transaction hashes persisted in Supabase
used_transactionstable - On-Chain Verification -- Validates USDC transfer logs directly via RPC
- USDC-Only -- Rejects non-USDC token transfers
- Input Sanitization -- Control character rejection, Postgres LIKE escaping, length limits
- SSRF Protection -- Blocks localhost, private IPs, IPv6 loopback, cloud metadata
- Body Limit -- 10KB max request body
- RPC Timeout -- 10s timeout on all blockchain calls
Create Your Own x402 API
Monetize any Python function in 5 minutes with the FastAPI template:
git clone https://github.com/Wintyx57/x402-fast-monetization-template
cd x402-fast-monetization-template
pip install -r requirements.txt
cp .env.example .env # Set your WALLET_ADDRESS
python main.py
@x402_paywall(price=0.05, description="My API", tags=["cool"])
def my_function(text: str) -> dict:
return {"result": "something"}
Contributing
Contributions are welcome. Please open an issue to discuss proposed changes before submitting a PR.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Links
- Website: x402bazaar.org
- Frontend: github.com/Wintyx57/x402-frontend
- LangChain: github.com/Wintyx57/x402-langchain
- CLI:
npx x402-bazaar init| npm - API Template: x402-fast-monetization-template
- Live API: x402-api.onrender.com
- Dashboard: x402-api.onrender.com/dashboard
License
MIT