getBlock RPC Method
Returns identity and transaction information about a confirmed block in the ledger
params
u64
required
Slot number.
object
optiona
Configuration object.
commitment
- The commitment describes how finalized a block is at that point in time. See Configuring State Commitment.
encoding
- Values:
json
jsonParsed
base58
base64
- Default:
json
Encoding format for Account data. See Parsed Responses.
jsonParsed
attempts to use program-specific instruction parsers to return more human-readable and explicit data in thetransaction.message.instructions
list.- If
jsonParsed
is requested but a parser cannot be found, the instruction falls back to regular JSON encoding (accounts
,data
, andprogramIdIndex
fields).
- Values:
transactionDetails
- Values:
full
accounts
signatures
none
- Default:
full
Level of transaction detail to return.
- 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
- Values:
maxSupportedTransactionVersion
- The max 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 the error.
- The max transaction version to return in responses.
rewards
- Whether to populate the rewards array. If parameter not provided, the default includes rewards.
result
object | null
If specified block is not confirmed result will be null. Otherwise, an object containing:
blockhash
The blockhash of this block, as base-58 encoded string
previousBlockhash
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
The slot index of this block's parent
transactions
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
.
blockTime
Estimated production time, as Unix timestamp (seconds since the Unix epoch). null if not available.
blockHeight
The number of blocks beneath this block.
cURL
curl https://us-seattle.openverse.network/api -s -X \
POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getBlock",
"params": [
430,
{
"encoding": "json",
"maxSupportedTransactionVersion": 0,
"transactionDetails": "full",
"rewards": false
}
]
}
'
Response
{
"jsonrpc": "2.0",
"result": {
"blockHeight": 428,
"blockTime": null,
"blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
"parentSlot": 429,
"previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
"transactions": [
{
"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
}
},
"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
}