getBlock
Returns identity and transaction information about a confirmed block in the ledger
Common use cases
| Block Explorer Transaction Display | Retrieve complete block with all transactions for explorer UI. Use transactionDetails: "full", encoding: "jsonParsed", and maxSupportedTransactionVersion: 0 to display human-readable transaction data including decoded instructions and account names. |
| Signature-Only Block Scanning | Lightweight block retrieval for indexers tracking transaction signatures. Use transactionDetails: "signatures" to reduce payload size by 80% - returns only signature list without full transaction data, enabling high-throughput signature indexing. |
| Historical Block Analysis with Rewards | Fetch blocks with validator rewards for performance analytics and staking dashboards. Use rewards: true with commitment: "finalized" to retrieve immutable historical data including block rewards distribution for validator performance tracking. |
| Versioned Transaction Support | Handle blocks containing versioned transactions (v0 transactions using address lookup tables). Must include maxSupportedTransactionVersion: 0 parameter to avoid error -32015; without this, only legacy transactions are returned and versioned transactions cause errors. |
Parameters
slot number (u64, required)
Slot number.
config (object, optional)
Configuration object.
Fields:
commitment(string): The commitment describes how finalized a block is at that point in time. See Configuring State Commitment.processedis not supported.
encoding(string): Encoding format for each returned transaction. See Parsed Responses.jsonParsedattempts to use program-specific instruction parsers to return more human-readable and explicit data in thetransaction.message.instructionslist.- If
jsonParsedis requested but a parser cannot be found, the instruction falls back to regular JSON encoding (accounts,data, andprogramIdIndexfields).
transactionDetails(string): Level of transaction detail to return.- If
accountsare requested, transaction details only include signatures and an annotated list of accounts in each transaction. - Transaction metadata is limited to only: fee, err, pre_balances, post_balances, pre_token_balances, and post_token_balances.
- If
maxSupportedTransactionVersion(number): Currently, the only valid value for this parameter is0. Setting it to0allows you to fetch all transactions, including both Versioned and legacy transactions. This parameter determines the maximum transaction version that will be returned in the response. If you request a transaction with a higher version than this value, an error will be returned. If you omit this parameter, only legacy transactions will be returned—any versioned transaction will result in an error.rewards(bool): Whether to populate the rewards array. If parameter not provided, the default includes rewards.
Request
- cURL
- JavaScript
- Python
curl https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getBlock",
"params": [
378967388,
{
"commitment": "finalized",
"encoding": "json",
"transactionDetails": "full",
"maxSupportedTransactionVersion": 0,
"rewards": false
}
]
}'
// Using fetch
const response = await fetch('https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "getBlock",
"params": [
378967388,
{
"commitment": "finalized",
"encoding": "json",
"transactionDetails": "full",
"maxSupportedTransactionVersion": 0,
"rewards": false
}
]
})
});
const data = await response.json();
console.log(data);
import requests
import json
url = 'https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY'
headers = {'Content-Type': 'application/json'}
data = {
"jsonrpc": "2.0",
"id": 1,
"method": "getBlock",
"params": [
378967388,
{
"commitment": "finalized",
"encoding": "json",
"transactionDetails": "full",
"maxSupportedTransactionVersion": 0,
"rewards": false
}
]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
Replace mainnet with devnet in the URL to query devnet instead.
Response
{
"jsonrpc": "2.0",
"result": {
"blockHeight": 428,
"blockTime": null,
"blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
"parentSlot": 429,
"previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
"transactions": [
{
// !collapse(1:13) collapsed
"meta": {
"err": null,
"fee": 5000,
"innerInstructions": [],
"logMessages": [],
"postBalances": [499998932500, 26858640, 1, 1, 1],
"postTokenBalances": [],
"preBalances": [499998937500, 26858640, 1, 1, 1],
"preTokenBalances": [],
"rewards": null,
"status": {
"Ok": null
}
},
// !collapse(1:26) collapsed
"transaction": {
"message": {
"accountKeys": [
"3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe",
"AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc",
"SysvarS1otHashes111111111111111111111111111",
"SysvarC1ock11111111111111111111111111111111",
"Vote111111111111111111111111111111111111111"
],
"header": {
"numReadonlySignedAccounts": 0,
"numReadonlyUnsignedAccounts": 3,
"numRequiredSignatures": 1
},
"instructions": [
{
"accounts": [1, 2, 3, 0],
"data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1",
"programIdIndex": 4
}
],
"recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B"
},
"signatures": [
"2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv"
]
}
}
]
},
"id": 1
}
Response Fields
blockHeight (u64 | null)
The number of blocks beneath this block.
blockTime (i64 | null)
Estimated production time, as Unix timestamp (seconds since the Unix epoch).
null if not available.
blockhash (string)
The blockhash of this block, as base-58 encoded string
parentSlot (u64)
The slot index of this block's parent
previousBlockhash (string)
The blockhash of this block's parent, as base-58 encoded string; if the parent block is not available due to ledger cleanup, this field will return "11111111111111111111111111111111"
transactions (array)
Present if "full" transaction details are requested; an array of JSON objects containing:
transaction: <object|[string,encoding]>- Transaction object, either in JSON format or encoded binary data, depending on encoding parameter.meta: <object>- Transaction status metadata object ornull.
FAQ and Troubleshooting
Why am I getting error -32009 'Slot was skipped or missing in long-term storage'?
This error occurs when (1) the slot was skipped - no validator produced a block for that slot, or (2) the block was purged from long-term storage. Use getBlocks to identify valid slots before calling getBlock, or query multiple RPC providers as archival nodes retain more history than standard nodes.
Why does getBlock return error -32015 about unsupported transaction version?
The block contains versioned transactions (v0) but you didn't specify maxSupportedTransactionVersion. Add "maxSupportedTransactionVersion": 0 to your request parameters to enable support for versioned transactions using address lookup tables. Without this parameter, only legacy transactions are returned.
What's the difference between transactionDetails options (full, signatures, none)?
"full" returns complete transaction objects with all data (accounts, instructions, logs). "signatures" returns only transaction signatures - 80% smaller payload, ideal for indexers. "none" excludes transactions entirely. Use "signatures" when you only need signature lists for tracking; use "full" for explorers displaying transaction details.
Are transaction orders in getBlock deterministic across replays?
No. Transaction order reflects execution order but includes scheduler jitter - different validators may execute transactions in slightly different order due to parallel processing. Do not rely on transaction order for deterministic replays. Use getSignaturesForAddress for canonical ordering when determinism is required.
Which commitment level should I use for getBlock?
Use "finalized" for immutable historical data (default, safest - confirmed by 66%+ stake). Use "confirmed" for lower latency when querying recent blocks (2-3 seconds behind latest, ~5% fork risk, 31%+ stake confirmation). "processed" is rarely useful for getBlock as blocks are typically historical queries.
Related Methods
getBlocks
Returns array of slot numbers for confirmed blocks in a range. Use before getBlock to identify valid slots and avoid error -32009 for skipped slots. Essential for building indexers that scan blockchain sequentially.
getBlockHeight
Returns block height (count of blocks from genesis) at commitment level. Use to convert between slot-based and height-based references, or determine current block height for transaction expiry checks in confirmation workflows.
getTransaction
Retrieves a specific transaction by signature. Use when you need transaction details without fetching the entire block - more efficient than getBlock for single transaction lookups. Returns same transaction format as getBlock but without other block transactions.
getSlot
Returns the current slot at specified commitment level. Use to determine the upper bound for block range queries before calling getBlock, or to poll for new slots in real-time blockchain monitoring applications.
External Resources
- Solana Official Documentation
- Understanding Solana Commitment Levels - Official guide to Solana's commitment levels (processed, confirmed, finalized) and their confirmation guarantees. Essential for choosing the right commitment for getBlock queries based on your application's safety requirements.