-
Notifications
You must be signed in to change notification settings - Fork 470
Description
Rationale
eth_getTransactionByHash returns the transaction together with blockHash and blockNumber once it is mined, but it does not include the block timestamp.
As a result, clients must issue an additional RPC call (eth_getBlockByHash or eth_getBlockByNumber) to retrieve the timestamp, even though this information is already known by the node at that point.
This extra round-trip significantly increases latency and RPC load for a very common access pattern.
Use-cases include:
- Wallets displaying transaction history with timestamps
- NFT marketplaces and indexers tracking transfers
- Block explorers and analytics tools
- Mobile or high-latency clients where minimizing RPC calls is important
Including the timestamp directly would improve performance, simplify client code, and reduce unnecessary RPC traffic.
Implementation
A possible implementation would be to add an optional field to the eth_getTransactionByHash response, for example:
"blockTimestamp": "0x6565f1a0"- Present only for mined transactions
nullor omitted for pending transactions- Encoded in the same hex format as block timestamps in
eth_getBlockBy*
This change would be fully backward-compatible, as it only adds a new field.
Orignally from ethereum/go-ethereum#33491