# x402 trust gate: the pre-serve, pre-pay check

The x402 trust gate is the pre-serve and pre-pay check a seller or facilitator runs around its own HTTP 402 flow. The caller declares its own policy — a minimum KYA level, whether a resource-scan receipt must be on file for the resource being bought, whether the payer's standing must read clear, the identity strength the payer's claim must carry, and an amount ceiling — and the gate composes the records that already exist (the pre-flight record lookup, the standing check, and the ERC-8004 bridge) and evaluates each policy line against those facts. The answer carries the fact record and a pass or fail per policy line; the overall gate answer is exactly the conjunction of the caller's own lines, never a platform finding about the payer. A payer with no records answers with the facts absent and the lines that required them failing closed. When a settlement is presented, the gate outcome for that payment is sealed to the public ledger as an x402.gate receipt a facilitator can attach to its own settlement record. Rightshold's own checks need no payment and no key, and no Rightshold endpoint answers HTTP 402 for them.

The gate reads records that already exist and, for the receipt call, seals the outcome presented to it. It moves no funds, holds no payment, and stores no raw settlement proof: the proof enters the receipt only as a salted commitment, the asset-purchase pattern.

## The gate check

    curl -s -X POST "https://www.rightshold.com/v1/x402/gate-check" -H "content-type: application/json" -d '{"payer":{"rs":"mews"},"resource_url":"https://github.com/anthropics/skills","amount_micro":2500,"policy":{"min_kya_level":"L1","require_scan_receipt":true,"require_standing_clear":true,"require_identity_strength":"asserted","max_amount_micro":10000}}'

The answer carries the composed evidence — the payer's KYA record, the standing answer with its cited ledger facts, the scan-receipt record for the resource, and the ERC-8004 section when an 8004 identity is named (labeled not-a-KYA) — plus one pass or fail per policy line and the overall gate answer, which is exactly the conjunction of the caller's own policy lines over those facts. A payer with no records answers with the facts absent and the lines that required them failing closed; absence is data, not an error.

## The policy is the caller's

```json
{
  "min_kya_level": "L1",
  "require_scan_receipt": true,
  "require_standing_clear": true,
  "require_identity_strength": "proven",
  "require_erc8004_resolved": false,
  "max_amount_micro": 10000
}
```

Every field is optional; a line is evaluated only when the policy declares it. The gate has no policy of its own to substitute.

## Identity strength

Naming an agent proves nothing by itself. A claim is "proven" only when the call carries proof_signature: a signature by the Ed25519 key bound to the named RS record over the gate statement for this exact check (payer, resource, amount). A wallet matching the wallet an ERC-8004 registration file declares is "claim" strength — that file is the agent's own text. Everything else is "asserted". A policy line may require "proven" and fail the rest closed.

## The sealed receipt

After a payment settles, POST /v1/x402/gate-receipts with the same payer, policy and resource plus settlement.proof (an x402 payment payload hash, a transaction hash, or a facilitator reference). One x402.gate entry seals to the public ledger: the policy hash, the inputs hash, the component record references, the amount, the gate outcome, and a salted commitment to the settlement proof — the raw proof is never stored. A failed gate seals too when a settlement is presented. The same proof presented twice answers the existing receipt, never a second seal. Read receipts back:

    curl -s "https://www.rightshold.com/v1/x402/gate-receipts"

Machine form: https://www.rightshold.com/v1/x402/gate-check · https://www.rightshold.com/v1/x402/gate-receipts · MCP x402_gate_check · The records themselves: https://www.rightshold.com/v1/preflight, https://www.rightshold.com/v1/standing/{agent}, https://www.rightshold.com/v1/erc8004/{chain_id}/{agent_id} · Rightshold's own checks need no payment: https://www.rightshold.com/.well-known/x402
