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
| Name | Type | Required | Description |
|---|---|---|---|
| blockhash | Hash | Yes | |
| config | CommitmentConfig | No |
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://triport.io/sol \
-X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{"id":1,"method":"isBlockhashValid","params":["<blockhash>","<config>"],"jsonrpc":"2.0"}'const res = await fetch("https://triport.io/sol", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
body: JSON.stringify({
"id": 1,
"method": "isBlockhashValid",
"params": [
"<blockhash>",
"<config>"
],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post(
"https://triport.io/sol",
headers={"Authorization": "Bearer <api-key>"},
json={"id":1,"method":"isBlockhashValid","params":["<blockhash>","<config>"],"jsonrpc":"2.0"},
)
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet, devnet, testnet.
- 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.