tempo-x402-node-0.6.4 is not a library.
tempo-x402
Pay-per-request APIs on the Tempo blockchain. Security-hardened.
Live Demo | Documentation | crates.io
How It Works
┌────────┐ ┌────────┐ ┌─────────────┐ ┌───────┐
│ Client │ │ Server │ │ Facilitator │ │ Chain │
└───┬────┘ └───┬────┘ └──────┬──────┘ └───┬───┘
│ │ │ │
│ GET /resource │ │ │
│─────────────────>│ │ │
│ │ │ │
│ 402 + payment │ │ │
│ requirements │ │ │
│<─────────────────│ │ │
│ │ │ │
│ [sign EIP-712] │ │ │
│ │ │ │
│ GET /resource │ │ │
│ + PAYMENT- │ │ │
│ SIGNATURE hdr │ │ │
│─────────────────>│ │ │
│ │ │ │
│ │ verify + settle │ │
│ │────────────────────>│ │
│ │ │ transferFrom() │
│ │ │───────────────────>│
│ │ │<───────────────────│
│ │<────────────────────│ │
│ │ │ │
│ 200 + content │ │ │
│<─────────────────│ │ │
Client requests a paid endpoint. Server returns 402 with price info. Client signs an EIP-712 payment authorization and retries. Server forwards to Facilitator, which verifies the signature and calls transferFrom on-chain. Server returns the content.
Architecture
| Component | What it does | Crate |
|---|---|---|
| Client | Signs payments, makes requests | tempo-x402 |
| Server | Gates endpoints, returns 402 | tempo-x402-server |
| Facilitator | Verifies signatures, settles on-chain | tempo-x402-facilitator |
| Gateway | Proxy any API with payment rails | tempo-x402-gateway |
| Wallet | WASM-compatible signing & key generation | tempo-x402-wallet |
The facilitator holds no funds — it just has approval to call transferFrom on behalf of clients who have pre-approved it.
Install
Usage
use PrivateKeySigner;
use ;
async
Crates
| Crate | Purpose |
|---|---|
tempo-x402 |
Core library — types, signing, HTTP client |
tempo-x402-server |
Resource server with payment middleware |
tempo-x402-facilitator |
Payment verification and settlement |
tempo-x402-gateway |
API relay/proxy with endpoint registration |
tempo-x402-wallet |
WASM-compatible wallet — key generation, EIP-712 signing |
Deployed Services
| Service | URL |
|---|---|
| Demo | https://tempo-x402-app.vercel.app |
| Server | https://x402-server-production.up.railway.app |
| Facilitator | https://x402-facilitator-production-ec87.up.railway.app |
| Gateway | https://x402-gateway-production-5018.up.railway.app |
Network
- Chain: Tempo Moderato (testnet)
- Chain ID: 42431
- Token: pathUSD
0x20c0000000000000000000000000000000000000(6 decimals) - RPC: https://rpc.moderato.tempo.xyz
License
MIT