RailguardRailguard

How it works

A checkpoint between your agent and your money.

Railguard sits between agent intent and your signer. It decides before anything is signed, watches what happens after, and leaves a receipt. It never takes custody.

Your agent→Railguard: check · reserve · watch · prove→Your wallet or bank API→Chain or bank

The seven steps of every payment

1Intent
The agent says what it wants to pay: who, how much, which coin, for what task.
2Authorize
Your rules decide: allowed recipients, budgets, whether a person must approve.
3Reserve
The money is set aside first, so two agents cannot spend the same budget.
4Execute
Your own wallet or provider signs and sends. Railguard never holds keys.
5Observe
Railguard watches the chain or bank API. A lost answer is UNKNOWN, not failed.
6Reconcile
What the chain shows is matched to the intent. Any difference is flagged.
7Evidence
A hash-chained receipt records every step, so anyone can re-check it.

Words used on this site

Intent
What the agent wants to pay: who, how much, which coin.
Policy
Your rules: budgets, allowed recipients, approvals.
Reserve
Money set aside before sending, so it cannot be spent twice.
UNKNOWN
Sent, but no answer yet. Railguard checks instead of guessing.
Confirmed
The chain shows the payment matched the intent (settlement verified).
Receipt
A tamper-evident record of every step that you can re-check.
Mandate
An on-chain spending limit for one agent (used on Metal).
x402
A way for agents to pay for an API call over HTTP, per request.
Soroban
Stellar's smart contract platform, used for the on-chain policy.
Testnet
A practice blockchain: fake money, real code paths.

Run it yourself

Needs Bun. Lines starting with $ go in a terminal.

1. Install and attack

Clone the repo, then run the six failure tests locally.

$ git clone https://github.com/prasanthkuna/railguard-gateway.git
$ cd railguard-gateway && bun install
$ bun run railguard attack
$ bun run railguard protect

2. Re-check the public proofs

Verifies the committed evidence for each chain.

$ bun run verify-arbitrum-sepolia-pack
$ bun run verify-stellar-testnet-pack
$ bun run verify-monad-metropolis-pack

3. Give your agent Railguard tools (MCP)

Paste into your Cursor or Claude Desktop MCP config, not a terminal.

{
  "mcpServers": {
    "railguard": {
      "command": "bun",
      "args": ["run", "packages/mcp/src/server.ts"],
      "env": {
        "RAILGUARD_BASE_URL": "http://127.0.0.1:4000",
        "RAILGUARD_ACCESS_TOKEN": "<your-token>"
      }
    }
  }
}

4. Call it from code

TypeScript SDK over the REST API (/v1/*).

import { RailguardClient, check } from "@railguard/sdk"

const rg = new RailguardClient({ baseUrl, getAuthHeaders })
const result = await check(rg, intent)
if (result.decision === "ALLOW") await rg.execute(result.intent.id)

How it is kept honest