eth_getBlockByNumber
Returns information about a block by block number.
Parameters
Block Number
The block number can be:
- A hex number in a string: eg.
"0x800"
- A block hash as a string eg.
"0xf77e76c25038b0be1fbd12a4f3e404173802bf0c9a9e62deef7949201d59ebfb
"earliest"
for the earliest block"latest"
for the latest block"safe"
for the block that the node's high quorum certificate points to"finalized"
for the latest finalized block."pending"
is the block that is about to be created.
Hydrated
If this parameter is true
, we return transaction objects. If false
, we return a list of hashes.
Results
A block structure, or null
if no such block is known to this node.
Block
Parameter | Type | Required | Description |
---|---|---|---|
hash |
string | required | Block hash as a hex number |
parentHash |
string | required | Hash of the parent of this block |
sha3Uncles |
string | required | Since zq2 has no uncles, this field is always 0x0 |
miner |
string | required | Set to the address that received the reward for generating this block |
stateRoot |
string | required | The state root hash for this block |
transactionsRoot |
string | required | Always 0x0 |
receiptsRoot |
string | required | Always 0x0 |
logsBloom |
string | required | Always 0x0 |
difficulty |
number | required | 0 |
number |
string | required | Block number in hex |
gasLimit |
string | required | Gas limit for this block, in hex |
gasUsed |
string | required | Gas used in this block, in hex |
timestamp |
string | required | Hex value of the number of seconds between the UNIX epoch and the creation of this block |
extraData |
string | required | Hex value of extra data for this block; currently always 0x0 |
mixHash |
string | required | hex number, always 0x0 |
nonce |
string | required | hex number, always 0x0 |
totalDifficulty |
number | required | 0 |
size |
number | required | Always 0 |
transactions |
array | required | An array of either transaction hashes or returned transaction objects |
uncles |
array | required | Always empty |
quorum_certificate |
object | required | zq2-specific quorum certificate |
aggregate_quorum_certificate |
object | optional | An aggregate quorum certificate, if one was attached to this block |
The quorum_certificate
contains:
Parameter | Type | Required | Description |
---|---|---|---|
signature |
string | required | Hex string; the BLS aggregate signature of the block hash in this view |
cosigned |
array | required | An array of integers; 1 means this committee member participated in the signature, 0 that they did not |
view |
string | required | Hex string; the view number for this QC |
block_hash |
string | rquired | Hex string; the block hash |
Sometimes, a quorum certificate cannot be established for a proposal due to validator failure or some other cause. When this happens, an aggregate_quorum_certificate
appears in the next block, with the quorum_certificate
providing a copy of the highest QC within this aggregate.
Parameter | Type | Required | Description |
---|---|---|---|
qcs |
array | required | A vector of quorum_certificate s. |
signature |
string | required | Hex string; the BLS aggregate signature of the qcs in this aggregate |
cosigned |
array | required | An array of integers; 1 means this committee member participated in the signature, 0 that they did not |
view |
string | required | Hex string; the view number for this QC |
We do not currently report:
baseFeePerGas
withdrawalsRoot
blobGasUsed
excessBlobGas
parentBeaconBlockRoot
If hydrated
is true
, blocks contain returned transactions.
Returned transaction
Parameter | Type | Required | Description |
---|---|---|---|
blockHash |
string | required | Hash of the block in which this transaction appears |
blockNumber |
string | required | Hex number of the block in which this transaction appears |
from |
string | required | From address of this transaction |
gas |
string | required | Hex number - the amount of gas used by this transaction |
gasPrice |
string | required | Hex number - the gas price charged for this transaction, per gas unit |
maxFeePerGas |
string | optional | Hex number - max fee per gas for this transaction. See EIP-1559. |
maxPriorityFeePerGas |
string | optional | Hex number - max priority fee per gas. See EIP-1559. |
hash |
string | required | The transaction hash for this transaction |
input |
string | required | The input for this transaction |
nonce |
string | required | Hex number; the nonce for this transaction. |
to |
string | required | To address for this transaction |
value |
string | required | Hex number; the value sent with this transaction |
v |
string | required | Hex number; the v parameter for the signature for this transaction |
r |
string | required | Hex number; the r parameter for the signature on this transaction |
s |
string | required | Hex number; the s parameter for the signature on this transaction |
chainId |
string | optional | Hex number. The (EVM) chain id for this zq2 chain |
access_list |
array | optional | EIP-1559 access list. |
type |
string | required | Hex number; type of this transaction |
Example Request
sh
curl -d '{
"id": "1",
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": [ "0x4f60", true
]}' -H "Content-Type: application/json" -X POST "https://api.zq2-prototestnet.zilliqa.com/"
Example response
{
"jsonrpc": "2.0",
"result": {
"number": "0x4f60",
"view": "0x4f61",
"hash": "0x4d834e76f63b80eae3f4dedf675b04bbbf2d8f188f7023ca09f4ed346b6893c2",
"parentHash": "0x50b3b76c3a4f19ac20e498744d8e0ff9a110b9130acb3ba786c80c26738ee9ae",
"nonce": "0x0000000000000000",
"sha3Uncles": "0x0000000000000000000000000000000000000000000000000000000000000000",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"stateRoot": "0x680b514e8fe0bf0cbc34173a7911b1d8c79a357830cb28d22c5ae53078ef8dfd",
"receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x7e5f4552091a69125d5dfcb7b8c2659029395bdf",
"difficulty": "0x0",
"totalDifficulty": "0x0",
"extraData": "0x",
"gasLimit": "0x501bd00",
"gasUsed": "0x8484",
"timestamp": "0x667aef3b",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"size": "0x0",
"transactions": [
{
"blockHash": "0x4d834e76f63b80eae3f4dedf675b04bbbf2d8f188f7023ca09f4ed346b6893c2",
"blockNumber": "0x4f60",
"from": "0xcb57ec3f064a16cadb36c7c712f4c9fa62b77415",
"gas": "0xb709",
"gasPrice": "0x454b7a4e100",
"hash": "0x1d6fea3e5707aa24a7a1ce6f661adab0655c2e2438dddee16dacdf3d6cf14ee4",
"input": "0x19ff1d21",
"nonce": "0x1",
"to": "0x45c3e57617b87c0e24d66b3eb4860a87bfeef25a",
"transactionIndex": "0x0",
"value": "0x0",
"v": "0x1059c",
"r": "0x8a08e389457722e33b4bd4429321ec3b4bbe09a8b67c6199d81fa65ea813c699",
"s": "0x7756145d26b4496e0a0a83870cc52d9a195c4017e712b344e1a2a09811832b07",
"chainId": "0x82bc",
"type": "0x0"
}
],
"uncles": [],
"quorumCertificate": {
"signature": "0xb6b62fb4c527863d9e0d8f4335cd4beceace8ea2fa37dae18c62755d599dd59934a23a03ba66e4e876449e853b345697164b9e1b9c12676abf98111a59d449960d61b6155ab38b32556021832aef440fffa355503b01ee83cfa6ba62680f1fc5",
"cosigned": "[1, 0, 1, 1]",
"view": "0x4f60",
"block_hash": "0x50b3b76c3a4f19ac20e498744d8e0ff9a110b9130acb3ba786c80c26738ee9ae"
}
},
"id": "1"
}
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | Required | "1" |
jsonrpc |
string | Required | "2.0" |
method |
string | Required | "eth_getBlockByNumber" |
params |
array | Required | [ block_number, hydrated ] |