0

How to get the timestamp from the latest event on a contract using the etherscan.io api ?

I'm using the getLogs call this way: https://api.etherscan.io/api?module=logs&action=getLogs&fromBlock=6572886&toBlock=latest&address=xxx&apikey=xxx

Seems you need to use the fromBlock=xxx toBlock=xxx arguments but I can't figure out a convenient way to know if an event happened in the last day for example.

1

The blockchain doesn't have an understanding of "time", only "blocks"

In order to get close, your assumption is correct, you will need to estimate the average blocks per time period / hashrate, and query based on that

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.