88 lines
1.7 KiB
Plaintext
88 lines
1.7 KiB
Plaintext
import {
|
|
DocBlock,
|
|
DocSideBySide,
|
|
CodeParams,
|
|
Parameter,
|
|
Field,
|
|
Values,
|
|
CodeSnippets,
|
|
} from "../../../components/CodeDocBlock";
|
|
|
|
<DocBlock>
|
|
|
|
## getRecentBlockhash
|
|
|
|
:::warning DEPRECATED
|
|
This method is expected to be removed in solana-core v2.0
|
|
**Please use [getLatestBlockhash](#getlatestblockhash) instead**
|
|
:::
|
|
|
|
Returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.
|
|
|
|
<DocSideBySide>
|
|
|
|
<CodeParams>
|
|
|
|
### Parameters:
|
|
|
|
<Parameter type={"string"} required={true}>
|
|
Pubkey of account to query, 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>
|
|
|
|
</Parameter>
|
|
|
|
### Result:
|
|
|
|
An RpcResponse containing a JSON object consisting of a string blockhash and FeeCalculator JSON object.
|
|
|
|
- `RpcResponse<object>` - RpcResponse JSON object with `value` field set to a JSON object including:
|
|
- `blockhash: <string>` - a Hash as base-58 encoded string
|
|
- `feeCalculator: <object>` - FeeCalculator object, the fee schedule for this block hash
|
|
|
|
</CodeParams>
|
|
|
|
<CodeSnippets>
|
|
|
|
### Code sample:
|
|
|
|
```bash
|
|
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
|
|
{"jsonrpc":"2.0","id":1, "method":"getRecentBlockhash"}
|
|
'
|
|
```
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"result": {
|
|
"context": {
|
|
"slot": 1
|
|
},
|
|
"value": {
|
|
"blockhash": "CSymwgTNX1j3E4qhKfJAUE41nBWEwXufoYryPbkde5RR",
|
|
"feeCalculator": {
|
|
"lamportsPerSignature": 5000
|
|
}
|
|
}
|
|
},
|
|
"id": 1
|
|
}
|
|
```
|
|
|
|
</CodeSnippets>
|
|
</DocSideBySide>
|
|
</DocBlock>
|