The Solana isBlockhashValid
method checks whether a given blockhash is still valid.
This method is useful for determining if a previously fetched blockhash can still be used for transaction submission. It helps prevent the use of expired blockhashes, which would cause transactions to fail.
Get your own node endpoint today
Start for free and get your app to production levels immediately. No credit card required.
You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
blockhash
— the blockhash to validate, as a base-58 encoded string.commitment
— (optional) the level of commitment desired:processed
— the node has processed the block and the block may be on a fork.confirmed
— the block is confirmed by the cluster as not being on a fork.finalized
— the block is finalized by the cluster.
Response
result
— a boolean indicating whether the blockhash is still valid:true
— the blockhash is valid and can be used for transaction submission.false
— the blockhash is no longer valid and should not be used.
Use case
A practical use case for isBlockhashValid
is in transaction retry logic. When a transaction fails due to network issues, an application can use this method to check if the original blockhash is still valid before retrying the transaction. If the blockhash is no longer valid, the application knows it needs to fetch a new blockhash before retrying.
Try the isBlockhashValid
RPC method yourself
isBlockhashValid
RPC method yourself