in-solana by Supanode

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

  1. 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.
  2. RPC node is behind. The node has not processed the slot that produced this blockhash. Check with getHealth.
  3. Using a stale cached blockhash. Re-fetching the blockhash for each transaction attempt prevents this.

How to fix

  1. Fetch a fresh blockhash with getLatestBlockhash immediately before sending.
  2. Set the lastValidBlockHeight from the same response and use it to stop retrying when the blockhash window closes.
  3. 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 confirmed commitment 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: