in-solana by Supanode

getBlock — Solana RPC Method

getBlock returns the full contents of a confirmed block, including its transactions, rewards, and metadata. This is the primary method for reading historical block data from the Solana ledger.

Parameters

NameTypeRequiredDescription
slotu64YesSlot number of the block to query.
commitmentstringNoconfirmed or finalized. processed is not supported. Default: finalized.
encodingstringNoTransaction encoding: json, jsonParsed, base58, base64. Default: json.
transactionDetailsstringNofull, accounts, signatures, none. Default: full.
maxSupportedTransactionVersionnumberNoSet to 0 to include versioned transactions (v0). Omitting excludes them.
rewardsboolNoWhether to include the rewards array. Default: true.

Request

curl -X POST https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getBlock",
    "params": [
      311857920,
      {
        "encoding": "jsonParsed",
        "transactionDetails": "full",
        "maxSupportedTransactionVersion": 0
      }
    ]
  }'

TypeScript (@solana/kit)

import { createSolanaRpc } from "@solana/kit";

const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
const block = await rpc
  .getBlock(311857920n, {
    encoding: "jsonParsed",
    transactionDetails: "full",
    maxSupportedTransactionVersion: 0,
  })
  .send();

console.log(`Transactions: ${block?.transactions.length}`);

Response

{
  "jsonrpc": "2.0",
  "result": {
    "blockHeight": 289442880,
    "blockTime": 1729000000,
    "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
    "parentSlot": 311857919,
    "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
    "transactions": [
      {
        "meta": {
          "err": null,
          "fee": 5000,
          "preBalances": [100000000, 50000000],
          "postBalances": [99995000, 50005000],
          "computeUnitsConsumed": 150
        },
        "transaction": { "...": "..." },
        "version": 0
      }
    ],
    "rewards": [
      {
        "pubkey": "validator-pubkey",
        "lamports": 5000,
        "postBalance": 1000000000,
        "rewardType": "fee",
        "commission": null
      }
    ]
  },
  "id": 1
}
FieldTypeDescription
blockHeightu64 or nullThe number of blocks beneath this block. null if not yet available.
blockTimei64 or nullEstimated Unix timestamp (seconds) of when the block was produced.
blockhashstringThe blockhash of this block.
parentSlotu64The slot of this block’s parent.
previousBlockhashstringThe blockhash of this block’s parent.
transactionsarrayList of transaction objects (format depends on transactionDetails and encoding).
rewardsarrayBlock rewards, including validator fees and staking rewards.

When the block is not available (skipped slot or pruned ledger), the result is null.

Transaction detail levels

  • full: returns the complete transaction with all instructions and metadata.
  • accounts: returns only the account keys involved, with pre/post balances. Useful for balance tracking.
  • signatures: returns only the transaction signatures.
  • none: omits transactions entirely. Useful when you only need block metadata or rewards.

Common errors

  • Block not available — the slot was skipped (no leader produced a block) or has been pruned from the ledger. The result is null.
  • Versioned transactions excluded — omitting maxSupportedTransactionVersion causes versioned (v0) transactions to be excluded or the request to fail. Always set it to 0.
  • Slot too old — validators prune old ledger data. Most RPC providers keep only the last ~2 days of blocks. For historical data, use an archival RPC endpoint.

Performance

getBlock with transactionDetails: "full" returns large responses. A busy mainnet block can contain 2000+ transactions and produce 5-10 MB of JSON. Use transactionDetails: "signatures" or "none" when you do not need full transaction data. The base64 encoding is more compact than json for transport.

FAQ

Why does getBlock return null? The slot was either skipped (no block produced) or the block has been pruned from the ledger. Solana validators do not produce a block for every slot — a skipped slot means no leader was scheduled or the leader missed its turn.

How do I include versioned transactions? Set maxSupportedTransactionVersion to 0 in the config object. Without this parameter, version 0 transactions may be excluded.

What is the difference between slot and block height? A slot is the time window assigned to a validator. Block height counts only slots where a block was actually produced. Skipped slots increment the slot number but not the block height.

How far back can I query blocks? Most RPC providers keep approximately the last 2 epochs (~4 days) of block data. For older blocks, use a dedicated archival RPC service.

What are block rewards? Rewards include transaction fees distributed to the block’s validator and, at epoch boundaries, staking rewards. The rewardType field indicates fee, rent, staking, or voting.

Parameters

ParameterTypeRequiredDescriptionDefault
slotu64YesSlot number of the block to query.—
commitmentstringNoprocessed is not supported. Use confirmed or finalized.finalized
encodingstringNoTransaction encoding: json, jsonParsed, base58, base64.json
transactionDetailsstringNoLevel of detail: full, accounts, signatures, none.full
maxSupportedTransactionVersionnumberNoMaximum transaction version to return. Set to 0 for versioned transactions.—
rewardsboolNoWhether to populate the rewards array.true

Updated: