Skip to content

feat(x402): attach BlockRun builder-code service code to payments#2

Merged
VickyXAI merged 1 commit into
BlockRunAI:mainfrom
KillerQueen-Z:feat/builder-code-service-code
Jul 5, 2026
Merged

feat(x402): attach BlockRun builder-code service code to payments#2
VickyXAI merged 1 commit into
BlockRunAI:mainfrom
KillerQueen-Z:feat/builder-code-service-code

Conversation

@KillerQueen-Z

Copy link
Copy Markdown
Contributor

What

Tags every x402 payment this SDK signs with the ERC-8021 Schema 2 service code s: ["blockrun"], so payments originated through BlockRun's Go SDK are attributed to BlockRun on-chain.

Reference: CDP Builder Codes

How

  • New helper withBuilderCodeServiceCode() merges s: ["blockrun"] into the payload's builder-code.info, preserving any app code (a) the server echoes back in its 402.
  • Wired into CreatePaymentPayload (x402.go), through which every caller (base_client, image, stream, video, …) already funnels paymentReq.Extensions.
  • Exposed as BlockRunServiceCode for reuse.

Why this is all the client needs

The CBOR / ERC-8021 calldata encoding is done by the CDP facilitator at settlement (it reads builder-code.info.s from the payload). The client only sets a JSON field — no new dependency, no CBOR, works unconditionally on every payment.

Scope

Buyer-side. Consumers such as blockrun-llm-go-vip inherit this automatically. Seller-side app code (a) needs a registered code from dashboard.base.org (tracked separately in BlockRunAI/blockrun#199).

Test

  • Added x402_test.go: service code always attached; server-echoed a preserved.
  • go test ./. green.

Tag every x402 payment this SDK signs with the ERC-8021 Schema 2 service
code s: ["blockrun"] so BlockRun-originated traffic is attributed on-chain.
Merged into builder-code.info.s inside CreatePaymentPayload, preserving any
app code (a) the server echoes back in its 402. Encoding into settlement
calldata is handled by the CDP facilitator; the client only sets the JSON
field, so no new dependency is required.

Docs: https://docs.cdp.coinbase.com/x402/core-concepts/builder-codes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants