Skip to content
@RailProtocol

Rail Protocol

Rail Protocol is the unified payment layer for AI agents. It routes payments across the x402 and MPP protocols.
RailProtocol

The payment rail for autonomous AI agents.

x402 and MPP, unified under one API. Every transaction settled on Solana, on-chain, in under 400ms.


Docs X


What is RailProtocol?

AI agents are spending money. They call APIs, rent compute, and pay other agents for services. Two protocols are competing to become the standard for how those payments work: x402 (Coinbase) and MPP (Stripe + Tempo). Services are adopting one, the other, or both.

RailProtocol is the integration layer. It detects which protocol a service requires, handles the full payment handshake, and settles every transaction on Solana with a public transaction hash. One method call. Any protocol. The chain is the ledger.

import { RailProtocol } from "@railprotocol/sdk";

const rail = new RailProtocol({
  agentId: "research-agent",
  apiKey: process.env.RAIL_API_KEY,
});

const result = await rail.pay({
  endpoint: "https://api.dune.com/v1/query/1234/results",
  method: "GET",
});

console.log(result.protocol);    // "x402" | "mpp"  — detected automatically
console.log(result.amountPaid);  // { usdc: 0.002 }
console.log(result.txHash);      // Solana transaction hash
console.log(result.data);        // the actual API response

Repositories

Repo Description
railprotocol/sdk TypeScript SDK
railprotocol/sdk-python Python SDK
railprotocol/cli rail CLI
railprotocol/program Solana on-chain program (Rust + Anchor)
railprotocol/docs Documentation source

Core concepts

Agent wallets. Each agent gets a non-custodial Solana wallet provisioned in one line. Program-derived addresses owned by the agent's keypair. RailProtocol cannot move funds without a signed instruction from the agent.

Spend policies. Daily budget caps, per-call limits, domain allowlists, and rate limits enforced at the gateway before any transaction is submitted. A call that exceeds the daily budget is rejected before funds leave the wallet.

On-chain settlement. Every payment, regardless of protocol, is recorded on Solana with a public transaction hash. The ledger is independently queryable via Solana RPC. No separate reporting layer required.

Multi-agent payment chains. When orchestrating agents delegate to sub-agents, each payment in the chain is linked to the parent transaction on-chain. The full cost of any workflow is traceable from a single root hash.


Getting started

npm install -g @railprotocol/cli
rail auth login
rail wallet create --agent my-agent
rail policies set my-agent --daily-budget 25 --per-call-limit 1.00

Full quickstart: docs.railprotocol.org/getting-started/quickstart


Links

Popular repositories Loading

  1. .github .github Public

    1

  2. docs docs Public

    Rail Protocol Documentation

    1

  3. web-platform web-platform Public

    Rail Protocol Web Platform

    TypeScript 1

  4. program program Public

    Rail Protocol Solana Program

    Rust 1 1

  5. x402 x402 Public

    Forked from x402-foundation/x402

    A payments protocol for the internet. Built on HTTP.

    TypeScript

Repositories

Showing 5 of 5 repositories

Top languages

Loading…

Most used topics

Loading…