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
| Name | Type | Required | Description |
|---|---|---|---|
slot | u64 | Yes | Slot number of the block to query. |
commitment | string | No | confirmed or finalized. processed is not supported. Default: finalized. |
encoding | string | No | Transaction encoding: json, jsonParsed, base58, base64. Default: json. |
transactionDetails | string | No | full, accounts, signatures, none. Default: full. |
maxSupportedTransactionVersion | number | No | Set to 0 to include versioned transactions (v0). Omitting excludes them. |
rewards | bool | No | Whether 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
}
| Field | Type | Description |
|---|---|---|
blockHeight | u64 or null | The number of blocks beneath this block. null if not yet available. |
blockTime | i64 or null | Estimated Unix timestamp (seconds) of when the block was produced. |
blockhash | string | The blockhash of this block. |
parentSlot | u64 | The slot of this block’s parent. |
previousBlockhash | string | The blockhash of this block’s parent. |
transactions | array | List of transaction objects (format depends on transactionDetails and encoding). |
rewards | array | Block 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
maxSupportedTransactionVersioncauses versioned (v0) transactions to be excluded or the request to fail. Always set it to0. - 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
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
slot | u64 | Yes | Slot number of the block to query. | — |
commitment | string | No | processed is not supported. Use confirmed or finalized. | finalized |
encoding | string | No | Transaction encoding: json, jsonParsed, base58, base64. | json |
transactionDetails | string | No | Level of detail: full, accounts, signatures, none. | full |
maxSupportedTransactionVersion | number | No | Maximum transaction version to return. Set to 0 for versioned transactions. | — |
rewards | bool | No | Whether to populate the rewards array. | true |
Updated: