56 lines
1.8 KiB
Markdown
56 lines
1.8 KiB
Markdown
---
|
|
id: TASK-9
|
|
title: Implement x402 Micropayment Gateway for Community APIs
|
|
status: To Do
|
|
assignee: []
|
|
created_date: '2026-04-03 21:41'
|
|
labels:
|
|
- typescript
|
|
- x402
|
|
- micropayments
|
|
dependencies:
|
|
- TASK-7
|
|
documentation:
|
|
- backlog/docs/402_CRDT_CrossChain_Fiat_Research.md
|
|
priority: medium
|
|
---
|
|
|
|
## Description
|
|
|
|
<!-- SECTION:DESCRIPTION:BEGIN -->
|
|
Enable HTTP 402-based pay-per-use access to community services using x402 protocol.
|
|
|
|
What x402 enables:
|
|
- Any community API endpoint gated by on-chain micropayment
|
|
- Client signs EIP-3009 transferWithAuthorization (gasless for USDC/EURC)
|
|
- Or Permit2 for any ERC-20 (including community tokens)
|
|
- Facilitator settles on-chain, server delivers resource
|
|
|
|
Implementation:
|
|
1. Express/Hono middleware using @x402/express or @x402/hono
|
|
2. Custom facilitator that routes fees to community treasury
|
|
3. Support both USDC and community token payments
|
|
4. Rate tiers: free tier → USDC micropayment → community token discount
|
|
|
|
Use cases for community token economies:
|
|
- API metering (data endpoints, AI inference, analytics)
|
|
- Content paywalls (@x402/paywall)
|
|
- Agent-to-agent commerce (AI agents pay with community tokens)
|
|
- Revenue routing to bonding curve reserve
|
|
|
|
Key contracts:
|
|
- x402 proxy: 0x402085c248EeA27D92E8b30b2C58ed07f9E20001 (all chains)
|
|
- USDC on Base: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
|
|
SDK: @x402/core, @x402/evm, @x402/express, @x402/next, @x402/fetch, @x402/paywall
|
|
<!-- SECTION:DESCRIPTION:END -->
|
|
|
|
## Acceptance Criteria
|
|
<!-- AC:BEGIN -->
|
|
- [ ] #1 Express middleware gates API endpoints with 402 challenge
|
|
- [ ] #2 USDC payments settle correctly on Base
|
|
- [ ] #3 Community token payments work via Permit2
|
|
- [ ] #4 Revenue routes to community treasury contract
|
|
- [ ] #5 Free tier → paid tier escalation works
|
|
<!-- AC:END -->
|