cfx_getBlockByBlockNumber
Returns block with given block number.
- 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": ["0x0",false],
"method": "cfx_getBlockByBlockNumber"
}'
Params
block_number required
Schema
type : string
Pattern :
^0x([1-9a-f][0-9a-f]{0,15}|0)$
include_txs required
Schema
type : boolean
Result
Schema
type : object
adaptive adaptive
type : booleanbaseFeePerGas baseFeePerGas
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
blame blame
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,15}|0)$
blockNumber blockNumber
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
custom custom
type : arrayitems[x]
Bytestype : stringPattern :^0x[0-9a-f]*$
deferredLogsBloomHash deferredLogsBloomHash
type : stringPattern :^0x[0-9,a-f,A-F]{64}$
deferredReceiptsRoot deferredReceiptsRoot
type : stringPattern :^0x[0-9,a-f,A-F]{64}$
deferredStateRoot deferredStateRoot
type : stringPattern :^0x[0-9,a-f,A-F]{64}$
difficulty difficulty
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
epochNumber epochNumber
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
gasLimit gasLimit
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
gasUsed gasUsed
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
hash hash
type : stringPattern :^0x[0-9,a-f,A-F]{64}$
height height
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
miner miner
type : stringPattern :^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
nonce nonce
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
parentHash parentHash
type : stringPattern :^0x[0-9,a-f,A-F]{64}$
posReference posReference
type : stringPattern :^0x[0-9,a-f,A-F]{64}$
powQuality powQuality
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
refereeHashes refereeHashes
type : arrayitems[x]
H256type : stringPattern :^0x[0-9,a-f,A-F]{64}$
size size
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
timestamp timestamp
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
transactions transactions
oneOf- (H256,...)[]
- (Transaction,...)[]
type : arrayitems[x]
H256type : stringPattern :^0x[0-9,a-f,A-F]{64}$
type : arrayitems[x]
Transactiontype : objectaccessList accessList
type : arrayitems[x]
CfxAccessListItemtype : objectaddress address
type : stringPattern :^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
storageKeys storageKeys
type : arrayitems[x]
H256type : stringPattern :^0x[0-9,a-f,A-F]{64}$
blockHash blockHash
type : stringPattern :^0x[0-9,a-f,A-F]{64}$
chainId chainId
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
contractCreated contractCreated
type : stringPattern :^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
data data
type : stringPattern :^0x[0-9a-f]*$
epochHeight epochHeight
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
from from
type : stringPattern :^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
gas gas
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
gasPrice gasPrice
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
hash hash
type : stringPattern :^0x[0-9,a-f,A-F]{64}$
maxFeePerGas maxFeePerGas
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
maxPriorityFeePerGas maxPriorityFeePerGas
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
nonce nonce
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
r r
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
s s
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
space space
type : stringPossible values :native
ethereum
status status
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,15}|0)$
storageLimit storageLimit
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
to to
type : stringPattern :^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
transactionIndex transactionIndex
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,15}|0)$
transactionType transactionType
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,15}|0)$
v v
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
value value
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,63}|0)$
yParity yParity
type : stringPattern :^0x([1-9a-f][0-9a-f]{0,15}|0)$
transactionsRoot transactionsRoot
type : stringPattern :^0x[0-9,a-f,A-F]{64}$
Examples
- cfx_getBlockByBlockNumber
- cfx_getBlockByBlockNumber
- cfx_getBlockByBlockNumber
- cfx_getBlockByBlockNumber
- cfx_getBlockByBlockNumber
Request
curl -X POST --data \
'{
"jsonrpc": "2.0",
"id": 1,
"method": "cfx_getBlockByBlockNumber",
"params": [
"0x0"
]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
null
Request
curl -X POST --data \
'{
"jsonrpc": "2.0",
"id": 1,
"method": "cfx_getBlockByBlockNumber",
"params": [
"0x100"
]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
"adaptive": false,
"baseFeePerGas": "0x3b9aca00",
"blame": "0x0",
"blockNumber": "0x100",
"custom": [],
"deferredLogsBloomHash": "0xd397b3b043d87fcd6fad1291ff0bfd16401c274896d8c63a923727f077b8e0b5",
"deferredReceiptsRoot": "0x12af19d53c378426ebe08ad33e48caf3efdaaade0994770c161c0637e65a6566",
"deferredStateRoot": "0x876e9208267ce87cb36549d55c936658dd6ca6ef76f9a84b2a24570f0dd01724",
"difficulty": "0x4c4b40",
"epochNumber": "0x47",
"gasLimit": "0x1c9c380",
"gasUsed": "0x0",
"hash": "0x7b02db101c3cf00c4f7eb80de5a550ba55ed48ade9cd01b2cf66215a79ccc5f1",
"height": "0x46",
"miner": "CFXTEST:TYPE.USER:AAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA65R5HPNB",
"nonce": "0x214b5b140a9e8330",
"parentHash": "0xa47ae56442d4e0372c98d4ef8c3a189421c1c55ef7a9f7d2090d978530da6d46",
"posReference": null,
"powQuality": "0x6692de",
"refereeHashes": [],
"size": "0x0",
"timestamp": "0x5f9bc2ea",
"transactions": [],
"transactionsRoot": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
}
Request
curl -X POST --data \
'{
"jsonrpc": "2.0",
"id": 1,
"method": "cfx_getBlockByBlockNumber",
"params": [
"0x100",
true
]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
"adaptive": false,
"baseFeePerGas": "0x3b9aca00",
"blame": "0x0",
"blockNumber": "0x100",
"custom": [],
"deferredLogsBloomHash": "0xd397b3b043d87fcd6fad1291ff0bfd16401c274896d8c63a923727f077b8e0b5",
"deferredReceiptsRoot": "0x12af19d53c378426ebe08ad33e48caf3efdaaade0994770c161c0637e65a6566",
"deferredStateRoot": "0x876e9208267ce87cb36549d55c936658dd6ca6ef76f9a84b2a24570f0dd01724",
"difficulty": "0x4c4b40",
"epochNumber": "0x47",
"gasLimit": "0x1c9c380",
"gasUsed": "0x0",
"hash": "0x7b02db101c3cf00c4f7eb80de5a550ba55ed48ade9cd01b2cf66215a79ccc5f1",
"height": "0x46",
"miner": "CFXTEST:TYPE.USER:AAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA65R5HPNB",
"nonce": "0x214b5b140a9e8330",
"parentHash": "0xa47ae56442d4e0372c98d4ef8c3a189421c1c55ef7a9f7d2090d978530da6d46",
"posReference": null,
"powQuality": "0x6692de",
"refereeHashes": [],
"size": "0x0",
"timestamp": "0x5f9bc2ea",
"transactions": [],
"transactionsRoot": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
}
Request
curl -X POST --data \
'{
"jsonrpc": "2.0",
"id": 1,
"method": "cfx_getBlockByBlockNumber",
"params": [
"0x11111111111111"
]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
null
Request
curl -X POST --data \
'{
"jsonrpc": "2.0",
"id": 1,
"method": "cfx_getBlockByBlockNumber",
"params": [
"0x11111111111111111"
]
}' \
-H "Content-Type: application/json" \
localhost:12539
Response
{
"code": -32602,
"message": "Invalid params: invalid length 17, expected a (both 0x-prefixed or not) hex string with length between (0; 16]."
}