Skip to main content

cfx_getBlockByHash

Returns block with given hash.

Params

(2)

1. block_hash (required)

string
Match pattern:
^0x[0-9,a-f,A-F]{64}$

2. include_txs (required)

boolean

Result

(cfx_getBlockByHash_result)
object or null
adaptive
boolean
baseFeePerGas
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
blame
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,15}|0)$
blockNumber
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
custom
array[string]
deferredLogsBloomHash
string
Match pattern:
^0x[0-9,a-f,A-F]{64}$
deferredReceiptsRoot
string
Match pattern:
^0x[0-9,a-f,A-F]{64}$
deferredStateRoot
string
Match pattern:
^0x[0-9,a-f,A-F]{64}$
difficulty
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
epochNumber
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
gasLimit
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
gasUsed
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
hash
string
Match pattern:
^0x[0-9,a-f,A-F]{64}$
height
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
miner
string
Match pattern:
^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
nonce
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
parentHash
string
Match pattern:
^0x[0-9,a-f,A-F]{64}$
posReference
string or null
Match pattern:
^0x[0-9,a-f,A-F]{64}$
powQuality
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
refereeHashes
array[string]
size
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
timestamp
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
transactions
transactionsRoot
string
Match pattern:
^0x[0-9,a-f,A-F]{64}$

Examples

Request

curl -X POST --data \
'{
"method": "cfx_getBlockByHash",
"params": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
false
],
"jsonrpc": "2.0",
"id": 1
}' \
-H "Content-Type: application/json" \
localhost:12539

Result

null

Endpoint

Params

block_hash

include_txs


Request

curl -X POST --data \
'{
"method": "cfx_getBlockByHash",
"params": [
null,
null
],
"jsonrpc": "2.0",
"id": 1
}' \
-H "Content-Type: application/json" \
https://test.confluxrpc.com