For the complete documentation index, see llms.txt. This page is also available as Markdown.

isBlockhashValid

Learn isBlockhashValid use cases, code examples, request parameters, response structure, and tips.

The isBlockhashValid RPC method in CoinVera checks whether a given blockhash is still considered valid by the Solana network. Since blockhashes expire after approximately 150 slots (~1–2 minutes), this method helps ensure that a transaction referencing an older blockhash won't be rejected.

🛈 Version Note: This method is available in Solana v1.9+. For older nodes (v1.8 or earlier), use getFeeCalculatorForBlockhash to implicitly verify blockhash validity.


✅ Common Use Cases

  • Transaction Resubmission Before retrying a failed transaction, check if the original blockhash is still valid.

  • Delayed Signing/Submission If a transaction is prepared but submitted later, validate the blockhash to avoid errors.

  • Optimistic Transaction Scheduling Ensure a held blockhash is still valid before attempting to send a transaction.


🧾 Request Parameters

[
  blockhash: string,             // Required – base-58 encoded blockhash string
  options?: {
    commitment?: string,         // Optional – "processed", "confirmed", or "finalized"
    minContextSlot?: number      // Optional – ensure node response is from a recent enough slot
  }
]
  • blockhash (required): The blockhash to validate.

  • commitment (optional): Query the blockhash validity based on a specific network confirmation level.

  • minContextSlot (optional): Ensures the response is based on a slot at least this recent—useful to prevent stale data.


📦 Response Structure

  • value: Boolean result — true if the blockhash is valid, false if it has expired.

  • context.slot: The slot at which this response was evaluated.


🧪 Example

Check if a Blockhash is Valid


Code Examples

Example Response


💡 Developer Tips

  • Blockhash Expiry Blockhashes are valid for ~150 slots. If you’re unsure about age, fetch a fresh one using getLatestBlockhash.

  • Use minContextSlot for Accuracy This prevents a stale node from incorrectly reporting a blockhash as valid.

  • Legacy Support On nodes running Solana <v1.9, use:

    If it fails, the blockhash is no longer valid.

  • Validation ≠ Finality A valid blockhash doesn’t guarantee transaction success. Finality is achieved only once the transaction is confirmed at the desired commitment level.


The isBlockhashValid method is a critical tool in time-sensitive transaction flows, helping developers avoid expired-blockhash errors and ensure smoother interactions on the Solana blockchain using CoinVera.

Last updated