Returns the information about a block by hash.
This RPC returns null on success.
Parameters
- block_hash - The block hash.
- verbosity - Result format which allows 0 and 2. (Optional, the default is 2.)
Returns
The RPC returns a block or null. When the RPC returns a block, the block hash must equal to the parameter block_hash.
If the block is in the canonical chain, the RPC must return the block information. Otherwise, the behavior is undefined. The RPC may return blocks found in local storage or simply returns null for all blocks that are not in the canonical chain. And because of chain reorganization, for the same block_hash, the RPC may sometimes return null and sometimes return the block.
When verbosity is 2, it returns a JSON object as the result. See BlockView for the schema.
When verbosity is 0, it returns a 0x-prefixed hex string as the result. The string encodes the block serialized by molecule using schema table Block.
Example
Request
curl --location --request POST 'https://ckb-mirana.unifra.io/v1/4fb36720a57340d39aee4cf68511064a' \
--data-raw '{
"id": 0,
"jsonrpc": "2.0",
"method": "get_block",
"params": [
"0xb2671d3cc16b7738bbc8902ef11322bc2bfe7c54f5ce4a5cdfdf57b1a02fcb11"
]
}'
Result
{
"jsonrpc": "2.0",
"result": {
"header": {
"compact_target": "0x1a08a97e",
"dao": "0x7194050c98a5a12e4827806b0b872300b2e0a033e71b0000008867461f3bff06",
"epoch": "0x6cf0400000000",
"extra_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"hash": "0xb2671d3cc16b7738bbc8902ef11322bc2bfe7c54f5ce4a5cdfdf57b1a02fcb11",
"nonce": "0x5af1702d0000043000000000cc700400",
"number": "0x400",
"parent_hash": "0x013c445cedc6744f051a78320217e2493590d014fa49e9815481954a68a2a18d",
"proposals_hash": "0xc78954b079452667f9e2412af83893b6ccdf93e7fc21f88b015f58f677c8e2e2",
"timestamp": "0x16e7808ab0f",
"transactions_root": "0x535c2a0979a61c984b862a93198b2055c20e8b57db6dbb184cbadcee339bcc92",
"version": "0x0"
},
"proposals": [
"0xc3f159c07c82af54be36"
],
"transactions": [
{
"cell_deps": [],
"hash": "0x13686e4f091e26b3aa1e14ac575a072880d1e4afc4d4b5570e036385b7e9648a",
"header_deps": [],
"inputs": [
{
"previous_output": {
"index": "0xffffffff",
"tx_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
"since": "0x400"
}
],
"outputs": [
{
"capacity": "0x1adcb95d24",
"lock": {
"args": "0xc2baa1d5b45a3ad6452b9c98ad8e2cc52e5123c7",
"code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
"hash_type": "type"
},
"type": null
}
],
"outputs_data": [
"0x"
],
"version": "0x0",
"witnesses": [
"0x5d0000000c00000055000000490000001000000030000000310000009bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce80114000000dde7801c073dfb3464c7b1f05b806bb2bbb84e990400000000000000"
]
},
{
"cell_deps": [
{
"dep_type": "dep_group",
"out_point": {
"index": "0x0",
"tx_hash": "0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c"
}
}
],
"hash": "0xa0211c240e7ec7b670cdb6bc06c88826a11e62cc48a24c586fb0c585f63afc3a",
"header_deps": [],
"inputs": [
{
"previous_output": {
"index": "0x0",
"tx_hash": "0x69002caf58fe0798edcb57bc94571f54d2877e540e3cb768a5cc19f4ebf4d527"
},
"since": "0x0"
}
],
"outputs": [
{
"capacity": "0x915fa66bc00",
"lock": {
"args": "0xf885203bdd6fe9296b156af67e9d89c6b6811204",
"code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
"hash_type": "type"
},
"type": null
},
{
"capacity": "0x2a00f172559cf",
"lock": {
"args": "0x092fbcc3b8ad885af4dbced24c6a9c3fd3321fa2",
"code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
"hash_type": "type"
},
"type": null
}
],
"outputs_data": [
"0x",
"0x"
],
"version": "0x0",
"witnesses": [
"0x5500000010000000550000005500000041000000854a931b0ebe92e25b72e0759328e157d3598a008b0debbfacd6122e2d57e97d4440ac66b0b6996e362d59eccd190e47d2d7dfef5abf2f0ea45fa1cf8c42325601"
]
},
{
"cell_deps": [
{
"dep_type": "dep_group",
"out_point": {
"index": "0x0",
"tx_hash": "0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c"
}
}
],
"hash": "0x754282a864d649c82f99f0b6ebdfa2d619540f04a04a6a723586a9c34a18ef0c",
"header_deps": [],
"inputs": [
{
"previous_output": {
"index": "0xa",
"tx_hash": "0x1f8c85e9c9b8cd38c2490841582aadaef7001b49641345fa1706f3fad2b5bca3"
},
"since": "0x0"
}
],
"outputs": [
{
"capacity": "0x2c8c0b804800",
"lock": {
"args": "0x03360abc8ab4a2cc7aa072f8e72fdf9a4299c124",
"code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
"hash_type": "type"
},
"type": null
},
{
"capacity": "0x2e6704f9d0f0",
"lock": {
"args": "0x56b1a3bed66c86b40151f2ba1bfe296032dd307b",
"code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
"hash_type": "type"
},
"type": null
}
],
"outputs_data": [
"0x",
"0x"
],
"version": "0x0",
"witnesses": [
"0x55000000100000005500000055000000410000005be6d5238ae587c9a08733fd287347964dd7ae5b519702f2d496ab6b859751565ba3c94f3d1c3bd40466eedd50a693b2b6a317d5be8458e8ee572967d329e85901"
]
}
],
"uncles": []
},
"id": 0
}