Tollway

Getting started

Install the workspace and run the x402 demo

Prerequisites

Node 22 or later and pnpm 10 or later.

Install and verify

git clone https://github.com/vegaforge/tollway.git
cd tollway
pnpm install
pnpm build
pnpm test

Run the demo

The demo drives one paid x402 request from challenge to signed receipt, with no network needed:

MOCK_MODE=true pnpm --filter @tollway/demo start

Mock mode is the only demo path that works today. Without MOCK_MODE, the demo calls the mainnet OpenZeppelin facilitator URL, sends no API key, and uses placeholder addresses, so a real testnet run fails. Fixing those defaults is tracked in #113.

What is built today

Tollway is pre-release and no package is published to npm yet.

Implemented and tested:

  • @tollway/core: the canonical receipt with an Ed25519 signer, the policy and budget engine, and the default model router.
  • @tollway/server: the payment gate for x402 and MPP charge, an HTTP facilitator client, a mock facilitator and MPP charge handler, and in-memory and Redis settlement caches.
  • The Express, Fastify, Next.js, and Hono adapters.
  • @tollway/client orchestration (policy, routing, receipt verification). You supply the payment signer.
  • @tollway/channels open, commit, and close against an injected channel adapter.
  • @tollway/reconcile drift detection and @tollway/observability metrics, exports, and webhooks.

Still open, each with a tracking issue:

  • Real MPP charge settlement (#100) and a real MPP channel adapter (#101).
  • Channel recovery (#38) and router promotion to channel mode (#105).
  • x402 V2 wire compatibility (#43) and a production x402 client signer (#102).

The README's Status section has the full list.

On this page