getBlock
Returns the identity and transaction information about a confirmed block.
Parameters
slot
: (integer) [required] - The slot number of the block to query.config
: (object) [optional] - Configuration object with the following options:transactionDetails
: (string) [optional] - The level of transaction details to include in the response. Possible values are:none
- No transaction details.accounts
- Transaction details only include signatures and an annotated list of accounts in each transaction.signatures
- Only the signatures of the transactions.full
- Full transaction details. This is the default option.
rewards
: (boolean) [optional] - Whether to include rewards information in the response. The default isfalse
.encoding
: (string) [optional] - The encoding format to use for the block data. Can be one ofbase58
,base64
,jsonParsed
, orjson
- Returns the block data as a JSON object.
commitment
: (string) [optional] The commitment level to use for the query. The default isfinalized
. Possible values are:finalized
- Queries the most recent block confirmed by a super majority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.confirmed
- Queries the most recent block that has been voted on by a super majority of the cluster.processed
- Queries its most recent block. The block may still be skipped by the cluster.
maxSupportedTransactionVersion
: (integer) [optional] - The maximum supported transaction version to return. If the requested block contains a transaction with a higher version, an error will be returned. If this parameter is omitted, only legacy transactions will be returned, and a block containing any versioned transaction will prompt an error.
Returns
result
- null
when the block doesn't exist, or an object with the following fields:
blockHeight
- The number of blocks before this block.blockTime
- The estimated production time, as Unix timestamp (seconds since the Unix epoch). It'snull
if not available.blockhash
- The hash of the block encoded as abase58
string.parentSlot
- The slot index of this block's parent.previousBlockhash
- The block hash of this block's parent encoded asbase58
string; if the parent block is not available due to ledger cleanup, the field returns11111111111111111111111111111111
.transactions
- If full transaction details are requested, returns an array of JSON objects with the following fields:meta
- The transaction status metadata object, which contains additional information about the block and its transactions. The meta object can benull
, or it may contain the following fields:err
- Error code if the transaction failed, ornull
if the transaction succeeds.fee
- The total fees paid by all transactions in the block encoded asu64
integer.innerInstructions
- An array of objects representing the inner instructions of all transactions in the block (omitted if inner instruction recording is disabled). Each object has the following fields:logMessages
- An array of strings containing any log messages generated by the block's transactions (omitted if inner instruction recording is disabled).postBalances
- An array of lamport balances for each account in the block after the transactions were processed.postTokenBalances
- An array of token balances for each token account in the block after the transactions were processed (omitted if inner instruction recording is disabled).preBalances
- An array of lamport balances for each account in the block before the transactions were processed.preTokenBalances
- An array of token balances for each token account in the block before the transactions were processed (omitted if inner instruction recording is disabled).rewards
- An object containing information about the rewards earned by the block's validators (only present if the rewards are requested). It has the following fields:pubkey
- The public key of the account that received the award encoded as abase58
string.lamports
- The number of reward lamports credited or debited by the account.postBalance
- The account balance in lamports after the reward was applied.rewardType
- The type of reward. It could befee
,rent
,voting
, orstaking
.commission
- The vote account commission when the reward was credited, only present for voting and staking rewards.
status
- The status of the transaction. It returnsOk
if the transaction was successful, andErr
if the transaction failed.
transaction
- The transaction object. It could be either JSON format or encoded binary data, depending on the encoding parameter.message
- An array of transactions objects included in the block:accountKeys
- An array of public keys associated with the accounts that were accessed during the execution of transactions in the block.pubkey
- The public key associated with the block producer that created the block.signer
- Indicates if the account is a required transaction signer. It can also be used to identify the signers involved in the block's transactions and to verify the authenticity of the signatures.source
- Identifies the accounts that provided the funds for the block's transactions.writable
- A boolean value that indicates whether the accounts associated with the given public keys were modified by the transactions or not.
instructions
- An array of instructions that were executed in the block's transactionsparsed
- An array of parsed instructions that were executed in the block's transactionsinfo
- An array of information objects that provide additional details about the transactions in the block.clockSysvar
- Provides information about the current state of the blockchain.slotHashesSysvar
- Provides information about the hashes of recent slots.vote
- An array of vote accounts that were involved in the block's transactions.hash
- The hash of the block. It can be used to uniquely identify the block and to verify the authenticity of the block's contents.slots
- An array of slot numbers that correspond to the transactions in the block.timestamp
- The Unix timestamp of the block's creation.
voteAccount
- A vote account to identify the validator that produced the block and to verify the validity of their vote.voteAuthority
- An authority associated with the vote account used to produce the block.
type
- The type of the block. It can be used to differentiate between regular blocks and special blocks such as snapshot or transaction confirmation blocks.
program
- The data associated with the program that was executed in the block's transactions.programId
- The public key of the program that was executed in the block's transactions.stackHeight
- The current depth of the execution stack.
recentBlockhash
- The recent block hash for the account's cluster.
signatures
- The list of transaction signatures contained within a particular block.
version
- The transaction version. Returnsundefined
ifmaxSupportedTransactionVersion
is not set in the requested parameters.
Request
- curl
curl https://solana-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "getBlock", "params": [333290000, {"encoding": "json", "maxSupportedTransactionVersion": 0, "transactionDetails": "full", "rewards": false}]}'
Response
- JSON
{
"jsonrpc": "2.0",
"result": {
"blockHeight": 359639279,
"blockTime": 1743651773,
"blockhash": "6m5rEYueCyWK54JQ9tNLJ7ZLMYQsQ5HFjySZgt2FjaV2",
"parentSlot": 371661599,
"previousBlockhash": "AGX8AvrjGJouXLwAoqEVLABfHMqeyGdVHw8zacsG4Dit",
"transactions": [
{
"meta": {
"computeUnitsConsumed": 2100,
"err": null,
"fee": 5000,
"innerInstructions": [],
"loadedAddresses": {
"readonly": [],
"writable": []
},
"logMessages": [
"Program Vote111111111111111111111111111111111111111 invoke [1]",
"Program Vote111111111111111111111111111111111111111 success"
],
"postBalances": [
7221320288943,
10172781085509212,
1
],
"postTokenBalances": [],
"preBalances": [
7221320293943,
10172781085509212,
1
],
"preTokenBalances": [],
"rewards": null,
"status": {
"Ok": null
}
},
"transaction": {
"message": {
"accountKeys": [
"dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92",
"5ZWgXcyqrrNpQHCme5SdC5hCeYb2o3fEJhF7Gok3bTVN",
"Vote111111111111111111111111111111111111111"
],
"header": {
"numReadonlySignedAccounts": 0,
"numReadonlyUnsignedAccounts": 1,
"numRequiredSignatures": 1
},
"instructions": [
{
"accounts": [1, 0],
"data": "67MGmzAKuQPwzeYjrCpiDrjsgJk2cKGAWHeYYXr5hJVLwo11193dCcRDeWHENT2mB8qxgRnFXXpyXdm2WR7c9R2Gdn1ZTJiC4s7voQNfLo5hEiGrHbW5C15Ru6W9zSx7tLJSBgdUVeeNa6cp3FhJtfA5vChhLo54eVuQERTEfU3YSaSRAyCciNpEXUVmiWtrVY9fDEznum",
"programIdIndex": 2,
"stackHeight": null
}
],
"recentBlockhash": "AGX8AvrjGJouXLwAoqEVLABfHMqeyGdVHw8zacsG4Dit"
},
"signatures": [
"4LYx3ESTTTiD3DSJ8TmDrEHQNEJHM9WWbKw4bz6GrguJ7Eon4MAepRWZZyaaJ57agxhss9HeaUhgXVurDCp3pi8H"
]
},
"version": "legacy"
...
}
]
},
"id": 1
}