A verification layer for x402 · Solana

Agents pay only for what was delivered.

An x402 payment settles before the agent sees the answer. Gage holds it on Solana, checks the response, then releases it to the tool or refunds the agent. No account, no trust, one line to change.

Held
—
Checking
—
Settled
—
HOLD 1187 0.0100USDC
CheckingReleased
How it works

The money lands in a vault, not in the tool's pocket.

x402 v2 settles before the resource is returned. Gage keeps that order and changes one thing: where the settlement lands. The verdict decides where it goes next.

01On-chain

Hold

The tool's 402 points payTo at the Gage vault. The agent signs as usual, the facilitator settles as usual. Funds sit in a hold with a slot-based expiry: no verdict, automatic refund.

02Off-chain · 50 ms

Check

The response passes five mechanical tests. Nothing subjective, nothing stored: only hashes of the request, the response and the rule. Anyone can recompute a verdict.

03On-chain

Settle

Pass: the hold is released to the tool. Fail: the hold is refunded to the agent, the tool's stake is slashed and part of it is paid to the agent that was shortchanged. The endpoint's public score moves either way.

The five checks

Cheap to check. Expensive to fake.

A verifier does not judge whether an answer is good. It looks for properties that can be proven in milliseconds and cannot be forged after the fact.

01

Delivered

A 200 with a non-empty body, inside the timeout the tool itself declared in its 402.Fails on empty or late

02

Matches schema

The body validates against the JSON Schema the tool published in the registry.Fails on wrong shape

03

Price as quoted

The amount settled equals the amount announced. No surcharge, no rounding in the tool's favour.Fails on overcharge

04

Not a duplicate

The response hash is compared with recent answers to the same request from the same endpoint.Fails on replay

05

No transaction drift

Mint, recipient and amount in the signed instruction match the 402, byte for byte.Fails on tampered tx

Demo

Break the tool. Watch the money.

A 402 flow against a deliberately fragile endpoint. Pick what the tool sends back and see whether the agent is charged.

Checking for a verifier…

What the tool sends back

On the wire

RequestGET /v1/search?q=solana
402PAYMENT-REQUIRED eyJ4NDAyVmVyc2lvbiI6Miwic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoic29sYW5hOjVleWt0NFVzRnY4UDhOSmRUUkVwWTF2enFLcVpLdmRwIi…
Quoted0.0100 USDC · payTo gage vault · hold 1187
SignaturePAYMENT-SIGNATURE 5f1c9b…a9e2 · ed25519
Settled0.0100 USDC · slot 312 004 981 · 412 ms
Response200 OK · 10 results · 1.2 KB · 184 ms

Verdict

  • Delivered3 mspass
  • Matches schema11 mspass
  • Price as quoted1 mspass
  • Not a duplicate6 mspass
  • No transaction drift2 mspass
Released · 0.0100 USDC to tool

Every check passed in 23 ms. The hold is released and the tool is paid. The verdict hash is written to the registry.

Build

One line on each side.

Gage speaks x402 v2. Agents keep a fetch wrapper, tools keep a middleware. The vault, the registry and the stake live in an open Solana program.

Agent builders

Spend only on answers that pass.

Route payments through Gage and read an endpoint's score before your agent spends a cent. Refunds are automatic, even when we are down: the hold expires on its own.

// pnpm add @gage/agent import { wrapFetchWithGage } from "@gage/agent" const f = wrapFetchWithGage(fetch, { signer, schema, maxAmount: "10000" // 0.01 USDC }) const res = await f("https://tool.example/v1/search?q=…")
Tool providers

Stand behind every response.

Publish your schema, put stake behind your endpoint, and show a verified score in your own 402. Agents choose tools they can hold to account.

// pnpm add @gage/provider import { gagePaid } from "@gage/provider" app.use("/v1/search", gagePaid({ verifier: GAGE_VERIFIER_URL, providerId, amount: "10000", schema: searchSchema }))
Example registry record
api.example.ai/v1/search
Verified calls
41 203
Refunded
2120.51%
Stake
2 500USDC