Skip to main content

railgate — payment gate settlement rails (P21)

By TextForAgents LLC · Support: support@textforagents.com · Product page: https://textforagents.com/products/payment-gate-settlement-rails/

A pre-signing payment policy gate for agents that settles on more than one rail. One unmodified policy core (budgets, counterparty allowlists, velocity, intent, replay protection — every decision receipted, every refusal structured) drives swappable settlement adapters behind one interface:

  • EVM / x402 — EIP-3009 exact scheme authorizations via a facilitator.
  • XRPL — Payments whose replay window closes at validation by protocol sequence consumption; LastLedgerSequence is only the expiry ceiling.

A rail oracle picks the rail at decide time against your standing rail declaration (pinned / cheapest / fastest finality / minimum replay exposure, with fee and finality caps). Rail choice is a policy decision and is receipted with the payment. If the settled fee disagrees with the quote that justified the choice, the outcome is flagged QUOTE_MISMATCH.

Operator-side only. Settlement runs through your signer and your funds. This package never custodies funds or keys, and v1 has no hosted or multi-tenant mode. The adapters shipped here are test doubles encoding each rail's published settlement semantics; railgate.live adds a read-only live-testnet path (ServerInfo / AccountInfo) — it never signs or submits.

Install

pip install railgate-1.0.0-py3-none-any.whl   # or from the sdist

Dependencies: x402[evm] (>=2.25,<3, Apache-2.0) and xrpl-py — both are ordinary PyPI dependencies; no third-party code is vendored into this wheel. The vendored EXP-001 policy core is included (policy_gate/) and is byte-identical to the proven originals — verify after install:

cd $(python -c "import policy_gate,os;print(os.path.dirname(policy_gate.__file__))") && sha256sum -c MANIFEST.sha256

Quickstart

import time
from policy_gate import PaymentPolicy, PolicyGate
from railgate import RailGate, RailDeclaration
from railgate.adapters import EvmX402Adapter, XrplTestnetAdapter

clock = time.time
adapters = {}
for cls in (EvmX402Adapter, XrplTestnetAdapter):
    a = cls(clock); adapters[a.rail] = a

policy = PaymentPolicy.from_dict({
    "per_call_cap_atomic": 1_000_000, "session_budget_atomic": 5_000_000,
    "daily_budget_atomic": 20_000_000, "per_counterparty_cap_atomic": 10_000_000,
    "allowed_networks": [a.network for a in adapters.values()],
    "allowed_assets": [a.asset for a in adapters.values()],
    "counterparty_allowlist": [a.pay_to for a in adapters.values()],
    "max_payments_per_window": 30, "window_seconds": 60,
    "replay_window_seconds": 300, "intent_required": True, "asset_decimals": 6,
})
gate = RailGate(PolicyGate(policy, "/tmp/spend.db", clock=clock), adapters)
gate.declare_intent("buy weather data")
out = gate.pay(amount_atomic=100_000,
               resource_url="https://api.example.test/weather",
               declaration=RailDeclaration(mode="cheapest"))
print(out.status, out.rail, out.receipt)   # settled xrpl-testnet {...}

# Live testnet read (read-only; no submission, no funds):
from railgate import xrpl_server_info
print(xrpl_server_info())

Pricing

The adapter package is free (distribution). The hosted policy + rails service is $2 per agent / month flat — no percentage of payment volume, ever; rail fees (e.g. XRPL ~$0.0002/tx) pass through at cost. First month free for the first 10 agents, once per operator. See the product page.

License

MIT for this package's own code (see LICENSE). The x402 dependency is Apache-2.0 — see THIRD-PARTY-NOTICES.md.

Metadata

Release files for railgate 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for railgate 1.0.0
File Size Uploaded
railgate-1.0.0.tar.gz 23.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for railgate 1.0.0
File Interpreter ABI Platform
railgate-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.9 kB

Release files / railgate-1.0.0.tar.gz

Download URL railgate-1.0.0.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0c08fbad2a4ca66758ad0fa8127670882e8acc3dd55cbf896f0d20e9f7bf4965
BLAKE2b-256 checksum
How to use checksums
2d7af5a2de898c1867170f1df25ce811b63a02d33703dc0deccbfdd33c558c0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / railgate-1.0.0-py3-none-any.whl

Download URL railgate-1.0.0-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9696b28fc1988725a60e053b21378633fa859cce8db5e6fc3cc324fb3ad3e23f
BLAKE2b-256 checksum
How to use checksums
150a9dabeab2982dcfc5966701e9f4447ee8036a2b45642bb20b143711718dc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page