# getBlock

## getBlock RPC Method

> Returns identity and transaction information about a confirmed block in the ledger. Provides detailed block data including all transactions and their metadata.\
>

OpenAPI:

````json
{"openapi":"3.0.3","info":{"title":"Solana RPC API - getBlock Method","version":"1.0.0"},"tags":[{"name":"Blocks","description":"Methods related to block data retrieval. Blocks in Solana contain \ntransaction batches and are produced approximately every 400ms.\n"}],"servers":[{"url":"https://public.rpc.solanavibestation.com"},{"url":"https://basic.rpc.solanavibestation.com"},{"url":"https://ultra.rpc.solanavibestation.com"},{"url":"https://elite.rpc.solanavibestation.com"},{"url":"https://epic.rpc.solanavibestation.com"},{"url":"https://basic.swqos.solanavibestation.com"},{"url":"https://ultra.swqos.solanavibestation.com"},{"url":"https://elite.swqos.solanavibestation.com"}],"security":[{},{"AuthHeader":[]},{"URLParameter":[]}],"components":{"securitySchemes":{"AuthHeader":{"type":"apiKey","in":"header","name":"Authorization","description":"Authorization header for API key authentication.\n\n**Example:**\n```\nAuthorization: your-api-key-here\n```\n"},"URLParameter":{"type":"apiKey","in":"query","name":"api_key","description":"API key passed as a URL parameter for authentication.\n\n**Example:**\n```\nhttps://public.rpc.solanavibestation.com/historical?api_key=your-api-key-here\n```\n"}}},"paths":{"/historical":{"post":{"summary":"getBlock RPC Method","description":"Returns identity and transaction information about a confirmed block in the ledger. Provides detailed block data including all transactions and their metadata.\n","operationId":"getBlock","tags":["Blocks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","id","method","params"],"properties":{"jsonrpc":{"type":"string","description":"JSON-RPC protocol version","enum":["2.0"]},"id":{"oneOf":[{"type":"string"},{"type":"number"}],"description":"Request identifier that will be returned in the response"},"method":{"type":"string","description":"The RPC method name","enum":["getBlock"]},"params":{"type":"array","description":"Method parameters: 1. Slot number (as u64 integer) - required 2. Configuration object (optional)\n","minItems":1,"maxItems":2,"items":{"oneOf":[{"type":"integer","format":"int64","description":"Slot number (as u64 integer)","minimum":0},{"type":"object","description":"Configuration options for the getBlock request","properties":{"encoding":{"type":"string","description":"Encoding format for each returned transaction:\n- `json`: Return transaction data in JSON format\n- `jsonParsed`: Attempts to use program-specific instruction parsers for more human-readable data\n- `base58`: Return transaction data encoded in base58\n- `base64`: Return transaction data encoded in base64\n","enum":["json","jsonParsed","base58","base64"],"default":"json"},"transactionDetails":{"type":"string","description":"Level of transaction detail to return:\n- `full`: Complete transaction data including all metadata\n- `accounts`: Only signatures and annotated list of accounts in each transaction\n- `signatures`: Only transaction signatures as strings\n- `none`: No transaction data returned\n","enum":["full","accounts","signatures","none"],"default":"full"},"rewards":{"type":"boolean","description":"Whether to populate the rewards array. \nIf parameter not provided, the default includes rewards.\n","default":true},"maxSupportedTransactionVersion":{"type":"integer","description":"**REQUIRED for most blocks**: Set the max transaction version to return. Currently, the only valid value is 0.\nSetting it to 0 allows you to fetch all transactions, including both Versioned and legacy transactions.\nThis is a required parameter for most modern blocks, as they may contain versioned transactions. If this parameter is omitted, the request will fail with an error if the block contains versioned transactions.\n","enum":[0]}}}]}}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","description":"RPC response containing block information","required":["jsonrpc","id"],"properties":{"jsonrpc":{"type":"string","description":"JSON-RPC protocol version","enum":["2.0"]},"id":{"oneOf":[{"type":"string"},{"type":"number"}],"description":"Request identifier matching the original request"},"result":{"oneOf":[{"type":"object","required":["blockhash","previousBlockhash","parentSlot","transactions"],"description":"Block information object","properties":{"blockhash":{"type":"string","description":"The blockhash of this block, as base-58 encoded string","pattern":"^[1-9A-HJ-NP-Za-km-z]{32,44}$"},"previousBlockhash":{"type":"string","description":"The blockhash of this block's parent, as base-58 encoded string.\nIf the parent block is not available due to ledger cleanup, \nthis field will return \"11111111111111111111111111111111\"\n","pattern":"^[1-9A-HJ-NP-Za-km-z]{32,44}$"},"parentSlot":{"type":"integer","format":"int64","description":"The slot index of this block's parent","minimum":0},"blockHeight":{"oneOf":[{"type":"integer","format":"int64"},{"type":"null"}],"description":"The number of blocks beneath this block"},"blockTime":{"oneOf":[{"type":"integer","format":"int64"},{"type":"null"}],"description":"Estimated production time, as Unix timestamp (seconds since Unix epoch). \nnull if not available.\n"},"transactions":{"type":"array","description":"Present if \"full\" transaction details are requested; an array of JSON objects.\nContent varies based on transactionDetails parameter:\n- \"full\": Complete TransactionWithMeta objects\n- \"accounts\": Simplified transaction data with accounts only\n- \"signatures\": Array of signature strings\n- \"none\": Empty array\n","items":{"oneOf":[{"type":"object","required":["transaction","meta"],"description":"Complete transaction object with metadata","properties":{"transaction":{"type":"object","required":["message","signatures"],"description":"Transaction object","properties":{"message":{"type":"object","required":["accountKeys","instructions","recentBlockhash"],"description":"Transaction message containing the instruction data","properties":{"accountKeys":{"type":"array","items":{"type":"string","description":"Account public key (base58 encoded)"},"description":"Array of account keys used in the transaction"},"header":{"type":"object","required":["numRequiredSignatures","numReadonlySignedAccounts","numReadonlyUnsignedAccounts"],"properties":{"numRequiredSignatures":{"type":"integer","description":"The number of signatures required to validate this transaction"},"numReadonlySignedAccounts":{"type":"integer","description":"The number of signed accounts that are read-only"},"numReadonlyUnsignedAccounts":{"type":"integer","description":"The number of unsigned accounts that are read-only"}}},"instructions":{"type":"array","items":{"type":"object","required":["programIdIndex","accounts","data"],"description":"Compiled instruction within a transaction","properties":{"programIdIndex":{"type":"integer","description":"Index into the message.accountKeys array indicating which account is the program ID"},"accounts":{"type":"array","items":{"type":"integer"},"description":"List of ordered indices into the message.accountKeys array"},"data":{"type":"string","description":"The program input data (base58 encoded)"},"stackHeight":{"oneOf":[{"type":"integer"},{"type":"null"}],"description":"Stack height of the instruction"}}},"description":"Array of program instructions"},"recentBlockhash":{"type":"string","description":"A recent blockhash used for the transaction"},"addressTableLookups":{"type":"array","items":{"type":"object","required":["accountKey","readonlyIndexes","writableIndexes"],"description":"Address table lookup for loading additional accounts","properties":{"accountKey":{"type":"string","description":"Public key for an address lookup table account"},"readonlyIndexes":{"type":"array","items":{"type":"integer"},"description":"Array of indices used to load readonly account addresses"},"writableIndexes":{"type":"array","items":{"type":"integer"},"description":"Array of indices used to load writable account addresses"}}},"description":"Array of address table lookups used to load additional accounts for this transaction"}}},"signatures":{"type":"array","items":{"type":"string","description":"Transaction signature (base58 encoded)"},"description":"Array of transaction signatures"}}},"meta":{"oneOf":[{"type":"object","required":["fee","preBalances","postBalances","status"],"description":"Transaction metadata containing execution results and state changes","properties":{"err":{"oneOf":[{"type":"null"},{"type":"object","description":"Error details if transaction failed","properties":{"InstructionError":{"type":"array","items":{"oneOf":[{"type":"integer"},{"type":"object"}]}}}}],"description":"Error information, or null if transaction succeeded"},"fee":{"type":"integer","description":"Fee this transaction was charged in lamports"},"preBalances":{"type":"array","items":{"type":"integer","format":"int64"},"description":"Array of u64 account balances from before the transaction was processed"},"postBalances":{"type":"array","items":{"type":"integer","format":"int64"},"description":"Array of u64 account balances after the transaction was processed"},"logMessages":{"type":"array","items":{"type":"string"},"description":"Array of string log messages or null if log message recording was not enabled during this transaction"},"preTokenBalances":{"type":"array","items":{"type":"object","required":["accountIndex","mint","owner","programId","uiTokenAmount"],"description":"Token balance information for an account","properties":{"accountIndex":{"type":"integer","description":"Index of the account in the transaction's account keys array"},"mint":{"type":"string","description":"Pubkey of the token mint"},"owner":{"type":"string","description":"Pubkey of the token account owner"},"programId":{"type":"string","description":"Pubkey of the Token program that owns the account"},"uiTokenAmount":{"type":"object","required":["amount","decimals","uiAmountString"],"description":"Token amount with UI formatting","properties":{"amount":{"type":"string","description":"Raw amount of tokens as a string, ignoring decimals"},"decimals":{"type":"integer","description":"Number of decimals configured for token's mint"},"uiAmount":{"oneOf":[{"type":"number"},{"type":"null"}],"description":"Token amount as a float, accounting for decimals"},"uiAmountString":{"type":"string","description":"Token amount as a string, accounting for decimals"}}}}},"description":"List of token balances from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction"},"postTokenBalances":{"type":"array","items":{"type":"object","required":["accountIndex","mint","owner","programId","uiTokenAmount"],"description":"Token balance information for an account","properties":{"$ref":"#/paths/~1historical/post/responses/200/content/application~1json/schema/properties/result/oneOf/0/properties/transactions/items/oneOf/0/properties/meta/oneOf/0/properties/preTokenBalances/items/properties"}},"description":"List of token balances from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction"},"innerInstructions":{"type":"array","items":{"type":"object","required":["index","instructions"],"description":"Inner instruction generated during transaction execution","properties":{"index":{"type":"integer","description":"Index of the instruction in the transaction that generated this inner instruction"},"instructions":{"type":"array","items":{"type":"object","required":["programIdIndex","accounts","data"],"description":"Compiled instruction within a transaction","properties":{"$ref":"#/paths/~1historical/post/responses/200/content/application~1json/schema/properties/result/oneOf/0/properties/transactions/items/oneOf/0/properties/transaction/properties/message/properties/instructions/items/properties"}},"description":"Array of inner instructions"}}},"description":"List of inner instructions or null if inner instruction recording was not enabled during this transaction"},"rewards":{"oneOf":[{"type":"array","items":{"type":"object","required":["pubkey","lamports","postBalance","rewardType"],"description":"Reward information for an account","properties":{"pubkey":{"type":"string","description":"The public key of the account that received the reward"},"lamports":{"type":"integer","description":"Number of reward lamports credited or debited by the account"},"postBalance":{"type":"integer","format":"int64","description":"Account balance in lamports after the reward was applied"},"rewardType":{"type":"string","description":"Type of reward","enum":["fee","rent","voting","staking"]},"commission":{"type":"integer","description":"Vote account commission when the reward was credited"}}}},{"type":"null"}],"description":"Transaction-level rewards, populated if rewards are requested; an array of JSON objects containing reward information, or null if no rewards are present"},"status":{"type":"object","description":"Transaction execution status","properties":{"Ok":{"type":"null","description":"Transaction succeeded"},"Err":{"type":"object","description":"Transaction failed with error details","properties":{"InstructionError":{"type":"array","description":"Error occurred in a specific instruction","items":{"oneOf":[{"type":"integer","description":"Instruction index that failed"},{"type":"object","description":"Error details","properties":{"Custom":{"type":"integer","description":"Custom program error code"}}}]}}}}}},"computeUnitsConsumed":{"type":"integer","description":"Number of compute units consumed by the transaction"},"loadedAddresses":{"description":"Transaction addresses loaded from address lookup tables. Undefined if maxSupportedTransactionVersion is not set in request params.","type":"object","required":["readonly","writable"],"properties":{"readonly":{"type":"array","items":{"type":"string"},"description":"Ordered list of base-58 encoded addresses for readonly loaded accounts"},"writable":{"type":"array","items":{"type":"string"},"description":"Ordered list of base-58 encoded addresses for writable loaded accounts"}}},"returnData":{"oneOf":[{"type":"object","required":["programId","data"],"description":"Return data from a program instruction","properties":{"programId":{"type":"string","description":"The program that generated the return data, as base-58 encoded Pubkey"},"data":{"type":"array","description":"The return data itself, as a list of two elements [data, encoding]","items":{"type":"string"},"minItems":2,"maxItems":2}}},{"type":"null"}],"description":"The most-recent return data generated by an instruction in the transaction"}}},{"type":"null"}],"description":"Transaction metadata or null if not available"},"version":{"oneOf":[{"type":"string","enum":["legacy"]},{"type":"integer","enum":[0]}],"description":"Transaction version"}}},{"type":"string","description":"Transaction signature when transactionDetails is \"signatures\""},{"type":"object","description":"Simplified transaction object when transactionDetails is \"accounts\"","properties":{"signatures":{"type":"array","items":{"type":"string"},"description":"Transaction signatures"},"accountKeys":{"type":"array","items":{"type":"string"},"description":"Annotated list of accounts in the transaction"},"meta":{"type":"object","description":"Limited metadata including fee, balances, and token balances","properties":{"fee":{"type":"integer"},"err":{"oneOf":[{"type":"null"},{"type":"object"}]},"preBalances":{"type":"array","items":{"type":"integer"}},"postBalances":{"type":"array","items":{"type":"integer"}},"preTokenBalances":{"type":"array","items":{"type":"object","required":["accountIndex","mint","owner","programId","uiTokenAmount"],"description":"Token balance information for an account","properties":{"$ref":"#/paths/~1historical/post/responses/200/content/application~1json/schema/properties/result/oneOf/0/properties/transactions/items/oneOf/0/properties/meta/oneOf/0/properties/preTokenBalances/items/properties"}}},"postTokenBalances":{"type":"array","items":{"type":"object","required":["accountIndex","mint","owner","programId","uiTokenAmount"],"description":"Token balance information for an account","properties":{"$ref":"#/paths/~1historical/post/responses/200/content/application~1json/schema/properties/result/oneOf/0/properties/transactions/items/oneOf/0/properties/meta/oneOf/0/properties/preTokenBalances/items/properties"}}}}}}}]}},"rewards":{"type":"array","items":{"type":"object","required":["pubkey","lamports","postBalance","rewardType"],"description":"Reward information for an account","properties":{"$ref":"#/paths/~1historical/post/responses/200/content/application~1json/schema/properties/result/oneOf/0/properties/transactions/items/oneOf/0/properties/meta/oneOf/0/properties/rewards/oneOf/0/items/properties"}},"description":"Present if rewards are requested; array of reward information"}}},{"type":"null"}],"description":"Block information or null if block is not confirmed or not found"},"error":{"type":"object","description":"Standard JSON-RPC error object","required":["code","message"],"properties":{"code":{"type":"integer","description":"Numeric error code following JSON-RPC 2.0 specification:\n- `-32700`: Parse error\n- `-32600`: Invalid request  \n- `-32601`: Method not found\n- `-32602`: Invalid params\n- `-32603`: Internal error\n- `-32005`: Too Many Requests\n- `-32003`: Unauthorized\n- `-32015`: Transaction version not supported\n"},"message":{"type":"string","description":"Human-readable error message"},"data":{"type":"object","description":"Additional structured error information (optional)","additionalProperties":true}}}}}}}},"401":{"description":"Unauthorized","content":{"text/plain":{"schema":{"type":"string"}}}},"403":{"description":"Forbidden","content":{"text/plain":{"schema":{"type":"string"}}}},"429":{"description":"Too Many Requests","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"type":"string"}}}}}}}}}
````
