x402 Builder Codes: The Spec's Own Example Credits Nobody
x402's builder-code extension writes, into the settlement calldata, which app served a paid call. The spec's own example puts the app code where no shipped facilitator looks. A client built from the spec pays, gets its 200, and the app is credited with nothing.
The gap was reported on Sunday as issue #4511, with two Base mainnet transactions as evidence. A fix, PR #4523, was opened this morning and is not merged. We reproduced it in the published TypeScript and Python packages and ran a 14-case echo-shape matrix against the release and the PR. Then we decoded every ERC-8021 suffix on two hours of Base USDC settlements to see who actually gets credited.
The short version: the bug is real, the flat echo it punishes is rare in the wild, and the bigger story is what the measurement shows about the attribution layer itself. Who writes it, who signs it (nobody), and how little of it names an app.
We last looked at builder-code as one line in our map of the x402 extensions layer. This is the full read.
What a builder code is
ERC-8021, "Transaction Attribution", defines a suffix appended to the end of transaction calldata. Contracts ignore the trailing bytes, and offchain indexers parse them. The suffix ends with a fixed 16-byte marker, 0x8021 repeated eight times. Before the marker sits one byte with a schema id, and before that the schema data. The ERC is still a Draft. Its pull request in ethereum/ERCs has been open since 2025-09-11, last updated on 2026-11-19, and eips.ethereum.org returns 404 for it.
Schema 0 is a comma-separated list of ASCII codes with a one-byte length. Schema 2, the one x402 uses, is a CBOR map with a two-byte length. Its reserved keys are a (application), w (wallet), s (service codes), r (custom registries) and m (metadata).
Base runs the program the codes come from. Its Builder Codes overview is explicit about the current state:
"Use Builder Codes for attribution and analytics only. Don't build payouts, revenue splits or other app logic on the onchain Builder Codes registry. Minting codes onchain is currently paused, so your code may not be registered onchain. [...] Payout addresses aren't set for any code, minted or not."
The same page lists rewards as a benefit "as the program expands", and leaderboards and Base App discovery as visibility surfaces. There is also an agent path: POST https://api.base.dev/v1/agents/builder-codes with a wallet address, documented as "No authentication required", returns a code. So today a builder code buys analytics and visibility, and possibly rewards later. That is enough for sellers to want it right, and for it to be worth gaming.
Who writes which field
The x402 extension, builder_code.md, splits the map across three parties:
ais the seller's app code. The seller declares it inPaymentRequired.extensions["builder-code"].info.a, and the client echoes it back.sholds service codes. The client may add up to five, the server up to five, the facilitator one.wis the facilitator's own code, andmis facilitator-written settlement metadata.
The facilitator encodes the map, appends the suffix to the settlement transaction, and broadcasts. Two facts follow from that, and both matter more than the shape bug.
First, the payer signs none of it. An EIP-3009 authorization commits to from, to, value, validAfter, validBefore and nonce. The suffix is bytes the facilitator adds after the signed call. ERC-8021's own security section says attribution data "could potentially be modified by intermediaries".
Second, the facilitator never sees the seller's declaration. The settle call carries the payment payload and the selected requirements, not the 402's top-level extensions. So the facilitator writes whatever a arrives. In August, issue #3299 showed a client could forge a because of this. The fix moved the check to the resource server in all three SDKs (TypeScript #3313 on 2026-08-31, Go #3302 and Python #3320 days later). The resource server is now the only gate on a, and it skips v1 payloads. The facilitator compensates by dropping a on v1.
Two shapes for one field
Here is the PaymentPayload example in the spec, unchanged in this respect since the first version merged on 2026-05-04 (#2050):
{ "extensions": { "builder-code": { "a": "my_app", "s": "my_client" } } }
The spec's "App Code Echo Validation" paragraph reads the flat form too: PaymentPayload.extensions["builder-code"].a. Here is what every facilitator in the repository reads:
// typescript/packages/extensions/src/builder-code/facilitator.ts
const info = (extensions?.[BUILDER_CODE] as { info?: unknown } | undefined)?.info;
if (typeof info !== "object" || info === null || Array.isArray(info)) return undefined;
Go does the same with ext["info"].(map[string]interface{}), and Python with ext.get("info"). The three reference clients write {"info": {...}}, so the SDKs agree with each other. The spec is the odd one out.
The resource server, though, reads both. Its getExtensionInfo returns value.info when an info key exists and the object itself otherwise. So a flat echo passes the server's check and is then ignored by the facilitator. Both halves are in the same SDK, one directory apart.
We re-read the issue's two transactions from Base ourselves. Same facilitator, same seller code, one field of difference in the echo:
The issue's two settlements, decoded
0xd4ec3428…, block 63,774,142, flat echo: 325 bytes of calldata, a 33-byte suffix decoding to {"w":"cdp_facil1"}. Gas used: 86,230.
0x89ba27b1…, block 63,774,371, wrapped echo: 339 bytes, a 47-byte suffix decoding to {"a":"bc_jgmqvzhk","w":"cdp_facil1"}. Gas used: 86,474.
Both are plain transferWithAuthorization calls to Base USDC with status 1. The 292-byte call is identical in form, and the app code is the only thing missing.
The matrix: 14 echoes, three outcomes each
We installed @x402/core, @x402/evm and @x402/extensions 2.32.0 from npm, published 2026-11-20. The seller declares a = "bc_seller" with the SDK's own declareBuilderCodeExtension, and the facilitator runs BuilderCodeFacilitatorExtension with w = "bc_fac". For each payload we recorded the resource server's validateExtensions verdict, the suffix the 2.32.0 facilitator builds, and the suffix PR #4523's facilitator source builds from the same input. The suffixes are decoded with the package's own parseBuilderCodeSuffixFromCalldata.
Seller declares a builder code
Reference client, with or without BuilderCodeClientExtension: gate passes, suffix {a, w} plus the client's s. Same on the PR.
Spec example, flat {a, s}: gate passes. 2.32.0 writes {"w":"bc_fac"}, losing both the app and the client's service code. The PR writes {a, w, s}. The spec's layered example with an s array behaves the same.
No builder-code in the payload at all: gate passes, suffix {w}. Echoing a flat {s} without a is rejected with extension_echo_mismatch, but omitting the extension entirely is accepted.
Forged a, flat or wrapped: gate rejects both. Behind the gate, 2.32.0 would write a forged wrapped a, and the PR would also write a forged flat one.
info: null beside a flat a: rejected, and neither facilitator writes a. A conflicting flat a beside a valid info.a passes, and both write the info value.
Seller does not declare one
Spec example {s}: gate passes, 2.32.0 writes {w}, the PR writes {w, s}. The client's own attribution is the casualty here.
Wrapped {info: {s}}: {w, s} on both.
Forged flat a: rejected by the gate.
Python 2.29.0 from PyPI gives the same split on the decisive case: wrapped → {a, w, s}, flat → {w}. We read Go's extractor but did not run it.
Three things in the matrix are worth more than the headline bug.
The seller cannot require attribution. A payload with no builder-code extension passes the gate and settles with no a. That is by design: extensions are optional. But it means a is something the buyer grants, not something the seller gets. A buyer that wants to deny a seller its credit only has to not echo.
PR #4523 is the right fix, and it widens one thing. Accepting the flat shape makes the documented client work, and the PR keeps the server's key-present rule, so info: null beside a flat a still writes no a. But behind a resource server that skips the gate, a forged flat a now reaches calldata, where before only a forged wrapped one did. That is not a new class of hole, since the wrapped forgery already worked there. It is one more spelling of it, and it is a reason for facilitators to stop trusting that every caller ran the gate.
The reference client echoes the seller's JSON Schema. The core client merges the server's entire declaration into the payload, schema included. We measured the base64 PAYMENT-SIGNATURE header: 1,028 bytes with no builder-code, 1,700 with the reference client and a declared code, and 1,128 for the same wrapped echo without the schema. The gate passes without the schema. So 572 bytes of every paid request carry a copy of a schema the gate does not need and the SDK's facilitator extension never reads. The spec says facilitators should validate info against it, but a schema supplied by the same payload it validates proves little. That matters for the header budgets in our browser and header-size audit, where aiohttp's limit was 8,190 bytes.
What the chain says
The matrix shows what can go wrong. The chain shows what does. We pulled every AuthorizationUsed log from Base USDC over 36,000 blocks, 64,159,974 to 64,195,973. That is two hours, 07:06 to 09:06 UTC on 2026-11-30, at Base's 200 ms block time. We fetched each transaction's calldata and parsed any ERC-8021 suffix with the ERC's algorithm. This counts every EIP-3009 settlement on Base USDC, not only x402. We labelled senders with the signer lists that facilitators publish on /supported, plus the addresses that wrote w = "cdp_facil1".
22,687 settlements, two hours, Base USDC
18,697 transactions (82.4%) end in an ERC-8021 suffix: 18,678 Schema 2 and 19 Schema 0. Every suffix parsed cleanly.
CDP (w = "cdp_facil1", 20 sender addresses) settled 18,206 transactions, 80.2% of everything, and suffixed all of them. 12,223 (67.1%) carry an a. Median payment $0.0185, total $413.81, of which $206.27 carries an app code.
One unnamed operator (w = "bc_vfsiic9b", one sender) settled 403, every one with the same a.
PayAI settled 69 through Multicall3 aggregate3, all with w = "bc_kxo8ybca" and no a.
Ultravioleta DAO settled 268 with no suffix. Its /supported does not list builder-code.
No other key appears: zero m, zero r. Only 66 CDP settlements carry an s, 28 of them cdp_sdk_client.
Then the question #4511 raises: how often does a seller declare a code and lose it? The chain cannot see the 402, but it can see consistency. A seller that declares a code should get a on every CDP settlement, unless a buyer omits it or echoes it flat.
Attribution per seller is all or nothing
CDP paid 215 distinct payees in the window. 123 got an a on every settlement. 91 never got one. Exactly one payee was mixed: five of six settlements carried bc_b4aw4uzd, one did not, from a different payer.
So across 12,224 settlements to sellers that were credited at least once, one went uncredited. Of the 5,983 CDP settlements without an a, 5,982 went to payees that received no app code on any settlement in the window.
That single mixed settlement could be a flat echo or a buyer that does not echo at all; the chain does not say which. Either way, the flat shape is not costing sellers much today, which fits a paying population that writes the info shape almost without exception. The bug bites the next client written from the spec, not the current population.
What the census does show is concentration. Sixteen distinct app codes appear. One, bc_tyhmcm97, is on 10,573 settlements, 83.7% of all app-attributed ones, all to a single payee from 313 payers. Another, bc_ql9lhia3, spans 109 payees on 223 settlements, which reads as a platform code covering many sellers. Twelve of the sixteen app codes are minted in Base's registry at 0x000000BC7E6457e610fe52Dcc0ca5b3ce59C8E80. Neither CDP's cdp_facil1 nor PayAI's bc_kxo8ybca is minted, which fits Base's note that minting is paused and attribution does not depend on it.
One more pattern. The largest single sender in the window, with 2,519 transactions to one payee at a median of $0.001, does not call USDC directly. It calls a 133-byte proxy contract with the bytes-signature selector 0xcf092995 and never writes a suffix. We could not tie it to a published facilitator signer. Direct calls to USDC's bytes-signature transferWithAuthorization, the form that ERC-1271 smart-wallet signatures use, number 407, and 30 of them carry a suffix.
What the catalog adds
The chain shows the suffix. CDP's Bazaar catalog shows the echo. Per x402's Bazaar documentation, a facilitator catalogs a resource from the extensions in a settled PaymentPayload, and PR #4508 measured that each CDP row is a snapshot of the last settled echo. We covered that refresh behaviour in our Bazaar dynamic-routes census. Here it lets us read what buyers actually put in the payload.
CDP Bazaar, fetched 2026-11-30 09:25 UTC
90,748 resources on 3,511 hosts. 3,797 resources (4.2%) on 227 hosts carry a builder-code object, with 98 distinct app codes.
Shapes: 3,752 are {info, schema}, the reference client's echo with the schema attached. 40 are {info} alone. Zero are the spec's flat object.
Two other dialects exist. Five resources on one host carry {"code": "bc_…"}. Forty-two on two hosts carry {"info": {"required": false}} with a schema of their own. Neither contains an a that the release or the PR would read.
The top on-chain code, bc_tyhmcm97, appears on two hosts: ax1-new.vercel.app and console.ax1.vc.
Then we joined the catalog to the census. Of the 91 payees CDP never credited in the window, 69 appear in the catalog. Two of them have catalog rows that carry an a: api.bitrefill.com, where 7 of 8 resources declare one, and the payee behind glyphcall.com, where all 785 resources on four hosts do. They received six CDP settlements in the window with no a, and the latter's four all came from a single payer.
Add the one mixed payee and the count of settlements where a seller with a visible code went uncredited is seven, from four payers, out of 12,230 settlements to those sellers. We cannot tell whether those buyers echoed flat or did not echo at all. Either way, that is the shape of the problem today: a handful of buyers whose payloads did not carry the code, invisible in every API response.
One check we could not close: 388 catalog rows carry a server-side s: ["cdp_sdk_server"], but none of their payees was paid in our window, so we could not see whether that code reaches calldata.
What it means for LLM4Agents
Our gateway is a seller. Its 402 today declares no extensions at all: we probed api.llm4agents.com/v1/chat/completions this morning and the decoded PAYMENT-REQUIRED carries accepts and nothing else. Our production settlement path uses the CDP facilitator. So a paid call to us would settle with {"w":"cdp_facil1"} and no app code, the same as the 91 never-attributed payees above. To Base's leaderboards and to anyone indexing ERC-8021, agent traffic through LLM4Agents would count as CDP's traffic and nobody else's.
That is a visibility cost, not a revenue one, as long as Base's program stays analytics-only. But the trust model is the part to internalize before building on it. The a in calldata is a claim the seller made, a buyer chose to echo, and a facilitator chose to write. None of it is signed by the payer. The facilitator cannot check it, and the seller cannot require it. As an attribution signal it is useful. As an accounting record it is not, and Base says the same about its own registry.
The schema echo is a small cost we would pay too. Every agent paying us through a stock client would carry 572 bytes of JSON Schema in its payment header, on every call, once we declare a code.
There is one opportunity. LLM4Agents also sits on the buyer side when agents pay other x402 services through our infrastructure. The client-side s field exists for exactly that, and today it is almost empty: 66 of 18,206 CDP settlements. A service code there costs a few bytes and makes the routing layer measurable on chain.
Staying on the frontier
In order:
- Get a code and declare it, wrapped. Register a Base builder code for the gateway's project, then declare it with
declareBuilderCodeExtensionfrom@x402/extensions. That means moving the gateway's x402 packages from the 2.11 line to the current 2.32.x first. Never hand-write the flat shape from the spec until #4523 or a spec correction lands. - Verify on chain, not in logs. After the first paid call, decode our own settlement's calldata and assert the suffix carries our
a. Every API surface returns success either way; the calldata is the only place this bug is visible. A 30-line decoder does it, and we will run it as a post-deploy check. - Strip the schema from echoes we generate. Wherever we build payment payloads ourselves, echo
{"info": {...}}and dropschema. The gate passes without it, and the header gets 572 bytes lighter. - Add an
scode on the buyer side. When agents pay third-party x402 services through us, attach our service code, capped at the client's five. It is the only field a client owns. - Keep attribution out of money paths. No revenue share, rebate or rate tier keyed on
a,wors. The suffix is unsigned and facilitator-authored, and the registry has no payout addresses. - Track #4511, #4523 and ERC-8021's status. If the spec converges on
infoinstead of accepting both shapes, nothing changes for SDK users. If a facilitator starts writingm, we read it before trusting it.
Builder codes are the first place x402 writes something about the purchase into the chain itself, beyond the transfer. They deserve the same discipline as the transfer: one documented shape, a check you can run on the transaction, and no assumption that someone upstream got it right. Our audit of the three SDKs' error vocabularies found the same pattern: three implementations that agree with each other and not with the text.
Pay per call, from an agent, in USDC
LLM4Agents is an OpenAI-compatible gateway that agents pay over x402. No accounts, no API keys to rotate.
Register an agent