1

I am trying to extract all transactions of Ethereum using the eth scan API. But I need transactions for specific time periods only. I tried running the API for all the blocks to try and extract all transactions from the beginning. But, it gave me a 403 error. Can someone please help?

  • 403 sounds like didn't pass the apiKey correctly? – ivicaa Jan 10 '19 at 21:57
  • No, I fixed it using sleep function after getting data for every 10 blocks. – Dhanya Raghu Jan 10 '19 at 22:14
2

it gave me a 403 error

403 sounds like didn't pass the apiKey correctly. UPDATE: from your comment above it seems to be a quota issue.

But I need transactions for specific time periods only.

With ethscan api you can do interval halving to find the start/end block with your matching timestamps.

Or you could use something like https://eth.events. They have all data indexed in a large database and you can use elasticsearch queries to query it.

E.g.

curl -X POST \
https://api.eth.events/ethereum/ethereum/mainnet/es/tx/search/ \
-H "Authorization: Bearer $mytoken" \
-H "Content-Type: application/json" \
-d '{
  "query": {
    "bool": {
      "filter": [
        {
          "range": {
            "timestamp": {
              "gte": 1483228800,
              "lte": 1483315200
            }
          }
        }
      ]
    }
  },
  "size": 200
}'

There is also a Google solution for this: https://cloud.google.com/blog/products/data-analytics/ethereum-bigquery-public-dataset-smart-contract-analytics

| improve this answer | |
  • I am not able to query with timestamp field. I can only do it using the block numbers for the range value. Did the above query work for you? – Dhanya Raghu Jan 12 '19 at 1:06
  • Sorry, the query was not correct. I've fixed it. It should just be timestamp instead of blockNumber.timestamp (docs.eth.events/en/latest/endpoints/tx.html) – ivicaa Jan 12 '19 at 5:52
  • How do I modify this query to get transactions specific to a contract address? – Dhanya Raghu Jan 28 '19 at 23:49

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.