Параметры
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.