Transaction simulation failed: Blockhash not found
The blockhash in your transaction is either expired or not yet visible to the RPC node you are using.
Common causes
- Blockhash expired. Solana blockhashes are valid for approximately 60-90 seconds (150 slots). If your transaction takes too long to reach the network, the blockhash expires.
- RPC node is behind. The node has not processed the slot that produced this blockhash. Check with getHealth.
- Using a stale cached blockhash. Re-fetching the blockhash for each transaction attempt prevents this.
How to fix
- Fetch a fresh blockhash with getLatestBlockhash immediately before sending.
- Set the
lastValidBlockHeightfrom the same response and use it to stop retrying when the blockhash window closes. - If the error persists, check that your RPC node is healthy and not lagging behind the cluster.
How to prevent
- Always fetch a new blockhash right before signing and sending.
- Use
confirmedcommitment for the blockhash fetch for a good balance of speed and reliability. - Implement a retry loop that re-fetches the blockhash on each attempt.
FAQ
How long is a blockhash valid? Approximately 60-90 seconds, or 150 slots.
Should I use processed or confirmed commitment for blockhash?
confirmed is recommended. processed blockhashes can be from forks that get rolled back.
Error text variants
-
Blockhash not found -
Transaction simulation failed: Blockhash not found -
BlockhashNotFound
Updated: