getConfirmedBlock

Deprecated: This method is deprecated. Use getBlock instead.

Returns identity and transaction information about a confirmed block in the ledger. This method has been deprecated in favor of getBlock, which provides the same functionality with improved API consistency and support for versioned transactions. Existing integrations should migrate to getBlock as this endpoint may be removed in future validator releases.

Parameters

#TypeRequiredDescription
1u64YesSlot number of the confirmed block
2objectNoConfiguration object

Configuration object fields:

FieldTypeDescription
encodingstringTransaction encoding: json, jsonParsed, base58, or base64
transactionDetailsstringDetail level: full, signatures, or none
rewardsboolWhether to include rewards
commitmentstringCommitment level: confirmed or finalized

Response

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

FieldTypeDescription
blockhashstringBlockhash of this block
previousBlockhashstringBlockhash of the parent block
parentSlotu64Slot index of the parent block
transactionsarrayArray of transaction objects
rewardsarrayArray of reward objects
blockTime`i64null`

Code Examples

cURL

1curl http://[IP_ADDRESS]:[PORT] -X POST -H "Content-Type: application/json" -d '{
2  "jsonrpc": "2.0",
3  "id": 1,
4  "method": "getConfirmedBlock",
5  "params": [
6    166974442,
7    { "encoding": "json", "transactionDetails": "full", "rewards": false }
8  ]
9}'

TypeScript

1const response = await fetch("http://[IP_ADDRESS]:[PORT]", {
2  method: "POST",
3  headers: { "Content-Type": "application/json" },
4  body: JSON.stringify({
5    jsonrpc: "2.0",
6    id: 1,
7    method: "getConfirmedBlock",
8    params: [
9      166974442,
10      { encoding: "json", transactionDetails: "full", rewards: false }
11    ]
12  }),
13});
14const { result } = await response.json();
15console.log("Block hash:", result.blockhash);

Python

1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4    "jsonrpc": "2.0",
5    "id": 1,
6    "method": "getConfirmedBlock",
7    "params": [
8        166974442,
9        {"encoding": "json", "transactionDetails": "full", "rewards": False}
10    ]
11})
12result = response.json()["result"]
13print(f"Block hash: {result['blockhash']}")

Rust

1use reqwest::Client;
2use serde_json::json;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    let client = Client::new();
7    let res = client.post("http://[IP_ADDRESS]:[PORT]")
8        .json(&json!({
9            "jsonrpc": "2.0",
10            "id": 1,
11            "method": "getConfirmedBlock",
12            "params": [
13                166974442_u64,
14                {"encoding": "json", "transactionDetails": "full", "rewards": false}
15            ]
16        }))
17        .send().await?
18        .text().await?;
19    println!("{}", res);
20    Ok(())
21}

Example Response

1{
2  "jsonrpc": "2.0",
3  "result": {
4    "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
5    "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
6    "parentSlot": 166974441,
7    "transactions": [],
8    "blockTime": 1681391935
9  },
10  "id": 1
11}