Documentation index

getFees

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

Returns a recent block hash from the ledger, a fee schedule that can be used to compute the cost of submitting a transaction, and the last slot in which the blockhash will be valid. This method has been deprecated in favor of the combination of getLatestBlockhash and getFeeForMessage, which provide a cleaner separation of concerns and support for the newer fee model.

Parameters

#TypeRequiredDescription
1objectNoConfiguration object

Configuration object fields:

FieldTypeDescription
commitmentstringCommitment level: processed, confirmed, or finalized

Response

Returns an RpcResponse object:

FieldTypeDescription
context.slotu64The slot at which the fees were read
value.blockhashstringA recent blockhash
value.feeCalculator.lamportsPerSignatureu64Fee per signature in lamports
value.lastValidSlotu64Last slot in which the blockhash will be valid
value.lastValidBlockHeightu64Last block height at which the blockhash will be valid

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": "getFees",
  "params": []
}'

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: "getFees",
    params: []
  }),
});
const { result } = await response.json();
console.log("Blockhash:", result.value.blockhash);

Python

Python
import requests

response = requests.post("http://88.216.36.108:7999", json={
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getFees",
    "params": []
})
result = response.json()["result"]
print(f"Blockhash: {result['value']['blockhash']}")

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

Example Response

JSON
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 123456789 },
    "value": {
      "blockhash": "GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ",
      "feeCalculator": { "lamportsPerSignature": 5000 },
      "lastValidSlot": 123456939,
      "lastValidBlockHeight": 150676181
    }
  },
  "id": 1
}