---
title: isBlockhashValid
description: >-
  Returns whether a blockhash is still valid at the requested commitment.
url: /docs/rpc/http/isblockhashvalid
type: reference
hideTableOfContents: true
---

Returns whether a blockhash is still valid at the requested commitment.

<Callout type="info" title="Source">
  [`is_blockhash_valid`](https://github.com/anza-xyz/agave/blob/v3.1.8/rpc/src/rpc.rs#L2367)
</Callout>

<APIMethod>

```jsonc !!request curl
{
  "jsonrpc": "2.0",
  "id": 45,
  "method": "isBlockhashValid",
  "params": [
    // !hover blockhash
    "J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW",
    // !hover(1:3) config
    {
      // !hover commitment
      "commitment": "processed"
    }
  ]
}
```

```ts !!request title="Kit"
import { createSolanaRpc, type Blockhash } from "@solana/kit";

const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);

// !hover blockhash
let blockhash = "J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW";

let isValid = await rpc.isBlockhashValid(blockhash as Blockhash).send();

console.log(isValid);
```

```ts !!request title="web3.js"
import { Connection, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection(clusterApiUrl("devnet"), "confirmed");

// !hover blockhash
let blockhash = "J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW";

let isValid = await connection.isBlockhashValid(blockhash);

console.log(isValid);
```

```rs !!request title="Rust"
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(),
    );

    // !hover blockhash
    let blockhash = Hash::from_str("J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW")?;

    let is_valid = client
        .is_blockhash_valid(&blockhash, CommitmentConfig::finalized())
        .await?;

    println!("{:#?}", is_valid);

    Ok(())
}
```

### !params

#### !! blockhash

!type string  
!required

The blockhash of the block to evaluate, as base-58 encoded string

#### !! config

!type object

Configuration object containing the following fields:

##### !! commitment

!type string  
!values processed confirmed finalized  
!default finalized

Solana RPC uses the following commitment levels:

| Value       | Description                                                                                                                                                                                                                                                                |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `processed` | Return data from the highest slot this node has processed on the fork it currently considers best. This is the newest view, but it can still change if the cluster switches forks.                                                                                         |
| `confirmed` | Return data from the highest slot that at least two-thirds of active stake has directly voted to confirm. This is more stable than `processed`, but it is still a weaker guarantee than `finalized`.                                                                       |
| `finalized` | Return data from the highest slot that the cluster recognizes as finalized. In practice, this means the slot has reached maximum vote lockout in validators' vote towers and is recognized by at least two-thirds of active stake. This is the strongest commitment level. |

##### !! minContextSlot

!type number

The minimum slot that the request can be evaluated at

```json title="Example"
{ "minContextSlot": 341197000 }
```

### !!result

```jsonc !response
{
  "jsonrpc": "2.0",
  // !hover(1:4) result
  "result": {
    // !hover context
    "context": { "apiVersion": "3.1.8", "slot": 2483 },
    // !hover value
    "value": false
  },
  "id": 45
}
```

!type object

RpcResponse object containing:

#### !! context

!type object

Slot and API version the node used to answer this request.

| 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. |

#### !! value

!type bool

Whether the blockhash is still valid at the evaluated slot.

</APIMethod>
