# 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.<br>

````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/?api_key=your-api-key-here\n```\n"}},"schemas":{"GetBlockRequest":{"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},{"$ref":"#/components/schemas/BlockOptions"}]}}}},"BlockOptions":{"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},"commitment":{"type":"string","description":"The commitment level describes how finalized a block is at that point in time.\nSee [Configuring State Commitment](https://docs.solana.com/api/http#configuring-state-commitment) \nfor detailed information about each level.\n**Note**: `processed` is not supported for this method.\n\n- `confirmed`: Query the most recent block which has reached maximum-lockout on this node\n- `finalized`: Query the most recent block which has been finalized by the cluster\n","enum":["confirmed","finalized"],"default":"finalized"},"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]}}},"GetBlockResponse":{"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":[{"$ref":"#/components/schemas/Block"},{"type":"null"}],"description":"Block information or null if block is not confirmed or not found"},"error":{"$ref":"#/components/schemas/RpcError"}}},"Block":{"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":[{"$ref":"#/components/schemas/TransactionWithMeta"},{"type":"string","description":"Transaction signature when transactionDetails is \"signatures\""},{"$ref":"#/components/schemas/TransactionAccountsOnly"}]}},"rewards":{"type":"array","items":{"$ref":"#/components/schemas/Reward"},"description":"Present if rewards are requested; array of reward information"}}},"TransactionWithMeta":{"type":"object","required":["transaction","meta"],"description":"Complete transaction object with metadata","properties":{"transaction":{"$ref":"#/components/schemas/Transaction"},"meta":{"oneOf":[{"$ref":"#/components/schemas/TransactionMeta"},{"type":"null"}],"description":"Transaction metadata or null if not available"},"version":{"oneOf":[{"type":"string","enum":["legacy"]},{"type":"integer","enum":[0]}],"description":"Transaction version"}}},"Transaction":{"type":"object","required":["message","signatures"],"description":"Transaction object","properties":{"message":{"$ref":"#/components/schemas/TransactionMessage"},"signatures":{"type":"array","items":{"type":"string","description":"Transaction signature (base58 encoded)"},"description":"Array of transaction signatures"}}},"TransactionMessage":{"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":{"$ref":"#/components/schemas/CompiledInstruction"},"description":"Array of program instructions"},"recentBlockhash":{"type":"string","description":"A recent blockhash used for the transaction"},"addressTableLookups":{"type":"array","items":{"$ref":"#/components/schemas/AddressTableLookup"},"description":"Array of address table lookups used to load additional accounts for this transaction"}}},"CompiledInstruction":{"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"}}},"AddressTableLookup":{"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"}}},"TransactionMeta":{"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":{"$ref":"#/components/schemas/TokenBalance"},"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":{"$ref":"#/components/schemas/TokenBalance"},"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":{"$ref":"#/components/schemas/InnerInstruction"},"description":"List of inner instructions or null if inner instruction recording was not enabled during this transaction"},"rewards":{"oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/Reward"}},{"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":{"$ref":"#/components/schemas/TransactionStatus"},"computeUnitsConsumed":{"type":"integer","description":"Number of compute units consumed by the transaction"},"loadedAddresses":{"$ref":"#/components/schemas/LoadedAddresses","description":"Transaction addresses loaded from address lookup tables. Undefined if maxSupportedTransactionVersion is not set in request params."},"returnData":{"oneOf":[{"$ref":"#/components/schemas/ReturnData"},{"type":"null"}],"description":"The most-recent return data generated by an instruction in the transaction"}}},"TokenBalance":{"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":{"$ref":"#/components/schemas/UiTokenAmount"}}},"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"}}},"InnerInstruction":{"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":{"$ref":"#/components/schemas/CompiledInstruction"},"description":"Array of inner instructions"}}},"Reward":{"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"}}},"TransactionStatus":{"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"}}}]}}}}}},"LoadedAddresses":{"type":"object","required":["readonly","writable"],"description":"Addresses loaded from address lookup tables","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":{"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}}},"TransactionAccountsOnly":{"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":{"$ref":"#/components/schemas/TokenBalance"}},"postTokenBalances":{"type":"array","items":{"$ref":"#/components/schemas/TokenBalance"}}}}}},"RpcError":{"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}}}}},"paths":{"/":{"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":{"$ref":"#/components/schemas/GetBlockRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetBlockResponse"}}}},"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"}}}}}}}}}
````
