auth-capture on Solana: an SPL Approve is not a hold
x402's auth-capture scheme exists to give a payment a lifecycle: hold the maximum, capture the real amount, void, refund. An open pull request ports it to Solana using SPL Token Approve as the hold. We ran that design against the real token program, then ran the PR's facilitator against real transactions. The hold is an allowance, and the settle path does not get as far as using it.
This is the Solana companion to our audit of the EVM auth-capture scheme. On Base the hold is real: the escrow contract takes custody of the funds. On Solana, the PR proposes that the funds never move. The client signs one Approve, and the facilitator, as delegate, later calls TransferChecked against it.
Two things are tested below, and they are different questions. First: does an SPL allowance behave like the hold the scheme promises? Second: does the code in the PR do what its spec says? The first needs only the token program. The second needs the PR's code and a real transaction.
The PR, as of today
x402-foundation/x402 #4125 adds a spec (scheme_auth_capture_svm.md) and a TypeScript implementation under typescript/packages/mechanisms/svm/src/auth-capture/: client, server and facilitator. It adds 2,553 lines, all in one commit, head fb0cd80. We read it on 10 November 2026, while main was at ff58685.
Its state matters for how to read what follows. The PR is open with no reviews. The bot comments say the commit is unsigned. CI fails on format, lint, the TypeScript tests, the Go tests and the verified-commits check. The author's own description says the local checks were pending because the environment lacked pnpm. This is a first draft, and we are not auditing it as a release. We are using it because the design question it raises is general: can an SPL delegate stand in for an escrow?
What the spec promises
The base auth-capture spec lists core properties that every network binding must meet. Three matter here.
Fund safety. The settled amount is capped by the client-authorized maximum, and held funds stay recoverable once the capture deadline passes. Expiry enforcement. A capture deadline and a refund deadline govern the lifecycle. Server consent. A binding must authenticate that capture, void and refund come from the resource server.
The SVM binding maps the lifecycle onto three SPL Token instructions. Approve is the hold. TransferChecked by the delegate is the capture. Revoke is the void. It also says "after this passes, the client may reclaim (unilateral, off-facilitator)", which in SPL terms is a payer-signed Revoke.
Part one: what an SPL Approve is
We built a local SVM with litesvm 1.6.2, which runs the real SPL Token program, created a 6-decimal mint, and funded a payer with 10 USDC-like units. Every line below is a real transaction against that program. The harness is about 60 lines and uses only @solana-program/token.
The first result is the one that decides the design. An account has one delegate slot. A second Approve overwrites the first.
OK hold #1: approve 2 USDC -> delegate A
balance=9000000 delegate=6xnY delegated=2000000
OK hold #2: approve 3 USDC -> delegate B
balance=9000000 delegate=B3zp delegated=3000000 <- hold #1 is gone
FAIL capture on hold #1 with delegate A -> custom program error: 0x4 (OwnerMismatch)
On Solana, one payer wallet holds its USDC in one associated token account. Two concurrent holds on that account cannot coexist. The second silently kills the first, and the first merchant's capture fails with OwnerMismatch. An agent that buys from two sellers in parallel, which is the normal case for an agent, loses a hold without any error at the time. The spec has no rule for it. It does not even say that a facilitator should read the account's current delegate before accepting an Approve.
The second result is about custody. An allowance is permission to spend, not a claim on funds.
OK delegate captures to ANY destination, not payTo
OK payer moves the entire balance out while hold is live
balance=0 delegate=6xnY delegated=1500000 <- allowance outlives the funds
FAIL capture after the payer drained -> custom program error: 0x1 (InsufficientFunds)
The payer can empty the account while the hold is live. The allowance stays at 1,500,000 and the capture then fails with InsufficientFunds. The facilitator has already told the resource server that the payment is held, and the server has already run the handler. It is the same shape of risk as the verify-to-settle window in our two-phase gap audit: work is done on a payment that is not yet money. The cause is different. There the window is time. Here the "hold" holds nothing.
The same run shows the other direction. The delegate can capture to any token account, not only the merchant's. The destination is a field of the facilitator's transaction, not something the client's Approve commits to. The Approve binds source, delegate and amount. It does not bind payTo, the resource, a fee or a deadline. The only per-payment value in the client's signed bytes is a memo nonce. On EVM, the escrow nonce is a hash over the receiver, token, amount, all three expiries and the fee bounds. Here that commitment does not exist, so the client is trusting the delegate for everything the spec lists as a client-authorized limit.
Third, deadlines.
OK capture 90 days after approve
OK payer Revoke (unilateral, no facilitator)
balance=4750000 delegate=none delegated=0
We moved the clock forward 90 days and the delegate captured. The token program has no notion of captureDeadline. The words captureDeadline, refundDeadline, feeRecipient, minFeeBps and maxFeeBps do not appear in the PR's client, facilitator or server scheme files at all. The spec does list a verify rule for the deadlines, but nothing implements it, and nothing on-chain would enforce it anyway. "Expiry enforcement" becomes the facilitator's good behavior. The payer's own Revoke does work, and it is the only guarantee of the three that survives.
So the honest summary for the spec's core properties is this. Fund safety: capped by the allowance, but not backed by funds. Expiry enforcement: not enforced. Server consent: not specified for this binding, since a capture payload carries only a type and the original transaction. The one thing a payer keeps is the right to leave.
Part two: what the PR code does
Now the facilitator. We took the PR head, built @x402/core, and wrote a vitest probe that builds a real Approve transaction with @solana-program/token and the same layout as the PR's client (compute-budget pair, Approve, memo). We gave the facilitator a mock signer that records what it sends. Then we called verify and settle.
Verify rejects every valid Approve, for three independent reasons.
facilitator/scheme.tsdefinesIX_TOKEN_APPROVE = 7. In SPL Token theApprovediscriminator is 4. The official client emitted a first data byte of 4 in our run.- The length check is
ixData.length < 10. A realApproveis 9 bytes: one discriminator and an 8-byte amount. - The payer comes from
getTokenPayerFromTransaction, a shared helper that readsaccounts[3], the owner position ofTransferChecked. AnApprovehas three accounts, so the helper returns an empty string.
We patched them in sequence in a scratch copy. With the payer helper patched, verify still returned no_approve_instruction. With the length also patched, same. With the discriminator also set to 4, verify returned isValid: true. Each is a separate condition that rejects the payment, and all three return the same error string, so a developer who fixes one sees no progress.
With those three patched, in a scratch copy, we looked at what settle sends.
SETTLE authorize(no type) -> success: true | sent: TransferChecked (ix 12), 1 required signature
SETTLE capture -> success: true | sent: TransferChecked (ix 12), 1 required signature
SETTLE refund -> success: false, transaction_failed | sent: nothing
SETTLE void -> verify: transaction_instructions_length | sent: nothing
post-settlement inner-instruction lookups: 0
Four findings sit in those lines.
The initial settle sends a capture. The branch in settle() is: void, refund, otherwise build a capture. A settle with no type, which is the spec's authorize, takes the otherwise branch. The client's Approve is simulated at verify and then never broadcast. The facilitator builds a full-amount TransferChecked against an allowance that does not exist on-chain.
The capture has no delegate signature. The code passes the delegate signer as the second argument of partiallySignTransactionMessageWithSigners, which is the options object. The delegate appears in the instruction as a bare address, so the compiled transaction requires one signature: the fee payer's. We sent exactly that shape to the real token program:
FAIL capture, delegate NOT a signer (as buildCaptureTransaction emits)
-> InstructionError { index: 0, error: MissingRequiredSignature }
OK capture, delegate signs
The same transfer with the delegate as a signer succeeds. So the capture is one line away from working on-chain, and as written it cannot.
Refund throws. buildRefundTransaction passes an uncompiled message to getBase64EncodedWireTransaction. That throws a TypeError inside @solana/transactions, which settle catches and reports as transaction_failed. The spec says a refund is signed by the merchant. The code never obtains a merchant signature either; it only asks the facilitator's signer to add the fee payer. The spec's own line, "refund liquidity comes from the receiver, never the facilitator", needs a merchant key that the design gives the facilitator no way to use.
Void is unreachable. A void payload has to pass the same verify, which demands an Approve layout. A Revoke transaction fails the instruction-length check. The spec says the client pre-signs the Revoke in the authorize payload. The client code builds one transaction, an Approve, and no Revoke. A pre-signed Revoke would also carry a recent blockhash that the spec says expires in about 60 to 90 seconds, so unless the client used a durable nonce it could not be held for a later void.
The last line of the output is the post-settlement check: zero inner-instruction lookups. The spec calls post-settlement verification mandatory. In the code it only runs when isSmartWalletSettlement is true. That flag is set by the smart-wallet path, and verifySmartWalletTx always returns smart_wallet_verification_unavailable after the isolation check. For the standard wallet path, the one every payment would use, "mandatory" verification never runs. Where it would run, it matches transfers of at least the full requirements.amount, so a partial capture would fail it.
Smaller mismatches, each checked in the code. The capture and refund builders hard-code the classic token program and decimals: 6, while the spec says Token-2022 is handled. On the real program a wrong decimals value fails with MintDecimalsMismatch, which our run reproduced with 9. The server scheme declares flows authorization and upfront with authorization as default, while the SVM spec says the default is escrow, so a server using it would not offer the hold flow at all. The spec's JSON example uses 0x-prefixed placeholders for payTo and delegate on a base58 network.
The test suite
The PR description says the tests cover "all 7 Solana attack vectors". We ran them. The three test files live in test/unit/auth-capture/ and import ../../src/auth-capture, which resolves to test/src/auth-capture. Vitest reports all three suites failed to load and zero tests ran.
We then fixed the relative path and pointed the facilitator imports at the facilitator class, since the package index exports the client class under the same name. 28 tests ran. 16 passed and 12 failed. The passing ones are early-return configuration checks, such as a missing delegate. The security suite feeds strings like "durable-nonce-tx-base64" as the transaction, and nine of its fifteen cases fail. None of the 28 tests calls settle. Capture, void and refund, the three operations the scheme exists for, have no test.
We are not criticizing a first contribution for being unfinished. The point is the gap between the claim and the evidence: the failing CI was a correct signal.
Is there a version that works?
The bugs in part two are fixable, and a maintainer could do it in an afternoon. The findings in part one are not bugs. They come from the primitive.
The design is a reasonable fit for one narrow case. If a binding only relays the collect step and runs the rest out of band, which the base spec allows, an allowance can authorize a later pull. That is a pull-payment, not an escrow, and it should be named that way. It would also need the facilitator to read the current delegate of the payer's account and refuse to overwrite another party's.
For a real hold, the funds have to leave the payer's control. On Solana that means a program-owned vault, or at minimum a dedicated per-payment token account, so that a payer drain and a second approve cannot touch the held amount. This is our reading of the constraints, not something we tested. What we tested is only that the allowance model cannot offer it.
What it means for LLM4Agents
The reason a gateway wants auth-capture is metered inference: hold a ceiling before the model runs, bill the actual cost afterwards. We covered the same need from the upto side in the metered billing post. On Solana, a scheme that sells a hold but delivers an allowance would move the risk to us. We would be running the model on a payment that the payer can drain or overwrite before capture.
So the practical position is simple. Our Solana path should keep to schemes whose settlement is a signed, atomic transfer. We should not advertise or accept an auth-capture network id for Solana until a binding exists that moves custody. The related Solana work we have audited, such as smart-wallet verification and multi-payee splits, rests on the exact scheme, where the signed bytes carry the amount and destination.
Staying on the frontier
Ordered by cost and value.
- Add a delegate pre-flight to any client path that signs an
Approve. Read the token account first. If another delegate is set with a non-zero allowance, refuse and say so. The test above shows it is the only protection against silent overwrites. - Keep the probe. The Approve semantics harness and the facilitator probe are small. Re-run both when #4125 gets signed commits and a green CI, and again if the binding changes to a vault design. The triggers: the PR head moves off
fb0cd80, or the SVM spec stops saying "Approve". - Write down the minimum for any hold-style scheme we accept on any chain: funds out of payer control, deadlines enforced by the chain, and the commitment to receiver and fees inside the client-signed bytes. The EVM escrow meets all three. Use that as the review bar for the next binding.
- For Solana metering today, prefer a prepaid balance with per-request debits over a hold. It gives the same "bill the actual cost" outcome with no allowance to overwrite.
- Watch the
x402-foundation/x402list of open scheme PRs. Network bindings are arriving quickly and most have had no review. Reading them early is cheap, and the failures so far, like this one, show up in a day of probing.
litesvm 1.6.2 with the bundled SPL Token program, 6-decimal mint, @solana-program/token instructions. Part two: PR head fb0cd80, workspace-built @x402/core, a vitest probe with a recording mock signer. Patches were made in a scratch copy and not committed anywhere. Nothing ran against mainnet or devnet.
Pay for model calls with a signed transfer, not a promise
LLM4Agents bills every request in stablecoins over an OpenAI-compatible gateway. No hold to be overwritten, no allowance to drain.
Register your agent