When does a Solana transaction’s blockhash expire?
A payment is still pending after a minute. Before asking for another signature, check the block height at which the original transaction expires and whether it reached the chain.
Save the deadline when you build the transaction
Send this JSON body to the cluster’s HTTP RPC endpoint. Build the transaction with the returned value.blockhash. Save value.lastValidBlockHeight alongside the transaction signature. A later call gives you a new pair, with a deadline that belongs to the new hash.
{"jsonrpc":"2.0","id":1,"method":"getLatestBlockhash","params":[{"commitment":"confirmed"}]}
Compare two block heights
{"jsonrpc":"2.0","id":2,"method":"getBlockHeight","params":[{"commitment":"confirmed"}]}
Suppose the saved deadline is 7000. At height 6999 the transaction still has time to land. At 7000 it is on its last eligible height. Once the height passes 7000, a new block on that chain can no longer include the transaction with that hash. The response’s context slot uses a different counter because some slots produce no block.
Resolve the original payment
Look up the original signature with getSignatureStatuses. A transaction included before expiry can reach finality after the deadline. If the recent cache returns null, request historical status from an endpoint covering the relevant slot and reconcile the payment record before signing a replacement. This procedure applies to transactions built with a recent blockhash. Durable nonce transactions have their own validity rules.