getBlock

Returns identity and transaction information about a confirmed block in the ledger.

This method will use 30 Compute Units.


Parameters

  • slot integer. The slot number of the block to retrieve encoded as u64 (64-bit unsigned integer) integer.

  • object optional. Configuration object containing the following fields:

    • encoding string

      • The encoding format for account data. It can be one of base58 (slow), base64, base64+zstd or jsonParsed.

    • transactionDetails string

      • (default:full) The level of transaction detail to return. It could be full, accounts, signatures, or none.

    • rewards boolean

      • (default:false) A boolean flag that indicates whether to include reward information in the block response.

    • commitment string. The level of commitment required for the query. The options include:

      • finalized string

        • The node will query the most recent block confirmed by the supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.

      • confirmed string

        • The node will query the most recent block that has been voted on by the supermajority of the cluster.

      • processed string

        • The node will query its most recent block. Note that the block may not be complete.

    • maxSupportedTransactionVersion boolean

      • The maximum transaction version to return in responses. 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.

    • legacy boolean. The older transaction format with no additional benefit.

    • 0 boolean. The additional support for Address Lookup Tables.

Returns

  • result object. Null if the account doesn't exist otherwise RpcResponse JSON object with the following fields:

    • blockHeight. The number of blocks beneath this block.

    • blockTime. The estimated production time, as Unix timestamp (seconds since the Unix epoch). It's null if not available.

    • blockhash. The hash of the block encoded as base-58 string.

    • parentSlot. The slot index of this block's parent.

    • previousBlockhash. The blockhash of this block's parent encoded as base-58 string; if the parent block is not available due to ledger cleanup, the field will return 11111111111111111111111111111111.

    • transactions. It is present if full transaction details are requested; 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 be null, or it may contain the following fields:

        • err. Error code if the transaction failed or null if the transaction succeeds.

        • fee. The total fees paid by all transactions in the block encoded as u64 integer.

        • innerInstructions. An array of objects representing the inner instructions of all transactions in the block (omitted if inner instruction recording is not enabled). 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 not enabled).

          • 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 not enabled).

          • 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 not enabled).

          • 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 base-58 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 be fee, rent, voting, staking.

            • commission. The vote account commission when the reward was credited, only present for voting and staking rewards.

          • status. The status of the transaction. It returns Ok if the transaction was successful and Err if the transaction failed with TransactionError.

        • transaction. The transaction object. It could be either JSON format or encoded binary data, depending on the encoding parameter. It contains the following fields:

          • message. An array of transactions 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 who created the block.

              • signer. It is used to sign transactions in the block. It can also be used to identify the signers involved in the block's transactions and to verify the authenticity of the signatures.

              • source. It is used to identify 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 transactions.

              • parsed. An array of parsed instructions that were executed in the block's transactions.

                • info. An array of information objects that provide additional details about the transactions in the block.

                  • clockSysvar. It provides information about the current state of the Solana blockchain.

                  • slotHashesSysvar. It 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 who 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. It's undefined if maxSupportedTransactionVersion is not set in the requested parameters.

// Result
{
	"jsonrpc": "2.0",
	"result": {
		"blockHeight": 297982862,
		"blockTime": 1739182678,
		"blockhash": "51bgeh11f3oLicFpUBip5snQfP3JTdo72gwcH9AMoKWz",
		"parentSlot": 319705788,
		"previousBlockhash": "8EGDR5j2kewZfZeYkmBqtjH1qeuywguyUmuk3DHwdbgE",
		"transactions": [
			{
				"meta": {
					"computeUnitsConsumed": 450,
					"err": null,
					"fee": 155000,
					"innerInstructions": [],
					...
}		
curl https://mainnet.solana.validationcloud.io/v1/<YOUR_API_KEY_HERE> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc": "2.0","id":1,"method":"getBlock","params":[319705789, {"encoding": "json","maxSupportedTransactionVersion":0,"transactionDetails":"full","rewards":false}]}'
    

Last updated

Was this helpful?