get_block - Monero
Example code for the get_block JSON-RPC method. Complete guide on how to use get_block JSON-RPC in GetBlock Web3 documentation.
This method returns full block information, including the block header and the list of transaction hashes. Lookup can be by height OR by hash — supply one of height or hash, not both.
Parameters
height
unsigned int
No*
The block's height (*supply either height or hash)
hash
string
No*
The block's hash (*supply either height or hash)
Request Example
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "get_block",
"params": {
"height": 912345
},
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "get_block",
"params": {
"height": 912345
},
"id": "getblock.io"
});
const config = {
method: 'post',
url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(response => console.log(JSON.stringify(response.data, null, 2)))
.catch(error => console.log(error));Response Example
Response Parameters
result.blob
string
Hex blob of the entire block
result.block_header
object
Decoded block header
result.json
string
Decoded block as a JSON string (note: stringified, not parsed)
result.miner_tx_hash
string
Hash of the coinbase (miner) transaction
result.tx_hashes
array of string
Hashes of non-coinbase transactions in the block
Use Cases
Block-by-block indexing with full transaction listing
Block explorer back-ends
Replaying block contents in research and analytics
Error Handling
403
Forbidden
Missing or invalid <ACCESS-TOKEN>
-32602
Invalid params
Request parameters are missing or malformed
429
Too Many Requests
Rate limit exceeded for your plan
SDK Integration
Last updated
Was this helpful?