Skip to content

Commit a45f103

Browse files
nirholasclaude
andcommitted
📝 docs: replace ASCII diagram with animated SVG flow chart
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0541ad6 commit a45f103

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,23 @@ Built with [Hono](https://hono.dev), [viem](https://viem.sh), and [Zod](https://
1919

2020
## How It Works
2121

22-
The x402 protocol enables HTTP 402-based micropayments. This facilitator acts as the trusted intermediary that verifies payment signatures and settles them on-chain:
23-
24-
![x402 Protocol Flow](docs/x402-flow.svg)
25-
26-
27-
1. Client requests a paid resource, gets a **402** response with payment requirements
28-
2. Client signs an **EIP-712** `TransferWithAuthorization` ([EIP-3009](https://eips.ethereum.org/EIPS/eip-3009)) message
29-
3. Resource server forwards the signed payment to this facilitator
30-
4. Facilitator **verifies** the signature, checks on-chain state, and calls `transferWithAuthorization` to move USDC
31-
5. Resource server grants access to the content
22+
The x402 protocol enables HTTP 402-based micropayments. This facilitator acts as the trusted intermediary that verifies payment signatures and settles them on-chain.
23+
24+
<p align="center">
25+
<img src="docs/x402-flow.svg" alt="x402 Payment Flow" width="800"/>
26+
</p>
27+
28+
| Step | Action | Description |
29+
|:---:|---|---|
30+
| **1** | `GET /resource` | Client requests a paid resource |
31+
| **2** | `402 Payment Required` | Server responds with payment requirements |
32+
| **3** | EIP-712 signing | Client signs a `TransferWithAuthorization` ([EIP-3009](https://eips.ethereum.org/EIPS/eip-3009)) message |
33+
| **4** | `GET /resource + X-PAYMENT` | Client retries with signed payment header |
34+
| **5** | `POST /settle` | Resource server sends payment to facilitator |
35+
| **6** | `transferWithAuthorization()` | Facilitator verifies signature and settles on-chain |
36+
| **7** | `tx receipt` | Blockchain confirms the USDC transfer |
37+
| **8** | `{ success, txHash }` | Facilitator returns settlement proof |
38+
| **9** | `200 OK + resource` | Resource server grants access |
3239

3340
## Supported Chains
3441

0 commit comments

Comments
 (0)