My Profile
Published on

Privacy x402: Hiding Payment Data

Introduction

If you've been paying attention to crypto and AI lately, you've probably heard about x402. The protocol is everywhere right now. Privacy is having its moment too. This post combines both.

x402 enables internet-native payments using HTTP 402. Services can charge for API access without accounts, sessions, or payment processors. All payments settle on blockchain. Blockchain is public. Buyer addresses, payment amounts, transaction history, balances. All visible.

This post analyzes x402 blockchain payments and what can be made private. For full protocol details, check the official documentation.

To analyze privacy, we first need to understand the flow.

The x402 Flow

ℹ️

The following diagram and flow are from the official x402 protocol specification.

x402 Protocol Flow

The flow breaks down into six steps:

  1. Client requests resource from server
  2. Server responds with 402 Payment Required and payment requirements
  3. Client creates payment payload and sends request with X-PAYMENT header
  4. Server verifies payment via facilitator's /verify endpoint
  5. Facilitator settles payment on-chain via /settle endpoint
  6. Server returns the requested resource

What Data Gets Exposed

Before Settlement

When the client sends the payment payload, the facilitator receives an EIP-3009 transferWithAuthorization containing:

  • Sender address
  • Recipient address
  • Payment amount
  • Validity window
  • Signature

The facilitator verifies the sender has sufficient balance and the amount matches the server's requirement. All data is visible to this third party.

On-Chain Settlement

Once settled, the transaction is public:

  • Sender address
  • Recipient address
  • Amount
  • Timestamp

Anyone can track who paid whom, how much, and when.

What Can Be Made Private

DataCurrentlyCan Be Private?
Sender addressPublic on-chainYes
Recipient addressPublic on-chainYes
Payment amountPublic on-chainYes
BalancesPublic on-chainYes
Transaction link (who paid whom)TraceableYes
Facilitator sees payment dataYesHarder

Conclusion

Some of these are standard blockchain privacy problems. Hiding addresses and amounts on-chain has known solutions. Stealth addresses, encrypted balances, confidential transactions. The technology exists.

The facilitator is different. It needs to verify payments without seeing the data. This requires computation on encrypted values or zero-knowledge proofs that the payment is valid.

Multiple technologies can help here. FHE allows computation on encrypted data. ZK proofs can verify conditions without revealing inputs. Each comes with tradeoffs

At the end of the day, the system needs to be practical. Theoretical privacy means nothing if verification takes minutes or costs more than the payment itself. The challenge is finding the right balance between privacy and speed.

Future posts in this series will explore how specific technologies apply to these problems.