getBlock
https://api.triport.io/v1/solReturns identity and transaction information about a confirmed block in the Solana ledger.
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)requiredconfigobjectoptionalencodingstringoptionaljson, jsonParsed, base58, or base64. Defaults to json.transactionDetailsstringoptionalfull, accounts, signatures, or none. Defaults to full.rewardsbooleanoptionalrewards array. Defaults to true.commitmentstringoptionalconfirmed or finalized. processed is not supported for this method.maxSupportedTransactionVersionintegeroptional0 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.
resultobjectBlock object, or null if the slot was skipped.result.blockhashstring (base-58 hash)result.previousBlockhashstring (base-58 hash)result.parentSlotinteger (u64)result.blockHeightintegerresult.blockTimeintegernull if not available.result.transactionsarraytransactionDetails is full or accounts; each entry holds the transaction and its meta.result.signaturesarray of stringtransactionDetails is signatures; the transaction signatures in the block.result.rewardsarrayrewards: 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.
| Code | Meaning | When it happens |
|---|---|---|
-32602 | Invalid params | slot is missing or not an integer, or config is malformed (e.g. commitment: "processed"). |
-32004 | Block not available | The block for the requested slot is not available on the node yet. |
-32007 | Slot skipped | The slot was skipped, or missing due to ledger jump to recent snapshot. |
-32009 | Slot skipped (long-term storage) | The slot was skipped, or missing in long-term storage. |
401 | Unauthorized | Missing or invalid Authorization: Bearer key. |
429 | Rate limited | More than your tier's RPS for sol_read_rpc (20 / 60 / 200 / 600). |
Examples
JavaScript (fetch)
const res = await fetch("https://api.triport.io/v1/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`);TypeScript SDK (@triport/sdk)
import { TriportClient } from "@triport/sdk";
const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY });
const block = await client.solana.getBlock(348392040, {
transactionDetails: "signatures",
rewards: false,
maxSupportedTransactionVersion: 0,
commitment: "finalized",
});
console.log(`Blockhash ${block.blockhash}, ${block.signatures.length} txs`);Python (triport-sdk)
import os
from datetime import datetime, timezone
from triport import TriportClient
client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])
block = client.solana.get_block(
348392040,
transaction_details="signatures",
rewards=False,
max_supported_transaction_version=0,
commitment="finalized",
)
produced = datetime.fromtimestamp(block["blockTime"], tz=timezone.utc)
print(f"Block height {block['blockHeight']} produced at {produced.isoformat()}")
print(f"{len(block['signatures'])} transactions")Notes
processedis not a valid commitment here — useconfirmedorfinalized. Passingprocessedyields 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 to0to receive versioned transactions alongside legacy ones. - Shape the payload: full blocks can be large. Use
transactionDetails: "signatures"or"none"andrewards: falseto keep responses small when you only need a summary. - Related methods: use
getBlocks/getBlockTimeto discover and time slots,getBlockHeightfor the current height, andgetSlotfor the slot the cluster has reached.