Skip to content

Repository files navigation

Private X402 Gateway

Private API consumption using x402 payments, Privacy Pass tokens, and OHTTP relay. No entity can link payments to API usage or client identity.

Quick Start

npm install && npm run build && npm run services:up && npm link -w packages/cli
private-pay gen-payment-key
private-pay fund-account
private-pay request http://localhost:3001/api/weather --auto-purchase

CLI

Command Description
request <url> Private OHTTP request; use --auto-purchase to buy tokens on 402
buy-tokens Purchase 1000 tokens explicitly
balance Show remaining token count
clear-tokens Delete all stored tokens
gen-payment-key Generate Solana keypair at ~/.ppg/payment-key.json
fund-account Airdrop SOL on devnet to the payment key

Global flags: --facilitator <url>, --relay <url>.

Services (Docker)

Port Service Role
3000 relay OHTTP proxy, hides client IP
3001 gateway Token verification, API access
3002 facilitator Payment settlement, token issuance

How It Works

See docs/architecture.md for the protocol design, PlantUML diagram, and privacy analysis. See docs/development.md for testing and development.

About

An X402 facilitator and API gateway that utilize OHTTP and Privacy Pass protocol to access an API service autonomously and anonymously

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages