solana/docs/src/api/methods/_isBlockhashValid.mdx

90 lines
1.5 KiB
Plaintext

import {
DocBlock,
DocSideBySide,
CodeParams,
Parameter,
Field,
Values,
CodeSnippets,
} from "../../../components/CodeDocBlock";
<DocBlock>
## isBlockhashValid
Returns whether a blockhash is still valid or not
:::caution
NEW: This method is only available in solana-core v1.9 or newer. Please use
[getFeeCalculatorForBlockhash](#getfeecalculatorforblockhash) for solana-core v1.8
:::
<DocSideBySide>
<CodeParams>
### Parameters:
<Parameter type={"string"} required={true}>
the blockhash of the block to evauluate, as base-58 encoded string
</Parameter>
<Parameter type={"object"} optional={true}>
Configuration object containing the following fields:
<Field
name="commitment"
type="string"
optional={true}
href="/api/http#configuring-state-commitment"
></Field>
<Field name="minContextSlot" type="number" optional={true}>
The minimum slot that the request can be evaluated at
</Field>
</Parameter>
### Result:
`<bool>` - `true` if the blockhash is still valid
</CodeParams>
<CodeSnippets>
### Code sample:
```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
{
"id":45,
"jsonrpc":"2.0",
"method":"isBlockhashValid",
"params":[
"J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW",
{"commitment":"processed"}
]
}
'
```
### Response:
```json
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 2483
},
"value": false
},
"id": 1
}
```
</CodeSnippets>
</DocSideBySide>
</DocBlock>