x402 Payment Protocol + USDT on TON Blockchain (gasless W5 wallet)
x402-ton-poc is an early-stage TypeScript project in the AI payments / x402 ecosystem. It currently has 1 GitHub stars and 0 forks.
Proof-of-concept: paid HTTP API accepting USDT on TON via x402 protocol, built with the official @x402/tvm SDK.
On-chain proof: 5 successful mainnet payments
// === TON ===
import { paymentMiddleware, x402ResourceServer } from "@x402/express";
import { ExactTvmScheme } from "@x402/tvm/exact/server";
import { HTTPFacilitatorClient } from "@x402/core/server";
const server = new x402ResourceServer(new HTTPFacilitatorClient({ url: FACILITATOR_URL }))
.register("tvm:-239", new ExactTvmScheme());
app.use(paymentMiddleware({
"GET /api/data": {
accepts: [{ scheme: "exact", price: "$0.01", network: "tvm:-239",
payTo: "0:abc...", extra: { facilitatorUrl: FACILITATOR_URL } }],
},
}, server));
// === EVM (for comparison) ===
const server = new x402ResourceServer(facilitatorClient)
.register("eip155:8453", new ExactEvmScheme());
app.use(paymentMiddleware({
"GET /api/data": {
accepts: [{ scheme: "exact", price: "$0.01", network: "eip155:8453", payTo: "0xabc..." }],
},
}, server));
Same paymentMiddleware, same x402ResourceServer, same price: "$0.01". The only difference is the network ID and scheme.
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { ExactTvmScheme } from "@x402/tvm/exact/client";
import { toClientTvmSigner } from "@x402/tvm";
const signer = toClientTvmSigner(keyPair);
const client = new x402Client().register("tvm:*", new ExactTvmScheme(signer));
const fetchWithPayment = wrapFetchWithPayment(fetch, client);
// Just use fetch — payment is automatic
const response = await fetchWithPayment("https://api.example.com/paid-data");
git clone https://github.com/ohld/x402-ton-poc.git
cd x402-ton-poc && npm install
cp .env.example .env
# Set TON_PAYEE_ADDRESS (your wallet, raw format 0:hex...)
# Terminal 1: server
npm run dev
# Terminal 2: client (needs TON_WALLET_MNEMONIC with USDT)
npm run client
src/
├── server.ts — Express server with payment wall (merchant)
└── client.ts — CLI client that pays and gets data (buyer)
Client Server Facilitator TON
|--- GET /data ---->| | |
|<-- 402 + reqs ----| | |
| [SDK: /prepare] ----------------------->| |
| [SDK: sign] | | |
|--- GET /data + X-PAYMENT header -------->| |
| |--- /verify --------->| |
| |--- /settle --------->|--- relay + gas ----->|
| |<-- tx_hash ----------|<-- confirmed --------|
|<-- 200 + data ----| | |
Client and server make zero blockchain calls. The SDK + facilitator handle seqno lookup, signing, gas sponsorship, and on-chain relay.
The agent-native LLM router for autonomous agents. 55+ models (8 free), <1ms local routing, USDC payments on Base & Solana via x402.
A payments protocol for the internet. Built on HTTP.
A local-first AI agent with persistent memory, emotional intelligence, and a peer-to-peer skills economy.
The trust layer for agent-to-agent commerce — natural-language mandates, ERC-7710 delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all Agent Skill / Claude Code plugin.
Self-healing infrastructure for AI agent payments. 90.3% auto-recovery.
The AI agent with a wallet — spends USDC autonomously to get real work done. Apache-2.0, TypeScript.