Skip to content

chore: add builder_code.md spec#2034

Closed
0xClouds wants to merge 6 commits intox402-foundation:mainfrom
pk-coinbase:builder_code_spec_clean
Closed

chore: add builder_code.md spec#2034
0xClouds wants to merge 6 commits intox402-foundation:mainfrom
pk-coinbase:builder_code_spec_clean

Conversation

@0xClouds
Copy link
Copy Markdown

Description

Adds the builder-code extension spec for on-chain attribution tracking in x402 payments. This extension appends ERC-8021 Schema 2 (CBOR-encoded) builder codes to settlement transaction calldata, enabling attribution of which application exposed a paid endpoint and which facilitator settled the payment.

The spec covers:

  • ERC-8021 Schema 2 suffix format and CBOR map fields
  • Facilitator-side calldata encoding and verification
  • Resource server offer/receipt field definitions
  • Builder code registration and lookup via on-chain registries

Tests

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits
  • I added a changelog fragment for user-facing changes (docs-only changes can skip)

…ments

Adds a new builder-code extension that enables ERC-8021 Schema 2
attribution tracking for x402 payments. Three parties can attach
their builder code to settlement transactions:

- Agent (client): sets the "a" field via BuilderCodeClientExtension
- Service (server): declares in 402 response via declareBuilderCodeExtension()
- Facilitator: adds to "s" array at settlement via BuilderCodeFacilitatorExtension

At settlement, the facilitator encodes all builder codes as a Schema 2
CBOR suffix and appends it to the transferWithAuthorization calldata.
The EVM ignores trailing calldata bytes, so the transfer executes
normally while indexers (Coindexer, Beacon, Dune) can parse the suffix.

Changes:
- New extension package: @x402/extensions/builder-code
- EVM mechanism: executeTransferWithAuthorization accepts optional calldataSuffix
- settleEIP3009 reads builder code extension from FacilitatorContext
- scheme.ts passes context through to EIP-3009 settlement
…t extension

- Service declares its builder code as "a" (app) — it's the application
  exposing the x402 endpoint
- Facilitator adds its code as "w" (wallet) — it's the entity that signs
  and broadcasts the settlement transaction
- Service can optionally include related on-chain services in "s" array
  (e.g., Morpho, Aerodrome)
- Remove BuilderCodeClientExtension — agent doesn't attach builder codes,
  the service's extension data passes through untouched
- CBOR encoder now handles "a", "w", and "s" fields
feat: ERC-8021 builder code attribution for x402 payments
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

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

A member of the Team first needs to authorize it.

@github-actions github-actions bot added the specs Spec changes or additions label Apr 14, 2026
@CarsonRoscoe CarsonRoscoe self-assigned this Apr 15, 2026
@CarsonRoscoe CarsonRoscoe self-requested a review April 15, 2026 04:12
@phdargen phdargen self-assigned this Apr 15, 2026
Comment thread specs/extensions/builder_code.md Outdated
CarsonRoscoe
CarsonRoscoe previously approved these changes Apr 16, 2026
@0xClouds 0xClouds force-pushed the builder_code_spec_clean branch from 954d493 to f1c4ba6 Compare April 16, 2026 17:07
@github-actions github-actions bot added typescript sdk Changes to core v2 packages labels Apr 16, 2026
@0xClouds 0xClouds closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sdk Changes to core v2 packages specs Spec changes or additions typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants