Interactive front end for the Lean model in Poc/X402.lean · HTTP 402 → payment header → paid content
Honesty banner — read first
Shape-check stub only. This is an interactive front end for the Lean model in Poc/X402.lean. The Lean binary is the source of truth; the JavaScript on this page mirrors its messages but is not verified.
Settlement here is a SHAPE-CHECK STUB — no signature is verified, and nothing is checked or settled on-chain. The payTo address (DemoWa11et111111111111111111111111111111) is a labeled demo placeholder, NOT a real wallet — never send funds to it. Nothing on this page touches a wallet or any network.
Step 1 — Request
The client requests the paid resource with no payment header:
GET http://127.0.0.1:8402/paid/report
(no X-PAYMENT header)
The server cannot serve paid content yet — it answers with a payment challenge. Continue to Step 2.
Step 2 — HTTP 402 Challenge
HTTP 402 Payment Required
Exact challenge JSON from the Lean demo:
Step 3 — Build payment
Payload JSON built from accepts[0] (exact string, key order matters):
X-PAYMENT header — base64 of the payload above:
Header length: chars (expected 428 with the correct defaults).
Step 4 — Retry + verify (stub)
The client retries GET http://127.0.0.1:8402/paid/report with the X-PAYMENT header. The server runs a JS shape-check mirroring the Lean validator, in order:
base64 decodes
x402Version == 1
scheme == "exact"
network == requirements.network ("solana")
payload.signature present and non-empty
Not run yet. Click “Run shape-check (stub)”.
Step 5 — Paid content
Locked: Step 4 must ACCEPT first. Run the shape-check in Step 4 — if it rejects (for example after tampering), no content is served.
HTTP 200 Paid content served (stub settlement)
Decoded X-PAYMENT-RESPONSE:
Source of truth: Poc/X402.lean in this repository. This page works from file:// — no frameworks, no CDN, no external assets, no network calls.