isBlockhashValid

The isBlockhashValid method checks whether a blockhash is still valid for transaction submission. This method is crucial for determining if a transaction with a specific blockhash can still be processed by the network, helping prevent transaction failures due to expired blockhashes.

Blockhashes in Solana have a limited validity window of approximately 60-90 seconds (roughly 150 blocks). Transactions that include expired blockhashes will be rejected by validators. Before resubmitting a transaction or when holding a transaction for delayed submission, it's important to verify the blockhash is still valid. This method provides that verification without needing to track block heights manually.

This method is essential for transaction retry logic, delayed transaction submission systems, batch processing applications that prepare transactions in advance, and any scenario where there's uncertainty about blockhash age. It prevents wasting network resources on transactions that will inevitably fail due to expired blockhashes and enables smarter retry strategies.


Parameters

parameter
type
description
blockhash
string
The blockhash to check for validity as a base-58 encoded string
config
object
Optional configuration object
config.commitment
string
Level of commitment: 'processed', 'confirmed', or 'finalized' (default: 'finalized')
config.minContextSlot
number
Optional. Minimum slot that the request can be evaluated at
Return Object
field
type
description
context
object
RPC response context with slot information
context.slot
number
The slot at which this validity was checked
value
boolean
true if the blockhash is still valid, false if expired or invalid
Request Example
Request
Response Example
Response

Tip: If value is false, fetch a new blockhash with getLatestBlockhash before submitting the transaction. Use 'processed' commitment for the freshest validity check. Blockhashes typically remain valid for ~60-90 seconds. Always check validity if more than 30 seconds have passed since fetching the blockhash.


Share on
Share on FacebookShare on XShare on LinkedIn
Did you find this page useful?