参数
blockHashstring必填- 32-byte block hash.
fullTransactionsboolean必填- true returns full transaction objects, false only their hashes.
返回值
object Block object, or null.
numberstring- Block number, hex.
hashstring- Block hash.
parentHashstring- Hash of the parent block.
timestampstring- Unix timestamp, hex.
minerstring- Fee recipient address.
gasUsedstring- Total gas used by the block's transactions, hex.
gasLimitstring- Block gas limit, hex.
baseFeePerGasstring- EIP-1559 base fee, hex wei (London and later).
transactionsarray- Transaction hashes, or full transaction objects when the second parameter is true.
logsBloomstring- Bloom filter for the block's logs.
stateRootstring- Root of the state trie after the block.
适用场景
Read a block by its hash. Hashes are unique and never change, so this is safe to use while handling reorgs.
如何解读结果
Same block object as eth_getBlockByNumber. null if the hash is unknown, for example a block that was reorged out long ago.
提示
- Store block hashes next to numbers in your index; on reorg, compare parentHash to detect where the chain diverged.