Documentation index

getBlock

Returns the identity and transaction information for a confirmed block in the ledger. This method is essential for block explorers, indexers, and analytics services that need to inspect the complete contents of a specific slot. It returns transaction details, rewards, and block metadata including the blockhash, parent slot, and block time.

Parameters

#TypeRequiredDescription
1u64YesSlot number of the block to retrieve, as a u64 integer
2objectNoConfiguration object

Configuration object fields:

FieldTypeDescription
commitmentstringCommitment level: processed, confirmed, or finalized (default finalized)
encodingstringTransaction encoding: json, jsonParsed, base58, or base64 (default json)
transactionDetailsstringDetail level: full, accounts, signatures, or none (default full)
maxSupportedTransactionVersionnumberMax transaction version to return. If omitted, only legacy transactions are returned
rewardsboolWhether to populate the rewards array (default true)

Response

Returns null if the block is not available. Otherwise returns an object:

FieldTypeDescription
blockhashstringThe blockhash of this block (base-58)
previousBlockhashstringThe blockhash of the parent block
parentSlotu64The slot index of the parent block
transactionsarrayArray of transaction objects if transactionDetails is not none
rewardsarrayArray of reward objects if rewards is true
blockTime`i64null`
blockHeight`u64null`

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": "getBlock",
  "params": [
    166974442,
    {
      "encoding": "jsonParsed",
      "maxSupportedTransactionVersion": 0,
      "transactionDetails": "full",
      "rewards": false
    }
  ]
}'

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: "getBlock",
    params: [
      166974442,
      {
        encoding: "jsonParsed",
        maxSupportedTransactionVersion: 0,
        transactionDetails: "full",
        rewards: false
      }
    ]
  }),
});
const { result } = await response.json();
console.log("Block hash:", result.blockhash);

Python

Python
import requests

response = requests.post("http://88.216.36.108:7999", json={
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getBlock",
    "params": [
        166974442,
        {
            "encoding": "jsonParsed",
            "maxSupportedTransactionVersion": 0,
            "transactionDetails": "full",
            "rewards": False
        }
    ]
})
result = response.json()["result"]
print(f"Block hash: {result['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": "getBlock",
            "params": [
                166974442_u64,
                {"encoding": "jsonParsed", "maxSupportedTransactionVersion": 0, "transactionDetails": "full", "rewards": false}
            ]
        }))
        .send().await?
        .text().await?;
    println!("{}", res);
    Ok(())
}

Example Response

JSON
{
  "jsonrpc": "2.0",
  "result": {
    "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
    "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
    "parentSlot": 166974441,
    "transactions": [],
    "blockTime": 1681391935,
    "blockHeight": 150676031
  },
  "id": 1
}