I'm trying to get the latest block (it's height) using Ethereum Developer APIs of etherscan.

For example, I can get it from blockcypher using the following URL: https://api.blockcypher.com/v1/eth/main

(see the field "height")

Couldn't find a way to get this data from etherscan, is there and I'm missing it?

3 Answers 3


You can do this in two steps:

  1. Get the number of the latest block using:


  2. get the block using:


    change blockno='value obtained from the previous step'

Hope this helps


Even easier:


Blockcypher is a pretty good api for this kind of stuff.


Or you can get the current timestamp from code (if you use python: current_timestamp = time.time()), then use the following URL:

https://api.etherscan.io/api ?module=block &action=getblocknobytime &timestamp=1578638524 &closest=before &apikey=YourApiKeyToken

replace 1578638524 with the current_timestamp you got.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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