getRecentBlockhash
Deprecated: This method is deprecated. Use
getLatestBlockhashinstead.
Returns a recent blockhash from the ledger and a fee schedule that can be used to compute the cost of submitting a transaction. This method has been deprecated in favor of getLatestBlockhash, which provides the same blockhash along with a lastValidBlockHeight for more reliable transaction expiration handling. All new applications should use getLatestBlockhash instead.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | object | No | Configuration object |
Configuration object fields:
| Field | Type | Description |
|---|---|---|
commitment | string | Commitment level: processed, confirmed, or finalized |
Response
Returns an RpcResponse object:
| Field | Type | Description |
|---|---|---|
context.slot | u64 | The slot at which the value was read |
value.blockhash | string | A recent blockhash (base-58) |
value.feeCalculator.lamportsPerSignature | u64 | Fee per signature in lamports |
Code Examples
cURL
curl http://88.216.36.108:7999 -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getRecentBlockhash",
"params": []
}'TypeScript
const response = await fetch("http://88.216.36.108:7999", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "getRecentBlockhash",
params: []
}),
});
const { result } = await response.json();
console.log("Blockhash:", result.value.blockhash);Python
import requests
response = requests.post("http://88.216.36.108:7999", json={
"jsonrpc": "2.0",
"id": 1,
"method": "getRecentBlockhash",
"params": []
})
result = response.json()["result"]
print(f"Blockhash: {result['value']['blockhash']}")Rust
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("http://88.216.36.108:7999")
.json(&json!({
"jsonrpc": "2.0",
"id": 1,
"method": "getRecentBlockhash",
"params": []
}))
.send().await?
.text().await?;
println!("{}", res);
Ok(())
}Example Response
{
"jsonrpc": "2.0",
"result": {
"context": { "slot": 123456789 },
"value": {
"blockhash": "GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ",
"feeCalculator": { "lamportsPerSignature": 5000 }
}
},
"id": 1
}