getBlock
Returns identity and transaction information about a confirmed block in the ledger
Parameters
Slot <u64>
- slot number, as
u64
integer
Configuration <object>
-
Configuration object containing the following fields:
-
encoding: <string>
- encoding format for each returned Transaction["json", "jsonParsed", "base58", "base64"]
Details
jsonParsed
attempts to use program-specific instruction parsers to return more human-readable and explicit data in thetransaction.message.instructions
list. - IfjsonParsed
is requested but a parser cannot be found, the instruction falls back to regular JSON encoding (accounts
,data
, andprogramIdIndex
fields).
-
transactionDetails: <string>
- level of transaction detail to return["full", "accounts", "signatures", "none"]
Details
- If
accounts
are 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>
- the max transaction version to return in responsesDetails
- 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 the error.
-
Result
The result field will be an object with the following fields:
<null>
- if specified block is not confirmed<object>
- if block is confirmed, an object with the following fields:blockhash: <string>
- the blockhash of this block, as base-58 encoded stringpreviousBlockhash: <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"parentSlot: <u64>
- the slot index of this block's parenttransactions: <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 parametermeta: <object>
- transaction status metadata object, containingnull
or:err: <object|null>
- Error if transaction failed, null if transaction succeeded. TransactionError definitionsfee: <u64>
- fee this transaction was charged, as u64 integerpreBalances: <array>
- array of u64 account balances from before the transaction was processedpostBalances: <array>
- array of u64 account balances after the transaction was processedinnerInstructions: <array|null>
- List of inner instructions ornull
if inner instruction recording was not enabled during this transactionpreTokenBalances: <array|undefined>
- List of token balances from before the transaction was processed or omitted if token balance recording was not yet enabled during this transactionpostTokenBalances: <array|undefined>
- List of token balances from after the transaction was processed or omitted if token balance recording was not yet enabled during this transactionlogMessages: <array|null>
- array of string log messages ornull
if log message recording was not enabled during this transaction- DEPRECATED:
status: <object>
- Transaction status"Ok": <null>
- Transaction was successful"Err": <ERR>
- Transaction failed with TransactionError
loadedAddresses: <object|undefined>
- Transaction addresses loaded from address lookup tables. Undefined ifmaxSupportedTransactionVersion
is not set in request params, or ifjsonParsed
encoding is set in request params.writable: <array[string]>
- Ordered list of base-58 encoded addresses for writable loaded accountsreadonly: <array[string]>
- Ordered list of base-58 encoded addresses for readonly loaded accounts
returnData: <object|undefined>
- the most-recent return data generated by an instruction in the transaction, with the following fields:programId: <string>
- the program that generated the return data, as base-58 encoded Pubkeydata: <[string, encoding]>
- the return data itself, as base-64 encoded binary data
computeUnitsConsumed: <u64|undefined>
- number of compute units consumed by the transaction
version: <"legacy"|number|undefined>
- Transaction version. Undefined ifmaxSupportedTransactionVersion
is not set in request params.
signatures: <array>
- present if "signatures" are requested for transaction details; an array of signatures strings, corresponding to the transaction order in the blockblockTime: <i64|null>
- estimated production time, as Unix timestamp ( milliseconds since the Unix epoch). null if not availableblockHeight: <u64|null>
- the number of blocks beneath this block
Code sample
curl "https://testnet.atlas.xyz/?apikey=$ATLAS_API_KEY" -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": "0bdba4c1-3073-41b0-b849-46f14e004e38",
"method": "getBlock",
"params": [
11130753,
{
"encoding": "json",
"maxSupportedTransactionVersion": 0,
"transactionDetails": "full"
}
]
}
'
Response
{
"jsonrpc": "2.0",
"id": "0bdba4c1-3073-41b0-b849-46f14e004e38",
"result": {
"previousBlockhash": "14nrupVMwEXjQcqLrQizjsB34fjToU3rXrPQbNCCPhvU",
"blockhash": "249RkZoYwXKH1KPrYCfDcSiPFmpwu2FHKp3WcDvnGLP4",
"parentSlot": 11130752,
"transactions": [
{
"transaction": {
"signatures": [
"46UE2a3wQeyHU2WNvg96ZK49An89X4ZQEYQkZTCLd3LFoXBfBapt65Mdv9mMmYsuMdChdAzsMJx9re9hqKrqP4EW"
],
"message": {
"header": {
"numRequiredSignatures": 1,
"numReadonlySignedAccounts": 0,
"numReadonlyUnsignedAccounts": 1
},
"accountKeys": [
"BjQGKpja61BXh7ViCcWU32gBnHuP6Spev8SxMYDcydQZ",
"AHhkdcEyhkYaKJNm8tmoU9En7GDGfctkKShbVcbMv4y6",
"11111111111111111111111111111111"
],
"recentBlockhash": "CZaYQodHvCmTpbMz6JxbYGEuwDxPLgu52fLyHiSuEu41",
"instructions": [
{
"programIdIndex": 2,
"accounts": [0, 1],
"data": "3Bxs4BjHAruJ7qP5",
"stackHeight": null
}
]
}
},
"meta": {
"err": null,
"status": {
"Ok": null
},
"fee": 5000,
"preBalances": [99915745724, 99895108377, 1037040],
"postBalances": [99915740403, 99895108698, 1037040],
"innerInstructions": [],
"logMessages": [
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
],
"preTokenBalances": [],
"postTokenBalances": [],
"rewards": null,
"loadedAddresses": {
"writable": [],
"readonly": []
},
"computeUnitsConsumed": 0
}
},
{
"transaction": {
"signatures": [
"3i54g85d7rvKEgtobLEM3ThgzDHYceVth8NcEoi32hLhxzQmnmgw5BvAWY2oAG8VvQw1SEk2kuCjngoDfc68ejY4"
],
"message": {
"header": {
"numRequiredSignatures": 1,
"numReadonlySignedAccounts": 0,
"numReadonlyUnsignedAccounts": 1
},
"accountKeys": [
"9gxawmdMEyPnpbyoz646EDEbnWn6oXSVYMermQ2x7Xxt",
"7V6HHK848VXLw32PNdeWfVRPEd66EL9uTHgsZaqHQFL1",
"11111111111111111111111111111111"
],
"recentBlockhash": "CZaYQodHvCmTpbMz6JxbYGEuwDxPLgu52fLyHiSuEu41",
"instructions": [
{
"programIdIndex": 2,
"accounts": [0, 1],
"data": "3Bxs4AwmSkd6vCAK",
"stackHeight": null
}
]
}
},
"meta": {
"err": null,
"status": {
"Ok": null
},
"fee": 5000,
"preBalances": [99911736320, 99889460948, 1037040],
"postBalances": [99911710780, 99889481488, 1037040],
"innerInstructions": [],
"logMessages": [
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
],
"preTokenBalances": [],
"postTokenBalances": [],
"rewards": null,
"loadedAddresses": {
"writable": [],
"readonly": []
},
"computeUnitsConsumed": 0
}
},
{
"transaction": {
"signatures": [
"5xmk9azofZUtCsnN1AS6okMxqc2T2HMQewXD9JMaWNicht58m2rBQaKpcYpkVAEFdmdsiwjiz4RzugZvyQzn2YUv"
],
"message": {
"header": {
"numRequiredSignatures": 1,
"numReadonlySignedAccounts": 0,
"numReadonlyUnsignedAccounts": 1
},
"accountKeys": [
"7Vruyoh3rfM9wfdQP52HNabZ7P6dRfMdHACjwFTLS6CA",
"5wzF9uBcq3MGNdZENU9DfEaxBiGrnhahVptod8UYXx1P",
"11111111111111111111111111111111"
],
"recentBlockhash": "CZaYQodHvCmTpbMz6JxbYGEuwDxPLgu52fLyHiSuEu41",
"instructions": [
{
"programIdIndex": 2,
"accounts": [0, 1],
"data": "3Bxs4S8Xy55iC3Dy",
"stackHeight": null
}
]
}
},
"meta": {
"err": null,
"status": {
"Ok": null
},
"fee": 5000,
"preBalances": [99906196978, 99892095846, 1037040],
"postBalances": [99906185171, 99892102653, 1037040],
"innerInstructions": [],
"logMessages": [
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
],
"preTokenBalances": [],
"postTokenBalances": [],
"rewards": null,
"loadedAddresses": {
"writable": [],
"readonly": []
},
"computeUnitsConsumed": 0
}
}
],
"blockTime": 1724965624,
"blockHeight": 11130753
}
}