x402 icon indicating copy to clipboard operation
x402 copied to clipboard

Add gRPC transport specification

Open jackmarsh opened this issue 2 months ago • 2 comments

Description

This PR adds native gRPC transport support to the x402 specification.

The gRPC transport enables x402 payments over native gRPC protocol using metadata for payment signaling and gRPC status codes for error handling. This is distinct from the HTTP transport used with grpc-gateway reverse proxies.

Key Design Decisions:

  • Status Code: Uses RESOURCE_EXHAUSTED (8) to signal payment required, following the precedent set by Google Cloud Platform for billing and quota enforcement. Semantically represents "you have exhausted your quota of free access."

  • Metadata Keys:

    • x402-payment-requirements: Payment requirements (in error message)
    • x402-payment: Payment payload (initial metadata)
    • x402-payment-response: Settlement response (trailing metadata)
  • Data Format: All payment data is base64-encoded JSON, consistent with other x402 transports (HTTP, MCP, A2A).

Use Cases:

  • Service-to-service communication in microservice architectures
  • Native gRPC clients (mobile apps, CLIs, backend services)
  • High-performance scenarios requiring binary protobuf
  • Service mesh environments (Istio, Linkerd, etc.)

Reference Implementation: A complete Go implementation is available at https://github.com/becomeliminal/grpc-gateway-x402

Tests

This PR adds a specification document only. No code changes to test.

The spec follows the same structure and format as the existing HTTP, MCP, and A2A transport specifications.

Checklist

  • [x] I have formatted and linted my code
  • [x] All new and existing tests pass (N/A - spec only)
  • [x] My commits are signed (required for merge)

jackmarsh avatar Oct 26 '25 11:10 jackmarsh

@jackmarsh is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 26 '25 11:10 vercel[bot]

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

cb-heimdall avatar Oct 26 '25 11:10 cb-heimdall