cfx_getBlockByHash
Returns block with given hash.
- CURL
curl --request POST \
     --url https://main.confluxrpc.com \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "params": ["0x0000000000000000000000000000000000000000000000000000000000000000",false],
  "method": "cfx_getBlockByHash"
}'
Params
block_hash required
Schema
type : string
Pattern : 
^0x[0-9,a-f,A-F]{64}$include_txs required
Schema
type : boolean
Result
Schema
type : object
- adaptive adaptivetype : boolean
- baseFeePerGas baseFeePerGastype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- blame blametype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,15}|0)$
- blockNumber blockNumbertype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- custom customtype : array- items[x]Bytestype : stringPattern :- ^0x[0-9a-f]*$
 
- deferredLogsBloomHash deferredLogsBloomHashtype : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
- deferredReceiptsRoot deferredReceiptsRoottype : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
- deferredStateRoot deferredStateRoottype : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
- difficulty difficultytype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- epochNumber epochNumbertype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- gasLimit gasLimittype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- gasUsed gasUsedtype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- hash hashtype : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
- height heighttype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- miner minertype : stringPattern :- ^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
- nonce noncetype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- parentHash parentHashtype : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
- posReference posReferencetype : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
- powQuality powQualitytype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- refereeHashes refereeHashestype : array- items[x]H256type : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
 
- size sizetype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- timestamp timestamptype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- transactions transactionsoneOf- (H256,...)[]
- (Transaction,...)[]
 type : array- items[x]H256type : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
 type : array- items[x]Transactiontype : object- accessList accessListtype : array- items[x]CfxAccessListItemtype : object- address addresstype : stringPattern :- ^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
- storageKeys storageKeystype : array- items[x]H256type : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
 
 
 
- blockHash blockHashtype : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
- chainId chainIdtype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- contractCreated contractCreatedtype : stringPattern :- ^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
- data datatype : stringPattern :- ^0x[0-9a-f]*$
- epochHeight epochHeighttype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- from fromtype : stringPattern :- ^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
- gas gastype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- gasPrice gasPricetype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- hash hashtype : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
- maxFeePerGas maxFeePerGastype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- maxPriorityFeePerGas maxPriorityFeePerGastype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- nonce noncetype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- r rtype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- s stype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- space spacetype : stringPossible values :- native
- ethereum
 
- status statustype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,15}|0)$
- storageLimit storageLimittype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- to totype : stringPattern :- ^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
- transactionIndex transactionIndextype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,15}|0)$
- transactionType transactionTypetype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,15}|0)$
- v vtype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- value valuetype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,63}|0)$
- yParity yParitytype : stringPattern :- ^0x([1-9a-f][0-9a-f]{0,15}|0)$
 
 
- transactionsRoot transactionsRoottype : stringPattern :- ^0x[0-9,a-f,A-F]{64}$
Examples
- cfx_getBlockByHash
- cfx_getBlockByHash
- cfx_getBlockByHash
- cfx_getBlockByHash
- cfx_getBlockByHash
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getBlockByHash",
    "params": [
        "0x0000000000000000000000000000000000000000000000000000000000000000"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
null
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getBlockByHash",
    "params": [
        "0x0f414741abbc438bf27b8ce79ea66827cc7a4c686e18c513f0dec64fab3aa43d"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
  "adaptive": false,
  "baseFeePerGas": "0x3b9aca00",
  "blame": "0x0",
  "blockNumber": "0x53227dd",
  "custom": [
    "0x01"
  ],
  "deferredLogsBloomHash": "0xd397b3b043d87fcd6fad1291ff0bfd16401c274896d8c63a923727f077b8e0b5",
  "deferredReceiptsRoot": "0x09f8709ea9f344a810811a373b30861568f5686e649d6177fd92ea2db7477508",
  "deferredStateRoot": "0xe7b0423bba35a82454d426a881f3cd17db91c1b1eeeced3f4e34d14118ddc3cc",
  "difficulty": "0x2ec0aaf",
  "epochNumber": "0x41b93f1",
  "gasLimit": "0x1c9c380",
  "gasUsed": "0x1021a",
  "hash": "0x0f414741abbc438bf27b8ce79ea66827cc7a4c686e18c513f0dec64fab3aa43d",
  "height": "0x41b93f0",
  "miner": "CFXTEST:TYPE.USER:AANG4D91REJDBPGMGTMSPDYEFXKUBJ2BBYWRWM9J3Z",
  "nonce": "0x77833e173d9e8abd",
  "parentHash": "0x9abeb2b066a8047a20a44edf26d040a8e668a1fc9a3433dcda967226478067b3",
  "posReference": "0x041da58bd4ae48dbf780b3a2dc4dd4638f3c4a747edf8376c5843c77c23fc79e",
  "powQuality": "0x453e8e6",
  "refereeHashes": [],
  "size": "0xf7",
  "timestamp": "0x623d3b7b",
  "transactions": [
    "0xbf7576fa3dea57cb01cedde53fafc032130f0c5d42a6ecee45e7b722c0ebe7a3"
  ],
  "transactionsRoot": "0xc9f59aa23b59e9a4191720828d6a5e8d1ec21dc42d8354b3fc4546e20714f8e6"
}
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getBlockByHash",
    "params": [
        "0x0f414741abbc438bf27b8ce79ea66827cc7a4c686e18c513f0dec64fab3aa43d",
        true
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
  "adaptive": false,
  "baseFeePerGas": "0x3b9aca00",
  "blame": "0x0",
  "blockNumber": "0x53227dd",
  "custom": [
    "0x01"
  ],
  "deferredLogsBloomHash": "0xd397b3b043d87fcd6fad1291ff0bfd16401c274896d8c63a923727f077b8e0b5",
  "deferredReceiptsRoot": "0x09f8709ea9f344a810811a373b30861568f5686e649d6177fd92ea2db7477508",
  "deferredStateRoot": "0xe7b0423bba35a82454d426a881f3cd17db91c1b1eeeced3f4e34d14118ddc3cc",
  "difficulty": "0x2ec0aaf",
  "epochNumber": "0x41b93f1",
  "gasLimit": "0x1c9c380",
  "gasUsed": "0x1021a",
  "hash": "0x0f414741abbc438bf27b8ce79ea66827cc7a4c686e18c513f0dec64fab3aa43d",
  "height": "0x41b93f0",
  "miner": "CFXTEST:TYPE.USER:AANG4D91REJDBPGMGTMSPDYEFXKUBJ2BBYWRWM9J3Z",
  "nonce": "0x77833e173d9e8abd",
  "parentHash": "0x9abeb2b066a8047a20a44edf26d040a8e668a1fc9a3433dcda967226478067b3",
  "posReference": "0x041da58bd4ae48dbf780b3a2dc4dd4638f3c4a747edf8376c5843c77c23fc79e",
  "powQuality": "0x453e8e6",
  "refereeHashes": [],
  "size": "0xf7",
  "timestamp": "0x623d3b7b",
  "transactions": [
    {
      "accessList": [],
      "blockHash": "0x08659936ca25de4ac0e50555918941f45dbb9de8d867aa2ae5289a829ee0ad0c",
      "chainId": "0x22b8",
      "contractCreated": null,
      "data": "0x",
      "epochHeight": "0x27bc2",
      "from": "CFXTEST:TYPE.USER:AAPYWAAAAAAAAAAAAAAAAAAAAAAAAAAUAEUTRS455H",
      "gas": "0x5208",
      "gasPrice": "0x4f790d55",
      "hash": "0x1b6a88dc91c1870f05242ee2121c36a9a16a736b510634f1c664bcd2cc02909b",
      "maxFeePerGas": "0x4f790d55",
      "maxPriorityFeePerGas": "0x0",
      "nonce": "0x1",
      "r": "0x9d08a7f2189e8be844eb0fc0e695c84eac29f40653a9dab11360497793390e22",
      "s": "0x1f712887d60b595eb73b71973dc3e17fd5978d5401532f6e15746d57ac834fb0",
      "status": "0x0",
      "storageLimit": "0x0",
      "to": "CFXTEST:TYPE.USER:AAPYWAAAAAAAAAAAAAAAAAAAAAAAAAAUAEUTRS455H",
      "transactionIndex": "0x0",
      "type": "0x2",
      "v": "0x1",
      "value": "0xde0b6b3a7640000",
      "yParity": "0x1"
    }
  ],
  "transactionsRoot": "0xc9f59aa23b59e9a4191720828d6a5e8d1ec21dc42d8354b3fc4546e20714f8e6"
}
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getBlockByHash",
    "params": [
        "0xcb5ab41e48b58ee5f430ec3c1df69989ce09122bcc67be08b464496795054677"
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
  "adaptive": false,
  "baseFeePerGas": "0x3b9aca00",
  "blame": "0x0",
  "blockNumber": "0x5545c11",
  "custom": [
    "0x01"
  ],
  "deferredLogsBloomHash": "0xd397b3b043d87fcd6fad1291ff0bfd16401c274896d8c63a923727f077b8e0b5",
  "deferredReceiptsRoot": "0x0b574e2ff70d4a74fb818a655abc5c34c80743a05b29ae787c6d5498b7315dd9",
  "deferredStateRoot": "0xc372e483f32b30993528ab8222a004c14bded5b057978f1c6cf8edac8a3c2c1f",
  "difficulty": "0x32a2bd6",
  "epochNumber": "0x4350b61",
  "gasLimit": "0x1c9c380",
  "gasUsed": "0x0",
  "hash": "0xcb5ab41e48b58ee5f430ec3c1df69989ce09122bcc67be08b464496795054677",
  "height": "0x4350b61",
  "miner": "CFXTEST:TYPE.USER:AANG4D91REJDBPGMGTMSPDYEFXKUBJ2BBYWRWM9J3Z",
  "nonce": "0x6b88339968544d14",
  "parentHash": "0xdc800a6ebe164bcc7f9c6b70afcd7307503fc9e3385792aa794d0d631bc1a76d",
  "posReference": "0x1806ad9776516ccb8ea2ba8de3c856895ece3021b79c653add2edba25d96f766",
  "powQuality": "0x41009c5",
  "refereeHashes": [],
  "size": "0x0",
  "timestamp": "0x624e5b45",
  "transactions": [],
  "transactionsRoot": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
}
Request
curl -X POST --data \
'{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "cfx_getBlockByHash",
    "params": [
        "0xcb5ab41e48b58ee5f430ec3c1df69989ce09122bcc67be08b464496795054677",
        true
    ]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
  "adaptive": false,
  "baseFeePerGas": "0x3b9aca00",
  "blame": "0x0",
  "blockNumber": "0x5545c11",
  "custom": [
    "0x01"
  ],
  "deferredLogsBloomHash": "0xd397b3b043d87fcd6fad1291ff0bfd16401c274896d8c63a923727f077b8e0b5",
  "deferredReceiptsRoot": "0x0b574e2ff70d4a74fb818a655abc5c34c80743a05b29ae787c6d5498b7315dd9",
  "deferredStateRoot": "0xc372e483f32b30993528ab8222a004c14bded5b057978f1c6cf8edac8a3c2c1f",
  "difficulty": "0x32a2bd6",
  "epochNumber": "0x4350b61",
  "gasLimit": "0x1c9c380",
  "gasUsed": "0x0",
  "hash": "0xcb5ab41e48b58ee5f430ec3c1df69989ce09122bcc67be08b464496795054677",
  "height": "0x4350b61",
  "miner": "CFXTEST:TYPE.USER:AANG4D91REJDBPGMGTMSPDYEFXKUBJ2BBYWRWM9J3Z",
  "nonce": "0x6b88339968544d14",
  "parentHash": "0xdc800a6ebe164bcc7f9c6b70afcd7307503fc9e3385792aa794d0d631bc1a76d",
  "posReference": "0x1806ad9776516ccb8ea2ba8de3c856895ece3021b79c653add2edba25d96f766",
  "powQuality": "0x41009c5",
  "refereeHashes": [],
  "size": "0x0",
  "timestamp": "0x624e5b45",
  "transactions": [],
  "transactionsRoot": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
}