跳到主要内容

eth_getBlockByHash

Gets a block for a given hash

Params

(2)

1. blockHash (required)

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

2. includeTransactions (required)

boolean

Result

(getBlockByHashResult)
Block representation or null
author
string
Match pattern:
^0x[0-9,a-f,A-F]{40}$
baseFeePerGas
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
difficulty
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
extraData
string
Match pattern:
^0x[0-9a-f]*$
gasLimit
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
gasUsed
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
hash
string
Match pattern:
^0x[0-9,a-f,A-F]{64}$
logsBloom
string
Match pattern:
^0x[0-9,a-f,A-F]{512}$
miner
string
Match pattern:
^0x[0-9,a-f,A-F]{40}$
mixHash
string
Match pattern:
^0x[0-9,a-f,A-F]{64}$
nonce
string
Match pattern:
^0x[0-9,a-f,A-F]{16}$
number
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}$
receiptsRoot
string
Match pattern:
^0x[0-9,a-f,A-F]{64}$
sha3uncle
string
Match pattern:
^0x[0-9,a-f,A-F]{64}$
size
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
stateRoot
string
Match pattern:
^0x[0-9,a-f,A-F]{64}$
timestamp
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
totalDifficulty
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}$
uncles
array[string]

Examples

Request

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

Result

{
"author": "0x12794484b0a6b0f1fcee72b29d322e93e9de5aac",
"difficulty": "0x307fa8e",
"extraData": "0x",
"gasLimit": "0x1c9c380",
"gasUsed": "0xcee2a",
"hash": "0x1768f524493543ac12785a8dd50e5a5b2c5b1ebaaef4f6202a5832783fad13bc",
"logsBloom": "0x0020000000040000000000008000000000000002004000000000004200000000000000000000000000000000000000000000000000000400000000000080000000000040400400000000000800100020000000200000000880000000808054000000000000000800000000000000080000000000001000000000001000000000000000000000000000001000c000000000000001008000080000044000404000000000800000000000000000000000000000014100000000000000000001000000000002400000020080000000000000200100002000001000008000000000000000000000000000400020000000000800000002800800400000000000001000",
"miner": "0x12794484b0a6b0f1fcee72b29d322e93e9de5aac",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x000000000007b23f",
"number": "0x43543a1",
"parentHash": "0x5d7eaaa76573015a54aee6488eb13d8ec00bc6f4bc3089dfb88794ca7f39483d",
"receiptsRoot": "0x01f0410ef63f4ccf82b01199c9474a155b94bba110c70bdd057d4e6c8ed81b76",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x30d",
"stateRoot": "0xf4053634693102b431dce144d09bc98d1a2c55fe9d7a3aac07b635598ae65fc9",
"timestamp": "0x624e8191",
"totalDifficulty": "0x0",
"transactions": [
"0x1bbc639c7dd00b9a09e51b606137be180c7812c8a752aa90d89fb6b22ef45807",
"0x142febc57ab34e731da29cd68f5330f54311ddab11827ca4a0734ff219548602",
"0xb0312f4972128d4bfee5162ee10cdbea6d0252c337db0c88fed6ce4c16ce8008"
],
"transactionsRoot": "0x88f46d2a970b199cf94bb9fe88f5cc0cb52dffa66e5c6a4ac6b6eeda51b69d53",
"uncles": []
}

Endpoint

Params

blockHash

includeTransactions


Request

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