An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

PipRail โ€” the payment layer for the agent economy




[![@piprail/sdk](https://img.shields.io/npm/v/@piprail/sdk.svg?logo=npm&label=%40piprail%2Fsdk&color=cb3837)](https://www.npmjs.com/package/@piprail/sdk)
[![@piprail/mcp](https://img.shields.io/npm/v/@piprail/mcp.svg?logo=npm&label=%40piprail%2Fmcp&color=2ee6a6)](https://www.npmjs.com/package/@piprail/mcp)
[![types](https://img.shields.io/npm/types/@piprail/sdk.svg?logo=typescript&logoColor=white&color=3178c6)](https://www.npmjs.com/package/@piprail/sdk)
[![license](https://img.shields.io/github/license/piprail/piprail.svg?color=2ee6a6)](LICENSE)
[![x402 v2](https://img.shields.io/badge/x402-v2-6e56cf.svg)](https://x402.org)
[![chains](https://img.shields.io/badge/chains-28%20across%2010%20families-2ee6a6.svg)](#-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).




PipRail

Built for the agent economy ยท piprail.com