Source
is_blockhash_validParameters
blockhash
The blockhash of the block to evaluate, as base-58 encoded string
config
Configuration object containing the following fields:
Result
result
RpcResponse object containing:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
RPC methods
CLI reference
Network constants
curl https://api.devnet.solana.com -s -X POST \
-H "Content-Type: application/json" \
-d '
{
"jsonrpc": "2.0",
"id": 45,
"method": "isBlockhashValid",
"params": [
"J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW",
{
"commitment": "processed"
}
]
}
'
import { createSolanaRpc, type Blockhash } from "@solana/kit";
const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);
let blockhash = "J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW";
let isValid = await rpc.isBlockhashValid(blockhash as Blockhash).send();
console.log(isValid);
import { Connection, clusterApiUrl, type Blockhash } from "@solana/web3.js";
const connection = new Connection(clusterApiUrl("devnet"), "confirmed");
let blockhash = "J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW" as Blockhash;
let isValid = await connection.isBlockhashValid(blockhash);
console.log(isValid);
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
use solana_sdk::hash::Hash;
use std::str::FromStr;
#[tokio::main]
async fn main() -> Result<()> {
let client = RpcClient::new_with_commitment(
String::from("https://api.devnet.solana.com"),
CommitmentConfig::confirmed(),
);
let blockhash = Hash::from_str("J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW")?;
let is_valid = client
.is_blockhash_valid(&blockhash, CommitmentConfig::finalized())
.await?;
println!("{:#?}", is_valid);
Ok(())
}
{
"jsonrpc": "2.0",
"result": {
"context": { "apiVersion": "4.3.2", "slot": 2483 },
"value": false
},
"id": 45
}
Returns whether a blockhash is still valid at the requested commitment.
curl https://api.devnet.solana.com -s -X POST \
-H "Content-Type: application/json" \
-d '
{
"jsonrpc": "2.0",
"id": 45,
"method": "isBlockhashValid",
"params": [
"J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW",
{
"commitment": "processed"
}
]
}
'
import { createSolanaRpc, type Blockhash } from "@solana/kit";
const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);
let blockhash = "J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW";
let isValid = await rpc.isBlockhashValid(blockhash as Blockhash).send();
console.log(isValid);
import { Connection, clusterApiUrl, type Blockhash } from "@solana/web3.js";
const connection = new Connection(clusterApiUrl("devnet"), "confirmed");
let blockhash = "J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW" as Blockhash;
let isValid = await connection.isBlockhashValid(blockhash);
console.log(isValid);
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
use solana_sdk::hash::Hash;
use std::str::FromStr;
#[tokio::main]
async fn main() -> Result<()> {
let client = RpcClient::new_with_commitment(
String::from("https://api.devnet.solana.com"),
CommitmentConfig::confirmed(),
);
let blockhash = Hash::from_str("J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW")?;
let is_valid = client
.is_blockhash_valid(&blockhash, CommitmentConfig::finalized())
.await?;
println!("{:#?}", is_valid);
Ok(())
}
{
"jsonrpc": "2.0",
"result": {
"context": { "apiVersion": "4.3.2", "slot": 2483 },
"value": false
},
"id": 45
}
is_blockhash_validShow propertiesHide properties
processed, confirmed, finalizedSolana RPC uses the following commitment levels:| Value | Description |
|---|---|
processed | Return data from the highest slot this node has processed. This is the newest view, but the block can still be skipped. |
confirmed | Return data from the same slot as finalized. Kept for compatibility and planned for removal in a later release. |
finalized | Return data from the highest slot with a finalization certificate, from votes by 80% of stake in one round or 60% of stake in each of two rounds. This is the strongest commitment level. |
{ "minContextSlot": 341197000 }
Show propertiesHide properties
| Field | Type | Description |
|---|---|---|
slot | u64 | Slot at which the node evaluated this request. |
apiVersion | string | RPC API version reported by the node. This field may be omitted by older nodes. |