TriportRPC

isBlockhashValid

Last updated:

`isBlockhashValid` reports whether a blockhash is still valid against the cluster. A Solana blockhash expires after roughly 150 slots (about a minute), after which any transaction that references it is rejected. Use this method to confirm a recent blockhash is still usable **before** submitting a transaction, or to decide whether you need to fetch a fresh one with `getLatestBlockhash` and re-sign.

The answer is wrapped in the standard RPC response envelope, so you also get the `context.slot` at which it was evaluated. A `value` of `true` means the blockhash is still valid at that slot; `false` means it has expired (or was never seen) and you should obtain a new one.

Because validity is slot-dependent, the result is a point-in-time snapshot. Use the optional `commitment` config to control how finalized that slot must be, and `minContextSlot` to require that the node has reached at least a given slot before serving the request.

Parameters

isBlockhashValid parameters
NameTypeRequiredDescription
blockhashHashYes
configCommitmentConfigNo

Returns

isBlockhashValid return value
FieldType
resultobject

Examples

curl https://<your-endpoint>/ \
  -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"isBlockhashValid","params":["<blockhash>","<config>"]}'
const res = await fetch("https://<your-endpoint>/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "id": 1,
  "method": "isBlockhashValid",
  "params": [
    "<blockhash>",
    "<config>"
  ],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"isBlockhashValid","params":["<blockhash>","<config>"],"jsonrpc":"2.0"})
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet, devnet, testnet.
  3. Credit cost: 1 per call.

FAQ

What does isBlockhashValid do?
Returns whether a given Solana blockhash is still valid (has not yet expired).
How many credits does isBlockhashValid cost?
isBlockhashValid costs 1 credit(s) per call on Triport by default.
Is isBlockhashValid available over WebSocket?
isBlockhashValid is an HTTP JSON-RPC method.