1

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?

0

You can do this in two steps:

  1. Get the number of the latest block using:

    https://api.etherscan.io/api?module=proxy&action=eth_blockNumber&apikey=YourApiKeyToken

  2. get the block using:

    https://api.etherscan.io/api?module=block&action=getblockreward&blockno=2165403&apikey=YourApiKeyToken

    change blockno='value obtained from the previous step'

Hope this helps

  • Thanks Jamie, do you happen to know also how can I get the number of transactions made within the last 24 hours (from etherscan)? – forhas May 29 '18 at 16:53
4

Even easier:

https://api.blockcypher.com/v1/eth/main

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

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.