https://github.com/piprail/piprail
Backendless, no-fee x402 payments across 24 chains โ EVM, Solana, TON, Tron, NEAR, Sui, Stellar & XRPL. Install, name a chain, get paid straight to your wallet.
https://github.com/piprail/piprail
agent-payments ai-agents crypto-payments evm payments sdk solana stablecoin typescript usdc web3 x402
Last synced: about 1 month ago
JSON representation
Backendless, no-fee x402 payments across 24 chains โ EVM, Solana, TON, Tron, NEAR, Sui, Stellar & XRPL. Install, name a chain, get paid straight to your wallet.
- Host: GitHub
- URL: https://github.com/piprail/piprail
- Owner: piprail
- License: mit
- Created: 2026-05-27T05:46:51.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-06-03T19:21:10.000Z (about 2 months ago)
- Last Synced: 2026-06-03T21:10:03.677Z (about 2 months ago)
- Topics: agent-payments, ai-agents, crypto-payments, evm, payments, sdk, solana, stablecoin, typescript, usdc, web3, x402
- Language: TypeScript
- Homepage: https://piprail.com
- Size: 1010 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
- awesome-x402 - PipRail - Backendless, no-fee x402 SDK for AI agents across 28 chains in 10 families (every major EVM chain plus Solana, TON, Tron, NEAR, Sui, Aptos, Algorand, Stellar & XRPL). Self-custodial โ the payer broadcasts their own transfer and the merchant verifies locally against their own RPC, no facilitator. Take payments (`requirePayment`) or make them (`PipRailClient`), with per-call/lifetime spend budgets and a `planPayment()` affordability + recipient-readiness preflight. ([npm](https://www.npmjs.com/package/@piprail/sdk)) (๐ ๏ธ SDKs & Client Libraries / JavaScript/TypeScript)
- awesome-hermes-agent - production - bound, self-custodial x402 payment wallet via `npx -y @piprail/mcp`. Lets Hermes autonomously pay 402 "Payment Required" URLs across EVM, Solana, TON, Tron, NEAR, Sui, Aptos, Algorand, Stellar, and the XRP Ledger โ funds settle straight to the merchant, no facilitator, no fee, capped by a spend policy the model cannot exceed. MIT. (Integrations & Bridges / Deployment)
- awesome-agentic-commerce - PipRail - Backendless, MIT TypeScript SDK for x402 across 28 chains in 10 families (EVM, Solana, TON, Tron, NEAR, Sui, Aptos, Algorand, Stellar, XRPL). No facilitator, no fee โ payments settle straight to your wallet, verified locally against your own RPC. ([npm](https://www.npmjs.com/package/@piprail/sdk)) (Uncategorized / Uncategorized)
README

[](https://www.npmjs.com/package/@piprail/sdk)
[](https://www.npmjs.com/package/@piprail/mcp)
[](https://www.npmjs.com/package/@piprail/sdk)
[](LICENSE)
[](https://x402.org)
[](#-supported-chains)
**Let any HTTP endpoint charge for itself, and any agent pay for itself โ across 28 chains, in a couple of lines.**
[Website](https://piprail.com) ยท [npm](https://www.npmjs.com/package/@piprail/sdk) ยท [Full docs โ](sdk/README.md)
---
`@piprail/sdk` implements the open [x402](https://x402.org) **"402 Payment Required"** standard with **no backend, no database, no account, and no fee**. Payments settle **straight into your wallet**, verified locally against your own RPC โ across every major EVM chain plus **Solana, TON, Tron, NEAR, Sui, Aptos, Algorand, Stellar & the XRP Ledger**.
```bash
npm install @piprail/sdk viem
```
### ๐ธ Charge for an endpoint
```ts
import { requirePayment } from '@piprail/sdk'
app.get('/report',
requirePayment({ chain: 'base', token: 'USDC', amount: '0.05', payTo: '0xYourWalletโฆ' }),
(_req, res) => res.json({ report: 'TOP SECRET' }),
)
```
That route now costs **0.05 USDC on Base**, paid straight to your wallet. The first request gets a `402` with payment instructions; once the caller pays on-chain, it goes through. One parameter picks the chain.
### ๐ค Let an agent pay for it
```ts
import { PipRailClient } from '@piprail/sdk'
const client = new PipRailClient({ chain: 'base', wallet: { privateKey: process.env.AGENT_KEY } })
// Hits a 402, pays it on-chain, waits for confirmation, retries with proof โ automatically.
const res = await client.fetch('https://api.example.com/report')
```
The same app can **take** payments and **make** them. Built for autonomous agents: install, add a wallet, monetize or pay โ nothing else to wire up.
## ๐ Supported chains
**28 chains across 10 families** โ name one with a single `chain:` parameter. Non-EVM families lazy-load on first use, so a pure-EVM install never downloads their libraries.
| Family | Built-in chains | Tokens |
|---|---|---|
| **EVM** (19) | Ethereum ยท Base ยท Arbitrum ยท Optimism ยท Polygon ยท BNB ยท Avalanche ยท Mantle ยท Sonic ยท Linea ยท Scroll ยท Celo ยท zkSync ยท Unichain ยท World Chain ยท Sei ยท Injective ยท HyperEVM ยท Monad | USDC + USDT* |
| **Solana** | Solana | USDC ยท USDT |
| **TON** | The Open Network | USDโฎ |
| **Tron** | Tron | USDโฎ |
| **NEAR** | NEAR | USDC ยท USDT |
| **Sui** | Sui | USDC |
| **Aptos** | Aptos | USDC ยท USDT |
| **Algorand** | Algorand | USDC |
| **Stellar** | Stellar | USDC ยท EURC |
| **XRP Ledger** | XRPL | USDC ยท RLUSD |
\*USDC on every EVM chain; USDT on all of them except Base, World Chain, Sei, HyperEVM, and Monad (their "USDT" is USDT0/LayerZero, not Tether-native โ omitted). Any other EVM chain works via a viem `Chain` or `{ id, rpcUrl }` โ no allowlist. Every token address was verified on-chain before shipping.
## โจ Why PipRail
Anything should be able to charge for itself โ an API, a dataset, a model, an agent โ and **anyone** should be able to get paid for it in seconds, without asking a platform for permission. The agent economy will run on millions of tiny, machine-to-machine payments, and that rail should be **open, free, and self-custodial** โ not a toll booth owned by a middleman.
So we built it that way: no backend, no fees, no gatekeeper โ an MIT library that turns any endpoint into a paid one and any agent into a paying customer, on every major chain. The goal is simple and audacious: **make open, self-custodial payments the default rail for the agent economy.**
## โ๏ธ How it works
```
Agent Your server
โ GET /report โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบโ requirePayment
โ โโโโโโโโโโโโโ 402 + payment-required โโโโโ (issues a challenge)
โ pay on-chain (one transfer to payTo) โ
โ โโโโโโโโโโโโโโโโโโโโบ [the chain] โ
โ GET /report + payment-signature โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบโ verifies the tx against
โ โโโโโโโโโโโโโ 200 + your content โโโโโโโโโ its own RPC, then next()
```
Verification is local and confirms the transaction **succeeded, is recent, and actually moved the required amount of the right token to `payTo`**. The x402 v2 spec (ยง7) explicitly endorses merchant-local verification โ no facilitator required โ so this is a spec-compliant shape, not a workaround. **Self-custody throughout:** the payer signs and broadcasts their own transfer straight to your wallet; PipRail never holds funds and never takes a cut.
## ๐ฆ What's in here
```
piprail/
โโโ sdk/ # @piprail/sdk โ the npm package (the product)
โโโ site/ # piprail.com โ the landing site (Astro 5 + Tailwind v4, deploys to Netlify)
โโโ examples/ # runnable merchant + agent demos + a live Anvil end-to-end
โโโ .github/ # CI: build/test checks ยท npm publish on a sdk-v* tag
```
**`@piprail/sdk`** is the product โ and the only thing published to npm. `site/` is the source of [piprail.com](https://piprail.com); `examples/` holds runnable demos. Both live here in the repo but aren't npm packages.
โ Full API & guides: **[sdk/README.md](sdk/README.md)**
No `contracts/`, no server, no database. PipRail is a tool you install, not a platform you sign up for.
## ๐ ๏ธ Quick start
```bash
npm install # install workspace deps
npm run build:sdk # build the SDK
npm run test:sdk # run the SDK test suite
npm run typecheck # typecheck the SDK
npm run dev # run the landing site โ http://localhost:4321
npm run e2e # live end-to-end against a local Anvil chain
```
## ๐ License & trademark
**Code:** [MIT](LICENSE) โ use it, fork it, ship it, commercially or otherwise.
**Name & brand:** **PipRailโข**, the logo, and the `@piprail` npm scope are trademarks of the PipRail project โ MIT covers the *code*, not the *name*. Build on it freely; just don't call a fork "PipRail" or imply it's official. See [TRADEMARK.md](TRADEMARK.md).
Contributions welcome โ see [CONTRIBUTING.md](CONTRIBUTING.md) (a simple DCO sign-off, no CLA).