x402 upto without Permit2: the EIP-3009 proxy that pulls the maximum and refunds the rest
The x402 upto scheme lets a buyer sign a ceiling and a seller charge less. On EVM it has been Permit2-only, because EIP-3009 needs an exact amount at signing time. An open proposal removes that limit with a proxy contract that pulls the whole ceiling and sends back the unused part. We ran it against real USDC.
Last week we wrote about upto on XRPL. In July we covered the original EVM design in upto and Permit2. That post said the scheme's EVM path needed a one-time Permit2 approval from the buyer, and that EIP-3009 could not serve it. On x402-foundation/x402 main the spec still says so: "EIP-3009 (transferWithAuthorization) is not supported for the upto scheme because it requires exact amounts at signature time."
That sentence is about to become false, if a pull request lands. We read the proposal, read the SDK draft behind it, and drove the proxy against USDC on a Base mainnet fork. Every number below comes from that harness or from the files named, with dates.
What is on the table
There are two open pull requests, both by the same author.
- #3867, opened 2026-10-21 on the foundation repository: the
x402UptoERC3009Proxycontract, its tests, a CREATE2 deploy script, and a rewrite ofscheme_upto_evm.md. The description carries a warning: the contract "has not been audited, and its deployment address is not final." Review status on 2026-11-08 is still "review required". - #423, opened 2026-11-02 on
coinbase/x402, a repository that mirrors the foundation's main (its history has "sync upstream main" commits). It adds the client, server and facilitator support in TypeScript, Go and Python. Its description calls it "a draft of the implementation ... used for testing the contract/flow before queueing up the audit."
Neither has shipped. We unpacked @x402/[email protected], published 2026-11-04, and found no reference to the new proxy. The proposed address, 0x40203Fa5…0006, has no code on Base, Ethereum or Optimism as of today. The existing Permit2 upto proxy at 0x4020A4f3…0002 has 3,142 bytes of code on all three.
So this is a design review, not a rollout report. That is the right time to read it.
Why EIP-3009 could not do upto
An EIP-3009 authorization signs a fixed value and a fixed to. The token moves exactly that value, no less. For a metered call the seller does not know the final charge when the buyer signs.
Permit2 solves it by signing a ceiling and letting the proxy transfer any amount up to it. The cost is the one-time approval of Permit2 as a spender, which the spec handles with three routes (direct approve, sponsored approve, EIP-2612 permit). Our July post spent most of its length on those routes.
The new design takes a different route. The buyer signs an authorization for the full maximum, addressed to a proxy contract, not to the seller. The proxy receives the maximum, pays the metered amount to the seller and returns the rest to the buyer, all in one transaction. No approval is needed, because EIP-3009 is the token's own authorization primitive.
The nonce is a commitment
EIP-3009 has no witness field. Permit2 can bind the recipient and the facilitator inside a typed-data struct. EIP-3009 gives you from, to, value, two timestamps and a 32-byte nonce. The nonce is the only free field.
The proposal puts a hash in it:
// x402UptoERC3009Proxy.sol (#3867 @ 9b8bfa5)
NONCE_TYPEHASH = keccak256("x402UptoERC3009Nonce(address payTo,address settler,bytes32 salt)");
nonce = keccak256(abi.encode(NONCE_TYPEHASH, payTo, settler, salt));
The client sends the preimage, paymentInfo, next to the signed authorization. The proxy recomputes the hash and reverts with InvalidNonce on a mismatch. We checked that the typehash constant in the TypeScript draft equals the keccak of that string: it does, 0x792d454a…f03e.
The binding is split across three places:
| What is bound | Where |
|---|---|
| Maximum amount | value in the EIP-712 signature |
| Proxy as receiver | to in the signature |
| Token and chain | The token's EIP-712 domain |
Recipient (payTo) | Nonce commitment |
| Who may settle | Nonce commitment (settler) |
| Uniqueness | Nonce commitment (salt) plus the token's used-nonce map |
One thing is not bound at all: the charge. The settler picks any non-zero amount up to the maximum. That is the existing upto trust model, and the pull request says so in its notes. It is also why the cap, not the price, is what the buyer actually signs.
Receive, not transfer
The spec forbids transferWithAuthorization for this flow, and the proxy calls receiveWithAuthorization. The reason is front-running. A transferWithAuthorization signature can be submitted by anyone straight to the token. If the buyer's signature named the proxy as recipient, a third party could move the buyer's funds into the proxy without running the pay-and-refund logic. The money would sit there.
receiveWithAuthorization requires the caller to be the to address. Only the proxy, executing its own code, can use the signature.
We tested this on a fork of Base at block 54,691,246, with a fresh payer key and USDC balances written into storage. The results:
# Base mainnet fork, USDC (impl v2), proxy from #3867 @ 9b8bfa5, 2026-11-08
receive-signature replayed as transferWithAuthorization REVERT
receiveWithAuthorization called directly by a third party REVERT
settle() from an address that is not the bound settler UnauthorizedSettler
settle() with payTo swapped to another address InvalidNonce
settle(amount = 0) InvalidAmount
settle(amount = max + 1) AmountExceedsAuthorization
settle(1,000) after the failed attempts ok
second settle() of the same authorization REVERT
The design does what the notes claim. The first row matters most: USDC's typehash for ReceiveWithAuthorization differs from TransferWithAuthorization, so the signature cannot be repurposed.
What it costs in gas
Three token movements replace one. The proxy receives the maximum, pays the seller and refunds the buyer. We measured execution gas for each shape with forge test --isolate, which runs every top-level call as its own transaction, so storage access is cold as it would be on chain.
| Call | Execution gas | vs exact |
|---|---|---|
transferWithAuthorization straight to the seller (exact) | 95,814 | baseline |
Proxy settle, charge equals maximum (no refund) | 118,634 | +22,820 (+23.8%) |
Proxy settle, charge is a quarter of the maximum (refund) | 131,196 | +35,382 (+36.9%) |
These figures exclude the 21,000 intrinsic gas, calldata cost and gas refunds. The seller balance already held funds, so none of the paths pays for a new balance slot on the seller side. The proxy's own USDC balance goes from zero to the maximum and back to zero inside every call.
On Base the absolute difference is small. The ratio is what matters for a facilitator that sponsors gas: an upto settlement is between a quarter and a third more expensive than an exact one. We also confirmed that, on Base USDC, the proxy's first attempt, the bytes-signature overload, is the one that succeeds. The v,r,s fallback exists for older or standards-only tokens.
The hold: the whole maximum, at settlement
This is the property with the largest practical effect. Permit2's upto proxy transfers only the actual amount. The EIP-3009 proxy always receives the full authorization.value first. The spec says it plainly: "the client must still hold the entire maximum, since every settlement pulls authorization.value before paying and refunding."
We tested what that means.
# payer signs max = 5,000,000 (5 USDC); settler charges a small amount
balance 5,000,000 settle(1,000) ok payer ends at 4,999,000
balance 100 settle(50) REVERT (charge fits the balance; the pull does not)
A payer holding 100 atomic units cannot settle a 50-unit charge if it signed a 5,000,000 ceiling. By the spec's description of the Permit2 path, which transfers only the actual amount, that settlement would not need the full ceiling. A payer with an exactly sufficient balance also cannot run two concurrent maximums. We signed two 5,000,000 authorizations against one 5,000,000 balance. Both pass a balance-at-least-maximum check at verify time. The first settles. The second cannot.
There is no reservation. EIP-3009 does not lock funds, and neither does verify. For an agent that fans out several metered calls against one wallet, the effective requirement is the sum of the ceilings, not the sum of the charges. That is a wallet-sizing rule, and an agent runtime has to know it.
The window between verify and settle
An upto call runs between verify and settle, and the call can be long. We covered the structural problem in the two-phase gap audit: the resource is delivered while payment is still only a signature.
EIP-3009 gives the buyer two ways to break that signature inside the window. The first is to spend the balance elsewhere, as above. The second is cancelAuthorization, which marks the nonce used and which anyone can submit with the buyer's cancel signature. We ran it:
sign upto authorization -> buyer signs CancelAuthorization(payer, nonce)
usdc.cancelAuthorization(payer, nonce, v, r, s)
proxy.settle(...) REVERT
The proxy cannot do anything about it, and neither can the spec. The proposal includes sound protections for the settlement transaction. It cannot protect a seller that has already served the response. For metered LLM calls, the exposure is the length of the completion. This is the same shape as exact, with a longer window.
A review comment that changed the spec
The pull request's review thread includes a useful catch. The draft's verification step said to simulate settle "for the full maximum". A simulation with amount equal to the maximum never reaches the refund transfer, because the refund is then zero. A verifier that only did that would approve a payment whose partial settlement later reverts at the refund.
The current spec text now requires the settler to simulate settle with the actual amount before broadcasting, "including when the charge equals the signed maximum," and says verify-time simulation of the maximum alone is "not sufficient for a later partial settlement." The TypeScript draft does it: settleUptoEIP3009 simulates with the settle-time requirements before it writes.
We tried to produce the failure the reviewer worried about on USDC. We could not make the pull succeed and the refund fail. A blacklisted payer reverts at the pull with Blacklistable: account is blacklisted, so no refund is attempted. For USDC the extra simulation is a safeguard for other tokens, not a fix for a reproduced bug. The rule is still right, because the proxy is meant to be token-generic.
The settler is a single address
The seller's 402 carries extra.settlerAddress. The buyer commits that address in the nonce. Only that address may call settle.
The facilitator draft enforces it in two places. Verify requires that the facilitator's signer set contains the address. Settle, if the signer has no writeContractFrom, requires exactly one signer address and that it equals the settler. In both cases a mismatch returns a settler-mismatch error.
The spec adds a rule: the selected address "MUST remain available until authorization.validBefore." The TypeScript client sets validBefore to the current time plus maxTimeoutSeconds. A facilitator that rotates its settler key, drains a signer, or load-balances across several EOAs has to keep every advertised settler address live for that whole window, and has to advertise one address per payment. Today's exact flow has no equivalent constraint, because the facilitator's address is not part of the signed message.
Smaller details worth knowing
- Zero charge makes no transaction. The contract rejects
amount == 0. The facilitator returns success withtransaction: ""and the authorization expires unused. That matches the Permit2 path. - Token assumptions are strict. The proxy checks the exact balance change on the pull, the seller payment and the refund. Fee-on-transfer and rebasing tokens revert. A token that lies about a transfer cannot spend a balance already sitting on the proxy.
- Smart wallets need the bytes overload. The spec says contract-wallet signatures require a token that implements the
bytesoverload and validates through ERC-1271. We covered the compatibility map in the ERC-6492 audit. - Permit2 stays the default. An omitted
assetTransferMethodstill means Permit2, and sellers who want the new path must publish"eip3009"explicitly. - Pending settlements are keyed by signature. The draft stores the broadcast transaction under the signature and, on retry, compares a fingerprint of the amount, payer, payee and nonce before waiting on it. That is the recovery model from the finality audit, applied to the new path.
What it means for LLM4Agents
We probed our 402 today. An unauthenticated request to /v1/chat/completions returns one option: exact on eip155:8453, USDC, maxTimeoutSeconds: 300, and 10000 atomic units for a short completion. There is no upto on it.
That is the correct default. The exact rail has the best wallet coverage, the smallest gas bill and a single message type. Our reasoning-token audit and our context-window audit both showed the cost of quoting a fixed price for a variable-cost call. An upto rail with a measured settlement would close part of that gap.
This proposal changes three things about how that could work.
First, the buyer-side cost moves from an approval to a balance. Permit2 asks agents to do a one-time on-chain approval, which many wallets cannot do without gas. The EIP-3009 path removes that, and asks instead that the wallet hold the full ceiling for the whole call. For agents that keep a small float and top up, that is the harder requirement. We would have to publish clear ceilings per model and avoid asking for more than the call can cost.
Second, our facilitator address becomes part of the buyer's signed commitment. A settler we advertise must stay ours and stay live for the full timeout. That limits how freely we can rotate keys or move to a different facilitator while payments are in flight.
Third, the two-phase window is wider for metered calls. We run the completion before we settle. A buyer who cancels the authorization during a long completion gets the response for free. Exact has the same shape, but a completion that runs for a minute makes the window real.
Staying on the frontier
In order:
First, do not offer eip3009 upto yet. The contract is unaudited, undeployed on every chain we checked, and its address is declared not final. Offering it before an audit and a final address would be signing buyers up to a moving target.
Second, track #3867 and #423 for four events: an audit report, a final deployment address, a merge of the spec rewrite, and a published @x402/evm that includes the EIP-3009 path. Re-run the harness against the deployed bytecode when it exists, because any bytecode change moves the CREATE2 address.
Third, keep the harness. The probe in this post is small: a proxy built from the pull request's source, a Base fork, and five tests. It reproduces the gas table, the hold, the cancel race and the access checks in about four seconds. Re-run it when the contract changes.
Fourth, define a pre-serve check for any future upto rail. Before we start a long completion, confirm the buyer's balance covers the ceiling and that the nonce is unused, and again just before streaming ends. It does not close the cancel race, but it shortens the time a failed settlement can go unnoticed.
Fifth, cap what we ask. If we ever add a metered rail, the ceiling should be the model's worst-case cost for that request, not a round number. A smaller ceiling is easier for an agent wallet to hold and exposes less if a buyer's key is compromised.
Sixth, plan the settler. Decide now whether we would settle through our own signer or a third-party facilitator, and design key rotation around a window equal to maxTimeoutSeconds. The answer decides whether this path fits our operations at all.
Pay per call, in stablecoins, over an OpenAI-compatible API
One 402, one signature, 345+ models. No subscription, no minimum.
Register your agent