post https://{network}.g.alchemy.com/v2/
Returns identity and transaction information about a confirmed block in the ledger.
Parameters
-
<u64>
- a slot integer denoting the target block number. -
<object>
- (optional) Config object:encoding:
(optional) <string> - data encoding for each returned transaction
Accepts one of the following strings:
["json"
(Default), "jsonParsed"
, "base58"
(slow), "base64"
]
"jsonParsed"
encoding attempts to use program-specific parsers to make the transaction.message.instructions
list more human-readable; if a parser cannot be found, the instruction falls back to default JSON.
* `transactionDetails:` (optional) _\<string>_ - level of transaction detail to return\
Accepts one of the following strings:\
\[`"full"` _(Default)_, `"signatures"`, or `"none"`]
* `rewards:` __ (optional) _bool_ - whether to populate the `rewards` array. `true` (Default)
* `commitment:` (optional) Configures the commitment level of the blocks queried\
Accepts one of the following strings: \[`"finalized"`, `"confirmed"`, `"processed"]` \
For more info, refer to this [doc](https://docs.solana.com/developing/clients/jsonrpc-api#configuring-state-commitment).
* `maxSupportedTransactionVersion:` _(_optional) _\<number>_ - sets the maximum transaction version.
Note
For
maxSupportedTransactionVersion:
you cannot query blocks that contain a transaction with a higher version.
Returns
Confirmed Block
<object>
- Objectblockhash:
< base-58 encoded string> - blockhash of a given blockpreviousBlockhash:
< base-58 encoded string> - the blockhash of this block's parent. 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:
<JSON array> - transaction details when queried with the"full"
flag undertransactionDetails
transaction:
<object|[string,encoding]> - encoded transaction objectmeta:
<object> - transaction status metadata object, containingnull
or:err:
<object | null> - If transaction failed, error message. If transaction succeedednull
.fee:
<u64> - fee for this transactionpreBalances:
<array of u64s> - account balances from before the transaction was processedpostBalances:
<array of u64s> - account balances after the transaction was processedinnerInstructions:
<array|null> - List of inner instructions
null
if not enabled during this transactionpreTokenBalances:
<array|undefined> - List of token balances from before the transaction was processed or
Undefined if token balance recording was not yet enabled during this transactionpostTokenBalances:
<array|undefined> - List of token balances from after the transaction was processed
Undefined if token balance recording was not yet enabled during this transactionlogMessages:
<array|null> - array of string log messages
null
if log message recording was not enabled during this transactionloadedAddresses:
<object|undefined> - Transaction addresses loaded from address lookup tables. Undefined ifmaxSupportedTransactionVersion
was not set in request params.writable:
<array[string base-58 encoded addresses]> - Ordered list addresses for writable loaded accountsreadonly:
<array[string base-58 encoded addresses]> - Ordered list addresses for read only loaded accounts
version:
<"legacy"|number|undefined> - Transaction version.
Undefined ifmaxSupportedTransactionVersion
is not set in request params.
signatures:
<array of strings> - present if "signatures" are requested for transaction details corresponding to the transaction order in the blockrewards:
<array of JSON objects> - Object present if rewards are requestedpubkey:
<base-58 encoded string> - The public key of the account that received the rewardlamports:
<i64>- number of reward lamports credited or debited by the account, as a i64postBalance:
<u64> - account balance in lamports after the reward was appliedrewardType:
<string|undefined> - type of reward: ["fee"
,"rent"
,"voting"
,"staking"
]commission:
<u8|undefined> - vote account commission when the reward was credited, only present for voting and staking rewards
blockTime:
<i64 | null> - estimated production time, as Unix timestamp (seconds since the Unix epoch). null if not availableblockHeight:
<u64 | null> - the number of blocks beneath this block
"Unconfirmed Block"
<null>
- if the specified block is not confirmed
Example
Request
curl --location --request POST 'https://solana-mainnet.g.alchemy.com/v2/demo' \
--header 'Content-Type: application/json' \
--data-raw '{"jsonrpc": "2.0","id":1,"method":"getBlock","params":[430, {"encoding": "json","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": [],
"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
}
{
"jsonrpc": "2.0",
"result": {
"blockHeight": 428,
"blockTime": null,
"blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
"parentSlot": 429,
"previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
"rewards": [],
"transactions": [
{
"meta": {
"err": null,
"fee": 5000,
"innerInstructions": null,
"logMessages": null,
"postBalances": [499998932500, 26858640, 1, 1, 1],
"postTokenBalances": [],
"preBalances": [499998937500, 26858640, 1, 1, 1],
"preTokenBalances": [],
"status": {
"Ok": null
}
},
"transaction": [
"AVj7dxHlQ9IrvdYVIjuiRFs1jLaDMHixgrv+qtHBwz51L4/ImLZhszwiyEJDIp7xeBSpm/TX5B7mYzxa+fPOMw0BAAMFJMJVqLw+hJYheizSoYlLm53KzgT82cDVmazarqQKG2GQsLgiqktA+a+FDR4/7xnDX7rsusMwryYVUdixfz1B1Qan1RcZLwqvxvJl4/t3zHragsUp0L47E24tAFUgAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAAAHYUgdNXR0u3xNdiTr072z2DVec9EQQ/wNo1OAAAAAAAtxOUhPBp2WSjUNJEgfvy70BbxI00fZyEPvFHNfxrtEAQQEAQIDADUCAAAAAQAAAAAAAACtAQAAAAAAAAdUE18R96XTJCe+YfRfUp6WP+YKCy/72ucOL8AoBFSpAA==",
"base64"
]
}
]
},
"id": 1
}