跳到主要内容

eth_getBlockByNumber

Gets a block for a given number

Params

(2)

1. blocknumber (required)

(one of)
string
Match pattern:
^0x([1-9a-f][0-9a-f]{0,15}|0)$

2. includeTransactions (required)

boolean

Result

(getBlockByNumberResult)
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_getBlockByNumber",
"params": [
"latest",
false
],
"jsonrpc": "2.0",
"id": 1
}' \
-H "Content-Type: application/json" \
localhost:12539

Result

{
"author": "0x166d0ff7691030b0ca33d4e60e842cd300a3010d",
"difficulty": "0x30058e5",
"extraData": "0x",
"gasLimit": "0x1c9c380",
"gasUsed": "0x0",
"hash": "0xd9c29e2a0574ffed11505d429b75eb8b05e23fca633a3f6ab6de525328106011",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x166d0ff7691030b0ca33d4e60e842cd300a3010d",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x75058810f98d0e6e",
"number": "0x43f3b63",
"parentHash": "0xa4800e7b733895d426e975e37ea97965ab242a7e114011dfd35f8be499249330",
"receiptsRoot": "0x09f8709ea9f344a810811a373b30861568f5686e649d6177fd92ea2db7477508",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x0",
"stateRoot": "0x1fc00508a2b18740af339125ec6198833703578d6de66b791340cbff425de77a",
"timestamp": "0x62554583",
"totalDifficulty": "0x0",
"transactions": [],
"transactionsRoot": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"uncles": []
}

Endpoint

Params

blocknumber

includeTransactions


Request

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