# isBlockhashValid

> Checks whether a blockhash is still recent enough to be accepted by the network.

Source: https://docs.constant-k.com/rpc/http/isblockhashvalid/

`isBlockhashValid` checks whether a blockhash is still within the network's acceptance window, without tracking block heights independently.

A `false` result on a pending transaction's blockhash means no amount of waiting or rebroadcasting will help; only a new transaction with a fresh blockhash succeeds.

- Transport: HTTP, JSON-RPC 2.0 `POST` to `https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY` (New York) or `https://rpc-frankfurt.constant-k.com/?api-key=YOUR_API_KEY` (Frankfurt) or `https://rpc-amsterdam.constant-k.com/?api-key=YOUR_API_KEY` (Amsterdam). The key also works as an `x-api-key` header.
- Category: Fees & Blockhash
- Availability: All plans
- Rate limits: Free 5/s · Operator 50/s · Blade Runner 200/s · Nexus 500/s

## Parameters

`params` is a positional JSON array, in this order:

- `blockhash` (string, required): The blockhash to check, base-58 encoded.
- `config` (object, optional): Optional configuration.
  - `commitment` (string, optional, one of `finalized`, `confirmed`, `processed`, default `"finalized"`): Bank state to check the blockhash against.
  - `minContextSlot` (integer, optional): Minimum slot the node must have processed before answering.

## Result

- `result` (object, optional): Whether the blockhash is still valid, wrapped with context.
  - `context` (object, required)
    - `slot` (integer, optional)
    - `apiVersion` (string, optional)
  - `value` (boolean, required): True if the blockhash is still recent enough to be accepted; false if it has expired.

## Example: Check a blockhash that has expired

Request:

```bash
curl "https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "isBlockhashValid",
    "params": ["5p337k1MsPKeS2BgMpkP74BegPfJ9mjsNo5kcb1ns5iQ"]
  }'
```

Response:

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "4.3.0-rc.0",
      "slot": 447947042
    },
    "value": false
  },
  "id": 1
}
```

## Example: Check a blockhash right after fetching it

Request:

```bash
curl "https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "isBlockhashValid",
    "params": ["Bm73g62Ry6G5CSXBn9AV1ZNRwWdV8EeDMNmu6fBE46Lg"]
  }'
```

Response:

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "4.3.0-rc.0",
      "slot": 447947142
    },
    "value": true
  },
  "id": 1
}
```

## Notes

- A blockhash is valid for about 150 blocks, roughly a minute, from when it was produced. Both examples use the same blockhash: the second call ran seconds after fetching it (`true`), the first long enough later to have expired (`false`).
- This says nothing about a transaction's status; `getSignatureStatuses`, considered alongside it, informs whether to give up or resubmit.

