参数
timestampstring必填- Unix time in seconds, as a decimal string, e.g. "1704067200" for 2024-01-01 00:00 UTC.
fullTransactionsboolean必填- true for full transaction objects, false for hashes.
返回值
object Block object.
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.
适用场景
Turn a date into a block in one call: end-of-month balances, the state at a report date, the block when an incident started.
如何解读结果
A normal block object. Compare its timestamp to yours: it is the block closest to the requested time.
提示
- Pair it with eth_getBalance or eth_call at the returned number to read history by date.
- Timestamps are seconds, not milliseconds: Date.now() / 1000 in JavaScript.