x402: HTTP 402를 실제 결제 프리미티브로 전환하기
Source: Dev.to
Protocol Overview
Request Flow
-
Client (human or agent) requests a resource.
-
Server responds with HTTP 402 plus payment metadata:
token amount chain destination address -
The client signs a permit‑style authorization using
transferWithAuthorization(EIP‑3009). -
A facilitator verifies the authorization off‑chain and settles it on‑chain.
-
Once settlement is confirmed, the server returns the requested resource.
From the client’s perspective, this feels like a normal API call.
Benefits
- Micropayments become viable – low‑value, high‑volume transactions are affordable.
- Stateless by design – no need for persistent sessions or account management on the server side.
- Web‑native integration – payment data travels in standard HTTP headers.
- Machine‑friendly payments – agents can automate payment, verification, and execution.
Agent Ecosystem
The real unlock isn’t just charging humans; it’s enabling autonomous economic activity. An agent can:
- Pay an API for data.
- Pay another agent to process that data.
- Pay a compute service to run a job.
All of these actions can be performed conditionally and programmatically, allowing composable workflows that traditional payment rails cannot support efficiently.
Complementary Primitives
- ERC‑8004 – on‑chain registries for agent identity, reputation, and validation.
- ROFL – verifiable execution inside Trusted Execution Environments (TEEs), with enclave‑generated keys and cryptographic attestations.
Together:
- x402 moves money.
- ERC‑8004 enables discovery and coordination.
- ROFL provides execution integrity and confidentiality.
Facilitators can also run inside ROFL, making the payment layer auditable and resistant to censorship.
Early Demos
- Pay‑per‑inference services – users pay cents per request.
- Multi‑model AI pipelines – cross‑validation with on‑chain settlement.
- Document processing APIs – verifiable execution with usage‑based pricing.
In each case, pricing tracks actual usage instead of relying on subscriptions.
Conclusion
x402 doesn’t try to reinvent payments; it makes them composable with the web itself. By aligning HTTP semantics with on‑chain settlement, it opens the door to pricing models and agent workflows that were previously impractical. Combined with verifiable execution and standardized agent discovery, it points toward a more granular, automated, and open internet economy.