GetBlockByHeight
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
This API returns the finalized block given the height. If none of the blocks at the given height are finalized (either directly or indirectly), the API simply returns an empty result.
RPC Method: script.GetBlockByHeight
Query Parameters
height: the block height (need to pass in as a string instead of an integer)
Returns
Similar to the returns of the GetBlock API.
// Request
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"script.GetBlockByHeight","params":[{"height":"3"}],"id":1}' http://localhost:16888/rpc
// Result
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"chain_id": "scriptnet",
"epoch": "5",
"height": "3",
"parent": "0x724b0f68d8e45f930b95bac224fa7d67eef243307b4e84f0f666198d1d70e9d7",
"transactions_hash": "0x2bf2c62185fceed239a55bd27ada030cf75970f09122addb2e419e70cafebdf0",
"state_hash": "0xd41742c2b0d70e3bac1d88b2af69a2491d8c65c650af6ec4d2b8873897f8becc",
"timestamp": "1548102762",
"proposer": "0x2e833968e5bb786ae419c4d13189fb081cc43bab",
"children": ["0x21d3c2bb25d0c85a1f5c3ff81bc7eeae998bf98db1dba461fb3f69a434feb90c"],
"status": 4,
"hash": "0x9f1e77b08c9fa8984096a735d0aae6b0e43aee297e42c54ce36334103ddd67a7",
"transactions": [...]
}
}