x402 on Solana: blockhash hints that expired before they were served
On Solana, an x402 seller can put a recent blockhash in its 402 so the buyer skips one RPC call. The spec says the client uses that blockhash when it is "valid". All three reference clients take "valid" to mean "well-formed". On 2026-12-04, 15 live sellers served hints that had already expired, one of them by 2.68 million blocks. We built a stock payment on one of them. The facilitator rejected it with the same reason code it gives an empty wallet.
The trigger is x402 issue #4578, filed on 2026-12-03. Its author fetched unpaid 402s and compared each extra.lastValidBlockHeight with the chain tip. We redid the work on 2026-12-04 with our own scripts. We ran a census of every host in two Bazaar catalogs, and built a payment with the published TypeScript client and sent it to the seller's facilitator. We also timed what the hint actually saves. No payment was made, and nothing could settle: the key we used held no funds.
What the hint is
The server-provided blockhash arrived in PR #2693, merged on 2026-07-23, with Go parity in #2731 the same day. The idea is simple. A Solana transaction must name a recent blockhash, and that choice sets its lifetime. Without a hint, the buyer calls getLatestBlockhash itself. With a hint, the seller makes that call and puts the answer in the challenge.
The exact SVM spec defines two optional extra fields:
extra.recentBlockhash: "When present and valid, the Client SHOULD use it instead of fetching its own viagetLatestBlockhash". When it is absent or malformed, the client MUST fetch its own. The same paragraph warns that "a stale or fork-divergent blockhash will cause the transaction to expire or fail to land".extra.lastValidBlockHeight: the last block height at which the hint is valid. It "MAY be ignored by the Client or Sponsor".
The spec never says what "valid" means. A later paragraph adds that both fields are construction hints, and that facilitator verification does not compare the transaction's blockhash with the hint.
On the server side, the reference SDKs do the right thing. When a seller passes an RPC URL, the TypeScript, Python and Go exact servers each call getLatestBlockhash for every 402 they build (exact/server/scheme.ts line 165 in TypeScript). Go and Python ask for finalized commitment; TypeScript passes no commitment, and RPC nodes default to finalized. All three list both fields in dynamicExtraFields, so the server leaves them out when it checks that a payment's accepted object matches its terms. A fresh hint on every challenge is the design.
What "valid" means in the three clients
We read the client code at main commit a7aee5c (2026-12-04):
- TypeScript,
resolveBlockhashinmechanisms/svm/src/utils.ts(line 322): uses the hint whenever it base58-decodes to 32 bytes. It parseslastValidBlockHeightand returns it, but never compares it with the current height. - Python,
resolve_blockhashinx402/mechanisms/svm/utils.py(line 71): uses the hint wheneverHash.from_stringparses it. The exact client passes it onlyextra.get("recentBlockhash"), so the height is never read. - Go,
ResolveBlockhashinmechanisms/svm/utils.go(line 481): uses the hint wheneversolana.HashFromBase58succeeds. It does not readlastValidBlockHeightat all.
So a hint that is a real blockhash in the right format is always used, however old it is. The client's signature covers the blockhash, so nobody downstream can swap in a fresh one. The facilitator cannot repair it at settlement without breaking the signature.
How long a hint lives today
A Solana blockhash is usable for 150 blocks. We measured what that means in time on 2026-12-04, using batched reads so all values came from the same solana-rpc.publicnode.com node:
lastValidBlockHeightfromgetLatestBlockhash, minus the processed block height, was 149 or 150 blocks at every commitment level.- The chain produced 285 blocks in 60.37 seconds: 211.8 ms per block. 150 blocks is about 31.8 seconds.
- The finalized slot trailed the processed slot by one slot. On 2026-10-16, for our settlement finality audit, the gap was 32 to 33 slots, and a
finalizedblockhash had about 118 blocks left. We did not isolate the cause, but Alpenglow, the new consensus, went live on mainnet on 2026-10-21, between our two measurements. Either way, today a hint fetched atfinalizedstarts with almost the full window.
So a fresh hint gives a buyer about 30 seconds to sign, send, verify and land. Each 1,000 blocks past lastValidBlockHeight means the hint expired about three and a half minutes earlier.
Reproducing it with a stock client
At 09:29:56 UTC on 2026-12-04 we fetched the 402 for https://stabletravel.dev/api/flightaware/flights/UA1, one of the routes in the issue. Its Solana mainnet offer asked for 10,000 USDC base units (0.01 USDC), with maxTimeoutSeconds 300 and this extra:
{
"feePayer": "CjNFTjvBhbJJd2B5ePPMHRLx1ELZpa8dwQgGL727eKww",
"transactionVersions": [0, 1],
"recentBlockhash": "7KHpDA46t3UHaWnrDYQE88MZ2yKkma84npPTyoFFAbqp",
"lastValidBlockHeight": "455319956"
}
The processed block height at that moment was 455,334,560. The hint was 14,604 blocks past its own last valid height, about 52 minutes at the measured rate. isBlockhashValid returned false. The same hint had been in that offer when we first fetched the route, at 09:05 UTC.
We then built a payment with the published @x402/svm 2.33.0 exact client, using a freshly generated key with no funds. We sent the result to simulateTransaction and to the /verify endpoint of the facilitator named by feePayer. That address is the fee payer PayAI lists in its /supported. We ran the same steps twice: once with the 402 as served, and once with the two hint fields removed.
| Case | Transaction blockhash | Simulation error | PayAI /verify |
|---|---|---|---|
| Hint as served | the hint (7KHpDA46…) | BlockhashNotFound | invalid_exact_svm_transaction_simulation_failed |
| Hint removed | fetched by the client | InstructionError [0, InvalidAccountData] (unfunded key) | invalid_exact_svm_transaction_simulation_failed |
The client signed on the dead blockhash without a warning. The facilitator caught it, which is the good news. The bad news is the reason code. A payment that can never land because of the seller's hint gets the same invalidReason as a payment from an empty wallet. Only the free-text invalidMessage tells them apart: Simulation failed: "BlockhashNotFound" in the first case.
The buyer never sees that message. In the TypeScript resource server, a failed verify becomes a new 402 built with verifyResult.invalidReason alone (x402HTTPResourceServer.ts). @x402/fetch makes one paid retry and returns the second 402 to the caller. An agent reading that 402 learns "simulation failed". It may decide it is out of funds, or it may retry. A retry fetches a new 402, which on a server like this carries the same stale hint, so it fails the same way every time.
This is the same failure-reason problem we found across the wider protocol in our 402 dialect census: the code the buyer gets is too coarse to act on.
A census of every listed host
The issue looked at Solana hosts in the CDP catalog. We widened the denominator. We merged the CDP Bazaar catalog (93,323 entries) with PayAI's catalog (19,385 entries), kept the most-called route per host, and sent one unpaid request to each of 4,898 hosts. The run took place between 09:24 and 09:27 UTC on 2026-12-04. A separate thread read the processed block height about every 1.2 seconds. Each response was matched to the nearest reading, never more than 0.65 seconds away, which is about three blocks.
- 4,414 hosts answered 402.
- 918 of them carried a Solana mainnet offer.
- 37 of those carried
extra.recentBlockhash, and 36 of the 37 also carriedlastValidBlockHeight. - 22 hints were live. Those with a height had 63 to 153 blocks left, median 148.
- 15 hints had expired: 14 of them by 522 to 30,378 blocks, and one by 2,677,865.
Right after the census, from 09:27:30 to 09:29:07 UTC, we sent six more requests to each of the 37 hosts, about 19 seconds apart. We called isBlockhashValid as soon as each response arrived. The two groups split cleanly:
- The 22 live hosts were valid in all six responses. 21 returned a new hint every time. One returned four distinct values in six requests, so it reuses a hint across requests about 19 seconds apart, and still stays inside the window. The host that sent no
lastValidBlockHeightwas in this group. - The 15 expired hosts returned the same hint in all six responses, and it was valid in none of them. The 15 hosts share only five distinct values.
| Hint | Hosts | Blocks past last valid height (census) |
|---|---|---|
7KHpDA46… | stabletravel.dev, stablecrypto.dev, stablesocial.dev, stablestudio.dev, stablestudio.io, stableupload.dev, stableemail.dev, socialx402.com, x402email.com | 13,065 to 13,689 |
CTg5BNQi… | stablejobs.dev | 30,378 |
GvNkcyAP… | stableenrich.dev, enrichx402.com | 5,190 to 5,814 |
ByTtonnV… | stablefinance.dev, stable-financial.vercel.app | 522 to 820 |
CLNJLKMi… | x402.atomicstream.net (a v1 offer, in the body) | 2,677,865 |
Within a group the hint is identical; the spread is the tip moving during the run. At today's rate, 2,677,865 blocks is about six and a half days. The 7KHpDA46… value is the one stabletravel.dev served in our reproduction. Nine hosts serving the same blockhash suggests one shared backend, not nine separate mistakes.
These are not dead endpoints. The CDP catalog lists 37,074 calls in the last 30 days for stableenrich.dev's top route. We do not know how many of those paid on Solana. The 14 v2 hosts all list Base first and Solana second, and a buyer who pays on Base never touches the hint. Only buyers who pick the Solana option hit it.
The v1 offer is a different case. x402.atomicstream.net offers only v1 solana. But the v1 exact clients in all three SDKs always call getLatestBlockhash themselves and never read the hint. A stock v1 buyer is unaffected. The dead hint only hurts a client that reads it.
Where a stale hint comes from
The 402 itself is not cached. Fourteen of the 15 expired hosts answered with Cache-Control: no-store and x-vercel-cache: MISS. The fifteenth, behind Cloudflare, answered cf-cache-status: DYNAMIC. stabletravel.dev's 402 also carries an MPP WWW-Authenticate: Payment challenge with its own expires, set five minutes after the response. That part of the challenge is fresh. The blockhash next to it is not. So the stale value is set behind the HTTP layer, not by a cache in front of it.
All 15 name PayAI's fee payer. That points at a second place a blockhash can come from. Of the six facilitators whose /supported answered our query (x402.org, Dexter, UltravioletaDAO, OpenX402, Daydreams and PayAI), only PayAI puts recentBlockhash and lastValidBlockHeight in the extra of its Solana exact kinds. It serves a new one on every request, with Cache-Control: no-store. That is fine as served. The /supported endpoints of CDP and Corbits did not return a parseable answer to our unauthenticated request, so we could not check them.
The catch is how resource servers use /supported. The reference x402ResourceServer fetches it in initialize() and keeps the result until initialize() runs again, which in a typical server means once per process. The reference SVM servers copy only feePayer and transactionVersions from it (the Go server also copies the values of declared extension keys), so a stock server never forwards PayAI's blockhash. A server that copies the facilitator's extra wholesale would forward it. It would then serve the blockhash it saw at boot, for as long as the process lives.
That would fit what we saw: one fixed value per group, replaced only now and then. The issue's author saw one such replacement on 2026-12-03, about three hours after the first reading, and the new value was expired too. It would also explain the v1 offer: none of the three SDKs has a v1 server that emits a hint, but PayAI's v1 solana kind carries one. Still, we cannot see these servers' code, so this is a hypothesis, not a finding. PayAI's fee payer also appears on 12 of the 22 live hosts, so the facilitator alone does not cause the problem.
What the hint buys
The spec gives two reasons for the hint: it saves the buyer an RPC round-trip, and it pins the transaction to a blockhash the settling RPC has already seen. We measured the first one. The client already has an RPC client either way. The exact client fetches the mint's metadata the first time it pays in a given token, and caches it after that.
With a warm mint cache, we built 15 payloads with a fresh hint and 15 without, alternating:
- Against
solana-rpc.publicnode.com: median 8.7 ms with a hint, 114.0 ms without. - Against
api.mainnet-beta.solana.com: median 11.2 ms with a hint, 110.6 ms without.
From our host, the hint saves about 100 ms per payment, out of a window of about 30 seconds. That is where the trade-off sits. The obvious client fix is to call getBlockHeight and compare it with lastValidBlockHeight. But that call costs the same round-trip the hint was meant to save. A client that checks the hint this way gets no speed benefit from it.
There is a check that costs nothing. A client that has seen the chain height once, from any earlier blockhash it fetched, can estimate the current height from elapsed time. If it assumes blocks are slower than they really are, the estimate stays below the true height. So the check only drops a hint that is expired or within MARGIN_BLOCKS of expiring, and it still catches a hint that is thousands of blocks old:
// Zero-RTT guard: drop a hint whose lastValidBlockHeight is below a conservative height estimate.
const SLOW_MS_PER_BLOCK = 400; // slower than the ~212 ms measured, so the estimate lags reality
const MARGIN_BLOCKS = 20; // time to sign, send and verify
export function hintUsable(lastValidBlockHeight, seen, nowMs) {
if (!seen) return true; // no height observed yet: behave as the spec does today
const est = seen.height + Math.floor((nowMs - seen.atMs) / SLOW_MS_PER_BLOCK);
return lastValidBlockHeight > est + MARGIN_BLOCKS;
}
We tested it against four cases: a fresh hint one second later passes, the stabletravel hint fails, a hint that was fresh an hour ago fails, and a client that has never seen a height passes. seen comes for free. Every getLatestBlockhash response includes lastValidBlockHeight, and the height at that moment is at least that value minus 150. For the very first payment, before any height has been seen, the second client rule below covers the gap.
What should change
Four fixes, from cheapest to most structural:
- Clients. Ignore a hint whose
lastValidBlockHeightis below a known or estimated height. Ignore it too after a verify failure on the same route: drop the hint for the next attempt and fetch a blockhash yourself. Both are a few lines inresolveBlockhash,resolve_blockhashandResolveBlockhash. - Facilitators. Simulation already reports
BlockhashNotFound. Mapping that to its own reason code, instead of the generic simulation failure, would let a buyer tell "fetch a new blockhash" apart from "add funds". No such code exists in the SVM error list today. - Resource servers. Never serve a hint past its own
lastValidBlockHeight. Never cacheextra.recentBlockhashwith the rest of a 402. Never copy one from a cached/supportedresponse. - Spec. Define "valid": a hint whose
lastValidBlockHeight, if present, is above the current block height. MakelastValidBlockHeightrequired wheneverrecentBlockhashis present, so clients have something to check. Issue #4578 proposes the spec definition, the server rule and agetBlockHeightcheck on the client.
What it means for LLM4Agents
Today our gateway's 402 offers one payment option: exact on Base (eip155:8453). We checked on 2026-12-04. There is no Solana offer and no blockhash hint, so we do not serve this bug.
It still matters to us, in two roles.
As a seller, we may add an exact SVM option to our 402. The lesson from this census is that the hint is the one field in an exact SVM requirement that goes stale in seconds. Price, asset, payTo and feePayer stay valid as long as the seller's terms do. If we add Solana, we will either fetch the hint for each 402 or leave it out. We would rather cost the buyer 100 ms than risk a payment that cannot land.
As infrastructure for agents that pay, the reason-code collapse is the bigger problem. An agent that gets invalid_exact_svm_transaction_simulation_failed cannot tell a stale seller hint from an empty wallet. That ambiguity turns into bad decisions: an unnecessary top-up, a retry loop, or an escalation to a human. For agents that spend on their own, an unclear error does more damage than a slow call.
This connects to two earlier findings. Solana's short validity window shaped our first look at the exact SVM scheme. And the facilitator's simulation step, which caught the dead blockhash here, is also what the smart-wallet path rests on, as we found in our Squads and Swig audit.
Staying on the frontier
- Ship the guard in any SVM buyer path we control. Use the zero-RTT height check above, plus a rule to drop the hint and fetch a blockhash after one
simulation_failedon a route that served a hint. Both are small, and both are local to the client. - If we add an exact SVM offer, fetch the hint per challenge or omit it. Never put it behind a cache or take it from
/supported. Add a synthetic probe that fetches our own 402 every minute and alerts iflastValidBlockHeightis ever below the tip. - Keep time-bound fields out of every cache layer we run. Our 402 is built per request today. Any future edge cache, CDN rule or memoized challenge builder must leave out fields with a clock on them, such as an SVM blockhash hint or an MPP
expires, or skip the challenge entirely. - Pass the facilitator's
invalidMessagethrough to agents, in our own 402s and in any buyer tooling we ship. A rawBlockhashNotFoundis the difference between a correct retry and a wrong top-up. Support a dedicated reason code upstream if one is proposed. - Re-run this census after changes land. Re-run it when #4578 gets a fix, and when any SDK release changes
resolveBlockhash. The census takes about ten minutes.
Payments your agents can actually land
LLM4Agents is an OpenAI-compatible gateway that agents pay per call in USDC over x402. One 402, one clear price, no blockhash to go stale.
Register an agent