getBlock — Solana JSON-RPC

Status: Available

Returns identity and transaction information about a confirmed block in the Solana ledger.

POSThttps://triport.io/sol
Network
Solana
Scope
sol_read_rpc
Auth
x-token: $TRIPORT_API_KEY (or Authorization: Bearer)
Rate limit
free+ — 20 / 60 / 200 / 600 RPS sustained · short burst 40 / 120 / 400 / 1200 (free / basic / pro / business); Burst capacity

Endpoint and plans: Solana RPC endpoint.

getBlock returns the contents of a confirmed block at a given slot: its blockhash, the parent slot it builds on, the block height and block time, and — depending on the config you pass — the full list of transactions, just their account keys, just their signatures, or none of them.

Use it to inspect or index ledger history: replay the transactions in a block, correlate on-chain activity to a wall-clock time via blockTime, or walk the chain by following parentSlot. Because a fully-detailed block can be large, shape the response with transactionDetails and rewards to fetch only what you need.

Not every slot produces a block (slots can be skipped). If you request a slot that was skipped or is not available in the node's ledger, the call returns a JSON-RPC error rather than an empty result — see Errors.

Parameters

JSON-RPC params is a positional array: [slot, config?].

slotinteger (u64)required
The slot of the block to retrieve.
configobjectoptional
Optional configuration object (see below).
encodingstringoptional
Transaction encoding: json, jsonParsed, base58, or base64. Defaults to json.
transactionDetailsstringoptional
Level of transaction detail to return: full, accounts, signatures, or none. Defaults to full.
rewardsbooleanoptional
Whether to populate the rewards array. Defaults to true.
commitmentstringoptional
Commitment level: confirmed or finalized. processed is not supported for this method.
maxSupportedTransactionVersionintegeroptional
Highest transaction version to return. Omit to receive only legacy transactions; set 0 to also return versioned (v0) transactions.

Response

The example uses transactionDetails: "signatures", so transactions is omitted and the block's transaction signatures are returned in signatures instead.

With the default transactionDetails: "full", the response instead carries a transactions array — each entry an object with transaction (encoded per encoding) and meta (fee, balances, logs, status) — and signatures is omitted.

resultobject
The Block object, or null if the slot was skipped.
result.blockhashstring (base-58 hash)
The block's blockhash.
result.previousBlockhashstring (base-58 hash)
The blockhash of the parent block.
result.parentSlotinteger (u64)
The slot of the parent block.
result.blockHeightinteger
The number of blocks beneath this block.
result.blockTimeinteger
Estimated production time as a Unix timestamp (seconds). May be null if not available.
result.transactionsarray
Present when transactionDetails is full or accounts; each entry holds the transaction and its meta.
result.signaturesarray of string
Present when transactionDetails is signatures; the transaction signatures in the block.
result.rewardsarray
Block rewards (e.g. staking, fees). Empty or omitted when rewards: false.

Errors

Errors are returned in the standard JSON-RPC error envelope. See the shared errors reference for the full envelope shape and shared codes.

CodeMeaningWhen it happens
-32602Invalid paramsslot is missing or not an integer, or config is malformed (e.g. commitment: "processed").
-32001Block cleaned upThe block for this slot existed and was served in the past, but the node has since pruned it from its ledger retention.
-32004Block not availableThe block for the requested slot is not available on the node yet.
-32007Slot skippedThe slot was skipped, or missing due to ledger jump to recent snapshot.
-32009Slot skipped (long-term storage)The slot was skipped, or missing in long-term storage.
401UnauthorizedMissing or invalid Authorization: Bearer key.
429Rate limitedMore than your tier's RPS for sol_read_rpc (20 / 60 / 200 / 600).

Examples

JavaScript (fetch)

const res = await fetch("https://triport.io/sol", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getBlock",
    params: [
      348392040,
      { transactionDetails: "signatures", rewards: false, maxSupportedTransactionVersion: 0 },
    ],
  }),
});


const { result } = await res.json();
console.log(`Block ${result.blockHeight} @ slot ${result.parentSlot + 1}`);
console.log(`Produced at ${new Date(result.blockTime * 1000).toISOString()}`);
console.log(`${result.signatures.length} transactions`);

Notes

  • processed is not a valid commitment here — use confirmed or finalized. Passing processed yields an invalid-params error.
  • Skipped slots: not every slot produces a block. Requesting a skipped slot returns a slot-skipped error (-32007 / -32009), not an empty block — handle it as expected for sparse ranges.
  • Versioned transactions: if a block contains v0 transactions and you omit maxSupportedTransactionVersion, the request fails. Set it to 0 to receive versioned transactions alongside legacy ones.
  • Shape the payload: full blocks can be large. Use transactionDetails: "signatures" or "none" and rewards: false to keep responses small when you only need a summary.
  • Related methods: use getBlocks / getBlockTime to discover and time slots, getBlockHeight for the current height, and getSlot for the slot the cluster has reached.
  • Got -32001 for a slot that used to work? See why getBlock returns -32001 for a cleaned-up block for how it differs from -32004, -32007 and -32009, the other three slot errors this method can return.