Skip to content

Getting the timestamp of a transaction #1533

Answered by zemse
tqbl asked this question in Q&A
Discussion options

You must be logged in to vote

provider.getTransaction uses eth_getTransactionByHash under the hood. And from the specs, a standard ethereum node doesn't give you a timestamp. Here if you need the timestamp you have to do another query to fetch the block provider.getBlock(blockNumber) and get the timestamp from there.

But there can be some non-standard backends who do give timestamp, so in that case, it may helpful to include timestamp in TransactionResponse and we need to update the docs about this.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tqbl
Comment options

Answer selected by tqbl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants