Documentation index

getFeeCalculatorForBlockhash

Deprecated: This method is deprecated. Use getFeeForMessage with getLatestBlockhash instead.

Returns the fee calculator associated with the query blockhash, or null if the blockhash has expired. This method has been deprecated as part of the transition from the legacy fee model to the newer message-based fee calculation. Use getFeeForMessage combined with getLatestBlockhash for current fee estimation in all new applications.

Parameters

#TypeRequiredDescription
1stringYesBase-58 encoded blockhash to query
2objectNoConfiguration object

Configuration object fields:

FieldTypeDescription
commitmentstringCommitment level: processed, confirmed, or finalized
minContextSlotnumberMinimum slot at which the request can be evaluated

Response

Returns an RpcResponse object:

FieldTypeDescription
context.slotu64The slot at which the value was read
value`objectnull`
value.feeCalculator.lamportsPerSignatureu64Fee in lamports per signature

Code Examples

cURL

Terminal
curl http://88.216.36.108:7999 -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getFeeCalculatorForBlockhash",
  "params": [
    "GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ",
    { "commitment": "confirmed" }
  ]
}'

TypeScript

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: "getFeeCalculatorForBlockhash",
    params: [
      "GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ",
      { commitment: "confirmed" }
    ]
  }),
});
const { result } = await response.json();
console.log("Fee:", result.value?.feeCalculator.lamportsPerSignature, "lamports");

Python

Python
import requests

response = requests.post("http://88.216.36.108:7999", json={
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getFeeCalculatorForBlockhash",
    "params": [
        "GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ",
        {"commitment": "confirmed"}
    ]
})
result = response.json()["result"]
print(f"Fee: {result['value']['feeCalculator']['lamportsPerSignature']} lamports")

Rust

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": "getFeeCalculatorForBlockhash",
            "params": [
                "GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ",
                {"commitment": "confirmed"}
            ]
        }))
        .send().await?
        .text().await?;
    println!("{}", res);
    Ok(())
}

Example Response

JSON
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 123456789 },
    "value": {
      "feeCalculator": {
        "lamportsPerSignature": 5000
      }
    }
  },
  "id": 1
}