Blocks
Table function
The eth_blocks_rpc table provides detailed information about Ethereum blockchain blocks. A block comprises hashed transactions added to the blockchain. Each block contains a parent hash reference and a timestamp. The table includes details such as block number, block hash, block size, transaction count, and gas used.
Procedure
To utilize the eth_blocks_rpc function, follow these steps:
Setup: Ensure you have access to an EVM node via a reliable RPC URL.
Input Parameters: Define the range of blocks you wish to fetch by specifying
fromBlock
andtoBlock
, both of which should beBigInt
values. Ensure thatfromBlock
is less than or equal totoBlock
.Execution: Call the function with the specified
fromBlock
,toBlock
, andrpc_url
to retrieve data about the blocks within the given range.Output Analysis: Analyze the resulting data, which includes details like block hash, number, miner, and other block-specific metrics as outlined in the output table. Use this information to gain insights or perform further analysis on EVM blockchain blocks.
Inputs
fromBlock
BIGINT
Block number to start scanning from.
toBlock
BIGINT
Block number to stop scanning at.
url
VARCHAR
URL of the Ethereum node.
Outputs
hash
VARCHAR
Hash of the block. null when its pending block.
number
BIGINT
The block number. null when its pending block.
nonce
VARCHAR
A block's nonce value, used in the consensus mechanism (may be deprecated in ethereum)
baseFeePerGas
BIGINT
Minimum fee per gas unit required for transaction inclusion in this block in the ethereum unit wei
parentHash
VARCHAR
Hash of the parent block.
miner
VARCHAR
Address of the miner.
difficulty
BIGINT
Measure of how difficult it was to produce this block (deprecated in ethereum)
totalDifficulty
VARCHAR
Total chain difficulty up to this block (deprecated in ethereum)
size
BIGINT
Integer the size of this block in bytes.
gasLimit
BIGINT
The maximum gas allowed in this block.
gasUsed
BIGINT
The total used gas by all transactions in this block.
timestamp
TIMESTAMP
The unix timestamp for when the block was collated.
sha3Uncles
VARCHAR
SHA3 of the uncles data in the block.
logsBloom
VARCHAR
The bloom filter for the logs of the block.
transactionsRoot
VARCHAR
The root of the transaction trie of the block.
stateRoot
VARCHAR
The root of the final state trie of the block.
receiptsRoot
VARCHAR
The root of the receipts trie of the block.
extraData
VARCHAR
Extra data field of this block.
Example
The above example demonstrates how to query Ethereum block data using a specified range of block numbers and an RPC URL. The table output displays various attributes of the Ethereum blocks, such as the block hash, block number, nonce, base fee per gas, parent hash, miner address, difficulty, total difficulty, size, gas limit, gas used, and timestamp. These attributes provide valuable insights into the blockchain's state and activity for the queried range of blocks.
Dependent RPC Method
eth_getBlockByNumber
Last updated