3

I'm trying to find an API that lists all the blocks from a specific day, as we can do with bitcoin:

https://blockchain.info/pt/blocks/1515628800000?format=json

I've searched etherscan.io and blockcypher.com APIs, as well as other ones and found nothing. Some APIs can list the latest blocks, but that's not what I need.

Is there any ethereum API similar to the blockchain.info API that can show all the blocks from a specific day?

  • Dear @karliwson, Did you find my answer helpful? – Muhammad Altabba Jan 24 '18 at 19:54
7
+50

There is no Web API, but you can perform this using SQL.

You can do it simply with "Presto Ethereum Connector" (https://github.com/xiaoyao1991/presto-ethereum)

Using Presto Ethereum, you can query the blocks using an SQL command. You can base the where condition on block_timestamp.

Bellow is the structure of the "block" table provided by Presto Ethereum:

DESCRIBE block;
Column                 | Type               | Extra | Comment
-----------------------------------------------------------
block_number           | bigint             |       |
block_hash             | varchar(66)        |       |
block_parenthash       | varchar(66)        |       |
block_nonce            | varchar(18)        |       |
block_sha3uncles       | varchar(66)        |       |
block_logsbloom        | varchar(514)       |       |
block_transactionsroot | varchar(66)        |       |
block_stateroot        | varchar(66)        |       |
block_miner            | varchar(42)        |       |
block_difficulty       | bigint             |       |
block_totaldifficulty  | bigint             |       |
block_size             | integer            |       |
block_extradata        | varchar            |       |
block_gaslimit         | double             |       |
block_gasused          | double             |       |
block_timestamp        | bigint             |       |
block_transactions     | array(varchar(66)) |       |
block_uncles           | array(varchar(66)) |       |

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.