Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Transaction Logs Query of blocksRange not working? #118

Closed
zocodia opened this issue Dec 12, 2018 · 7 comments
Closed

Transaction Logs Query of blocksRange not working? #118

zocodia opened this issue Dec 12, 2018 · 7 comments

Comments

@zocodia
Copy link

zocodia commented Dec 12, 2018

Hi, I don't know if this is the best place to ask this but I can't find any subreddit or similar.
I can't seem to get my logs filter to work over a range of blocks. Is this just something to do with a limitation of Infura GraphQL example or a bug?

{
  blocksRange(numberRange: [4409881, 4409881,]) {
    transactions(filter: { withLogs: true }) {
      logs(filter: {
        topics: [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          null,
          "0x000000000000000000000000fbb1b73c4f0bda4f67dca266ce6ef42f520fbb98"
        ]
      }) {
        topics
      }
    }
  }
}

Im trying to find the best way to fetch all ERC20 transfer events for a specific address within a range of blocks.

@raulk
Copy link
Contributor

raulk commented Dec 27, 2018

There's a syntax error in the snippet you pasted, @zocodia. A query like this works for me:

{
  blocksRange(numberRange: [4409881, 4409881]) {
    transactions(filter: {withLogs: true}) {
      logs(filter: {topics: ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", null, "0x000000000000000000000000fbb1b73c4f0bda4f67dca266ce6ef42f520fbb98"]}) {
        topics
        account {
          address
        }
      }
    }
  }
}

@zocodia
Copy link
Author

zocodia commented Jan 10, 2019

Still doesnt work for me. I just keep getting all logs like if the filter is not applied. I'm using the example site in the readme.

@kshinn
Copy link
Collaborator

kshinn commented Jan 20, 2019

@zocodia I can reproduce your issue. You provide the topics filter, but are getting all logs back in that case. It looks like the topics filter is not getting respected in the query. I will create a PR that addresses this issue.

@zocodia
Copy link
Author

zocodia commented Jan 22, 2019

Exactly, thats precisely whats happening. Thanks

@kshinn
Copy link
Collaborator

kshinn commented Jan 22, 2019

@zocodia Are you running this locally or are your going through the Infura gateway? If you are running it locally, can you verify that the proposed solution #121 fixes the issue? Locally testing, it seems like this addresses the issue, but it would be good to get an additional set of eyes on it.

@zocodia
Copy link
Author

zocodia commented Feb 1, 2019

@kshinn Yeah locally works now, thank you very much! Is there any way to get past the 10 blocks range maximum?

@kshinn
Copy link
Collaborator

kshinn commented Mar 13, 2019

@zocodia Because we are still aggregating over JSON-RPC, that limit is placed there as a safe guard against spamming the node. You can define an environment variable ETHQL_QUERY_MAX_SIZE when starting the server where you can set the max range. Just take care to monitor what you are querying so that you don't end up spamming the node or getting rate limited.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants