{"id":46009692,"url":"https://github.com/wintyx57/x402-backend","last_synced_at":"2026-03-01T00:00:47.861Z","repository":{"id":337893060,"uuid":"1151719534","full_name":"Wintyx57/x402-backend","owner":"Wintyx57","description":"API marketplace powered by HTTP 402 protocol — AI agents pay per call with USDC on Base. 69 native endpoints, on-chain payment verification, multi-chain (Base + SKALE).","archived":false,"fork":false,"pushed_at":"2026-02-28T17:42:47.000Z","size":593,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-28T19:42:40.283Z","etag":null,"topics":["ai-agents","api-marketplace","base","crypto-payments","express","http-402","mcp-server","usdc","web3","x402"],"latest_commit_sha":null,"homepage":"https://x402bazaar.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Wintyx57.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-06T20:16:34.000Z","updated_at":"2026-02-28T17:42:51.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Wintyx57/x402-backend","commit_stats":null,"previous_names":["wintyx57/x402-backend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Wintyx57/x402-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wintyx57%2Fx402-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wintyx57%2Fx402-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wintyx57%2Fx402-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wintyx57%2Fx402-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wintyx57","download_url":"https://codeload.github.com/Wintyx57/x402-backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wintyx57%2Fx402-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29955885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T22:53:01.873Z","status":"ssl_error","status_checked_at":"2026-02-28T22:52:50.699Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","api-marketplace","base","crypto-payments","express","http-402","mcp-server","usdc","web3","x402"],"created_at":"2026-03-01T00:00:38.654Z","updated_at":"2026-03-01T00:00:47.842Z","avatar_url":"https://github.com/Wintyx57.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003ex402 Bazaar\u003c/h1\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cstrong\u003eThe decentralized API marketplace where AI agents pay with USDC, not API keys.\u003c/strong\u003e\n  \u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://x402bazaar.org\"\u003e\u003cimg src=\"https://img.shields.io/badge/website-x402bazaar.org-blue?style=flat-square\" alt=\"Website\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/x402-bazaar\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/x402-bazaar?style=flat-square\u0026color=green\" alt=\"npm\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-yellow?style=flat-square\" alt=\"License\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/Wintyx57/x402-backend\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/Wintyx57/x402-backend?style=flat-square\" alt=\"Stars\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://basescan.org\"\u003e\u003cimg src=\"https://img.shields.io/badge/chain-Base%20%2B%20SKALE-8b5cf6?style=flat-square\" alt=\"Chain\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg) ![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen) ![Tests](https://img.shields.io/badge/tests-478%20passing-brightgreen) ![Render](https://img.shields.io/badge/deploy-Render-46E3B7) ![APIs](https://img.shields.io/badge/APIs-69%20native-blue)\n\n---\n\n## Ecosystem\n\n| Repository | Description |\n|------------|-------------|\n| **[x402-backend](https://github.com/Wintyx57/x402-backend)** (this repo) | Backend API — Express server, payment middleware, 69 native wrappers, MCP server |\n| **[x402-frontend](https://github.com/Wintyx57/x402-frontend)** | React frontend — 15 pages, glassmorphism UI, wallet connect, i18n FR/EN |\n| **[x402-langchain](https://github.com/Wintyx57/x402-langchain)** | Python package — LangChain tools for x402 Bazaar (pip install) |\n| **[x402-fast-monetization-template](https://github.com/Wintyx57/x402-fast-monetization-template)** | FastAPI template — Monetize any Python function with x402 in 5 minutes |\n| **[CLI: npx x402-bazaar](https://www.npmjs.com/package/x402-bazaar)** | One-line setup for Claude Desktop, Cursor, VS Code |\n| **[@x402/sdk](https://www.npmjs.com/package/@x402/sdk)** | TypeScript SDK — typed client for x402 Bazaar APIs |\n| **[Reviews API](https://x402-api.onrender.com/api/reviews)** | Ratings \u0026 reviews system for marketplace services |\n| **[Bazaar Discovery](https://x402-api.onrender.com/api/discovery)** | Agent discovery via @x402/extensions v2.5.0 (official Coinbase SDK) |\n\n**Live:** [x402bazaar.org](https://x402bazaar.org) | **API:** [x402-api.onrender.com](https://x402-api.onrender.com) | **Dashboard:** [x402-api.onrender.com/dashboard](https://x402-api.onrender.com/dashboard)\n\n---\n\n## What is x402 Bazaar?\n\nx402 Bazaar is an autonomous API marketplace built on the [HTTP 402 Payment Required](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/402) standard. AI agents discover services, pay in USDC on Base or SKALE Europa (zero gas), 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.\n\n## Key Features\n\n- **HTTP 402 Protocol** -- Standard-compliant payment flow. Call an endpoint, get a `402` with payment details, pay USDC, retry with tx hash, done.\n- **69 Native API Wrappers** -- Web search, URL scraper, Twitter/X, weather, crypto, jokes, DALL-E 3, translation, code execution, sentiment analysis, and 59+ more -- all behind micropayments.\n- **70+ Registered Services** -- Growing marketplace of third-party APIs monetized through x402.\n- **LangChain Integration** -- Python package `x402-langchain` for agents built with LangChain/LangGraph.\n- **Multi-Chain** -- Base (mainnet) + SKALE Europa (zero gas fees via sFUEL).\n- **MCP Server** -- Plug into Claude Desktop, Cursor, VS Code, or Claude Code as native AI tools.\n- **One-Line Setup** -- `npx x402-bazaar init` detects your IDE and configures everything.\n- **Anti-Replay Protection** -- Every transaction hash is stored in Supabase and can only be used once.\n- **Budget Control** -- Per-session spending caps for AI agents (configurable `MAX_BUDGET_USDC`).\n- **Security Hardened** -- Helmet headers, CORS whitelist, rate limiting (3 tiers), input sanitization, SSRF protection.\n- **478 Tests** -- 14 test suites, all passing (node:test, zero deps).\n- **Real-Time Monitoring** -- 69 endpoints checked every 5min, Telegram alerts on transitions, public `/api/status` page.\n- **Telegram Bot** -- Interactive admin bot with 6 commands (/balance, /stats, /status, /recent, /services, /help).\n- **Auto-Test on Registration** -- New services are pinged automatically, with Telegram notification on result.\n- **Public Stats** -- `GET /api/public-stats` (no auth) for frontend homepage counters.\n\n## Quick Start\n\n```bash\n# One-line setup for AI IDEs (Claude Desktop, Cursor, VS Code)\nnpx x402-bazaar init\n```\n\nOr run the server locally:\n\n```bash\ngit clone https://github.com/Wintyx57/x402-backend.git\ncd x402-backend\nnpm install\ncp .env.example .env   # Fill in your keys\nnode server.js\n```\n\n## How the x402 Payment Flow Works\n\n```\nAgent                          x402 Bazaar                     Base / SKALE\n  |                                |                                |\n  |  GET /api/weather?city=Paris   |                                |\n  |-------------------------------\u003e|                                |\n  |  402 Payment Required          |                                |\n  |  { amount: 0.02, recipient }   |                                |\n  |\u003c-------------------------------|                                |\n  |                                |                                |\n  |  Transfer 0.02 USDC ------------------------------------------\u003e|\n  |  tx: 0xabc123...              |                                |\n  |                                |                                |\n  |  GET /api/weather?city=Paris   |                                |\n  |  X-Payment-TxHash: 0xabc123   |                                |\n  |-------------------------------\u003e|                                |\n  |                                |  verify tx on-chain ----------\u003e|\n  |                                |  mark tx used (anti-replay)    |\n  |  200 OK { temperature: 15.2 } |                                |\n  |\u003c-------------------------------|                                |\n```\n\n## API Reference\n\n### Marketplace Endpoints\n\n| Route | Method | Cost | Description |\n|-------|--------|------|-------------|\n| `/` | GET | Free | Marketplace info + endpoint catalog |\n| `/health` | GET | Free | Health check + supported networks |\n| `/services` | GET | 0.05 USDC | List all registered services |\n| `/search?q=` | GET | 0.05 USDC | Search services by keyword |\n| `/register` | POST | 1.00 USDC | Register a new service |\n\n### Native API Wrappers (69 endpoints, x402-powered)\n\n| Route | Cost | Source | Description |\n|-------|------|--------|-------------|\n| `/api/search?q=` | 0.005 USDC | DuckDuckGo | Clean web search results for LLMs |\n| `/api/scrape?url=` | 0.005 USDC | Cheerio + Turndown | Any URL to clean Markdown |\n| `/api/twitter?user=\\|tweet=\\|search=` | 0.005 USDC | fxtwitter | Twitter/X profiles, tweets, search |\n| `/api/weather?city=` | 0.02 USDC | Open-Meteo | Weather data for any city |\n| `/api/crypto?coin=` | 0.02 USDC | CoinGecko | Cryptocurrency prices (USD/EUR) |\n| `/api/joke` | 0.01 USDC | Official Joke API | Random joke |\n| `/api/image?prompt=` | 0.05 USDC | DALL-E 3 | AI image generation (1024x1024) |\n| `/api/wikipedia?q=` | 0.005 USDC | Wikipedia API | Article summaries |\n| `/api/dictionary?word=` | 0.005 USDC | Free Dictionary | English definitions |\n| `/api/countries?name=` | 0.005 USDC | REST Countries | Country data |\n| `/api/github?user=\\|repo=` | 0.005 USDC | GitHub API | Profiles and repo stats |\n| `/api/npm?package=` | 0.005 USDC | NPM Registry | Package metadata |\n| `/api/ip?address=` | 0.005 USDC | ip-api.com | IP geolocation |\n| `/api/translate?text=\u0026to=` | 0.005 USDC | MyMemory | Translate 90+ languages |\n| `/api/summarize?text=` | 0.01 USDC | GPT-4o-mini | AI text summarization |\n| `/api/code` | 0.005 USDC | Piston API | Execute code in 50+ languages |\n| `/api/sentiment?text=` | 0.005 USDC | GPT-4o-mini | Sentiment analysis |\n| `/api/dns?domain=` | 0.003 USDC | Node DNS | DNS record lookup |\n| `/api/currency?from=\u0026to=` | 0.005 USDC | Frankfurter | Currency conversion (ECB) |\n| ...and 22 more | 0.003-0.005 | Various | See [API_WRAPPERS.md](API_WRAPPERS.md) |\n\n### Monitoring \u0026 Status (Free)\n\n| Route | Description |\n|-------|-------------|\n| `/api/status` | Live monitoring status for all 69 endpoints |\n| `/api/status/uptime` | Uptime percentages by endpoint |\n| `/api/status/history` | Check history (last 24h) |\n| `/api/public-stats` | Public stats (services, API calls, monitoring, integrations) |\n\n### Dashboard (Admin, requires `X-Admin-Token`)\n\n| Route | Description |\n|-------|-------------|\n| `/dashboard` | Admin UI -- stats, services, activity log, System Info |\n| `/api/stats` | JSON stats (services, payments, revenue, wallet balance) |\n| `/api/analytics` | Enriched analytics (balance, recent activity, avg price) |\n\n### Payment Headers\n\n| Header | Required | Description |\n|--------|----------|-------------|\n| `X-Payment-TxHash` | Yes (for paid endpoints) | USDC transfer transaction hash |\n| `X-Payment-Chain` | No (default: `base`) | Chain used: `base`, `base-sepolia`, or `skale` |\n\n## MCP Server\n\nThe MCP server exposes x402 Bazaar as native tools for AI IDEs. Agents can discover, search, and pay for APIs directly from their conversation.\n\n```bash\nnpx x402-bazaar init   # Auto-detects your IDE and installs\n```\n\n### MCP Tools\n\n| Tool | Cost | Description |\n|------|------|-------------|\n| `discover_marketplace` | Free | Browse available endpoints and service count |\n| `search_services` | 0.05 USDC | Search APIs by keyword |\n| `list_services` | 0.05 USDC | Full service catalog |\n| `find_tool_for_task` | 0.05 USDC | Describe what you need in plain English, get the best match |\n| `call_api` | Free | Call any external API URL |\n| `get_wallet_balance` | Free | Check agent wallet USDC balance on-chain |\n| `get_budget_status` | Free | Session spending tracker |\n\n## Supported Networks\n\n| Network | Chain ID | Gas | USDC Contract |\n|---------|----------|-----|---------------|\n| Base | 8453 | ~$0.001 | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` |\n| Base Sepolia | 84532 | Free (testnet) | `0x036CbD53842c5426634e7929541eC2318f3dCF7e` |\n| SKALE Europa | 2046399126 | Free (sFUEL) | `0x5F795bb52dAc3085f578f4877D450e2929D2F13d` |\n\n## Tech Stack\n\n| Layer | Technology |\n|-------|-----------|\n| Runtime | Node.js |\n| Framework | Express 5 |\n| Blockchain | Base + SKALE Europa (USDC) |\n| Wallet SDK | Coinbase Developer Platform (CDP) |\n| Database | Supabase (PostgreSQL) |\n| MCP | Model Context Protocol SDK |\n| AI (demo) | OpenAI GPT-4o-mini |\n| Scraping | Cheerio + Turndown |\n\n## Environment Variables\n\n| Variable | Description |\n|----------|-------------|\n| `PORT` | Server port (default: 3000) |\n| `NETWORK` | `mainnet` or `testnet` |\n| `WALLET_ADDRESS` | USDC recipient address |\n| `WALLET_ID` | Coinbase CDP wallet ID |\n| `COINBASE_API_KEY` | Coinbase Developer Platform API key |\n| `COINBASE_API_SECRET` | CDP API secret |\n| `SUPABASE_URL` | Supabase project URL |\n| `SUPABASE_KEY` | Supabase anon key |\n| `OPENAI_API_KEY` | OpenAI key (for /api/image, /api/summarize, /api/sentiment) |\n| `ADMIN_TOKEN` | Secret token for dashboard access |\n| `TELEGRAM_BOT_TOKEN` | Telegram bot token for monitoring alerts + interactive commands |\n| `TELEGRAM_CHAT_ID` | Telegram chat ID to receive notifications |\n\n## Scripts\n\n```bash\nnpm start            # Start the server\nnpm run mcp          # Start the MCP server\nnpm run seed         # Seed 75+ services into Supabase\nnpm run seed:wrappers # Register the 69 native wrappers\nnpm run demo         # Run the autonomous agent demo\nnpm run demo:live    # Hackathon live demo with terminal UI\n```\n\n## Security\n\n- **Helmet** -- Security headers (HSTS, X-Content-Type, X-Frame-Options)\n- **CORS** -- Strict origin whitelist (no wildcards in production)\n- **Rate Limiting** -- 3 tiers: general (500/15min), paid endpoints (30/min), registration (10/hr)\n- **Anti-Replay** -- Transaction hashes persisted in Supabase `used_transactions` table\n- **On-Chain Verification** -- Validates USDC transfer logs directly via RPC\n- **USDC-Only** -- Rejects non-USDC token transfers\n- **Input Sanitization** -- Control character rejection, Postgres LIKE escaping, length limits\n- **SSRF Protection** -- Blocks localhost, private IPs, IPv6 loopback, cloud metadata\n- **Body Limit** -- 10KB max request body\n- **RPC Timeout** -- 10s timeout on all blockchain calls\n\n## Create Your Own x402 API\n\nMonetize any Python function in 5 minutes with the FastAPI template:\n\n```bash\ngit clone https://github.com/Wintyx57/x402-fast-monetization-template\ncd x402-fast-monetization-template\npip install -r requirements.txt\ncp .env.example .env  # Set your WALLET_ADDRESS\npython main.py\n```\n\n```python\n@x402_paywall(price=0.05, description=\"My API\", tags=[\"cool\"])\ndef my_function(text: str) -\u003e dict:\n    return {\"result\": \"something\"}\n```\n\n## Contributing\n\nContributions are welcome. Please open an issue to discuss proposed changes before submitting a PR.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## Links\n\n- **Website:** [x402bazaar.org](https://x402bazaar.org)\n- **Frontend:** [github.com/Wintyx57/x402-frontend](https://github.com/Wintyx57/x402-frontend)\n- **LangChain:** [github.com/Wintyx57/x402-langchain](https://github.com/Wintyx57/x402-langchain)\n- **CLI:** `npx x402-bazaar init` | [npm](https://www.npmjs.com/package/x402-bazaar)\n- **API Template:** [x402-fast-monetization-template](https://github.com/Wintyx57/x402-fast-monetization-template)\n- **Live API:** [x402-api.onrender.com](https://x402-api.onrender.com)\n- **Dashboard:** [x402-api.onrender.com/dashboard](https://x402-api.onrender.com/dashboard)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwintyx57%2Fx402-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwintyx57%2Fx402-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwintyx57%2Fx402-backend/lists"}