RPC error -32002: Transaction simulation failed: Blockhash not found
Last updated:
At a glance
| Property | Value |
|---|---|
| Code | -32002 |
| Message | Transaction simulation failed: Blockhash not found |
| Category | transaction |
Cause
The blockhash in your transaction is no longer usable by the node processing it, and there are two different reasons for that. It expired. getLatestBlockhash returns lastValidBlockHeight next to the hash — that block height, not an elapsed time, is the deadline the cluster enforces. Once the chain passes it, the transaction can never land. Or the node has not seen it yet. A hash read at processed commitment, or taken from a node further ahead than the one receiving your send, is simply unknown to the receiver until it catches up. The hash is young, but the error is the same.
Solution
- Fetch the blockhash with getLatestBlockhash right before signing and keep the lastValidBlockHeight it returns.
- Compare it with getBlockHeight while you retry: once the chain passes that height, stop retrying and rebuild the transaction — resubmitting the same bytes can no longer succeed.
- Take the blockhash at confirmed (or finalized) commitment rather than processed, so the node receiving the send already knows it.
- Use isBlockhashValid to tell the two cases apart before rebuilding: an expired hash needs a new transaction, an unseen one usually just needs a moment.
- Track the outcome by signature (getSignatureStatuses, or getTransaction once it lands) instead of resubmitting blindly — a transaction can land even when the send call reported an error.
Example
{
"id": 1,
"error": {
"code": -32002,
"message": "Transaction simulation failed: Blockhash not found"
},
"jsonrpc": "2.0"
}FAQ
- Why does "Transaction simulation failed: Blockhash not found" happen?
- The blockhash in your transaction is no longer usable by the node processing it, and there are two different reasons for that. It expired. getLatestBlockhash returns lastValidBlockHeight next to the hash — that block height, not an elapsed time, is the deadline the cluster enforces. Once the chain passes it, the transaction can never land. Or the node has not seen it yet. A hash read at processed commitment, or taken from a node further ahead than the one receiving your send, is simply unknown to the receiver until it catches up. The hash is young, but the error is the same.
- How do I fix "Transaction simulation failed: Blockhash not found"?
- Fetch the blockhash with getLatestBlockhash right before signing and keep the lastValidBlockHeight it returns. Compare it with getBlockHeight while you retry: once the chain passes that height, stop retrying and rebuild the transaction — resubmitting the same bytes can no longer succeed. Take the blockhash at confirmed (or finalized) commitment rather than processed, so the node receiving the send already knows it. Use isBlockhashValid to tell the two cases apart before rebuilding: an expired hash needs a new transaction, an unseen one usually just needs a moment. Track the outcome by signature (getSignatureStatuses, or getTransaction once it lands) instead of resubmitting blindly — a transaction can land even when the send call reported an error.