Returned error: query returned more than 10000 results. Try with this block range [0x5D3929, 0x5D3929]

Hi there,

I dont know if this is a bug, or missing rate limits…

I’m trying to get all logs from block 6109481 on goerli (= https://goerli.etherscan.io/block/6109481) the request response is saying there are more then 10.000 results …?

In an other post i seen an engineer upping the amount of results from 1K to 10K is.

What can i do to get the logs out of here.

With kind regards

Hi there @nonation and welcome to the community.

Would you mind sharing the request you are making? I suspect you are not using the toBlock parameter , so the toBlock parameter will default to latest. Basically you are trying to get all logs from block 6109481 to the latest one and you are hitting the 10k limit.

Try running it like this:

curl https://goerli.infura.io/v3/API-KEY \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"method": "eth_getLogs", "params": [{"fromBlock": "0x5D3929", "toBlock":"0x5D3929"}], "id":1, "jsonrpc":"2.0"}'

0x5D3929 is the hexa for 6109481.

Actually now I am seeing that you are trying to get all logs from block 6109481 to 6114481. As I mentioned in my first reply we do have a 10K limit for results display and our logs service has a block-range hint when requests are too large.
The reason you received that suggestion is that the next block 6109482 (0x5D392A) has more than 10K logs and I am suggesting to query that one independently as well:

curl https://goerli.infura.io/v3/API-KEY \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"method": "eth_getLogs", "params": [{"fromBlock": "0x5D392A", "toBlock":"0x5D392A"}],  "id":1, "jsonrpc":"2.0"}'

Then try to adjust the range from 6109483 (0x5D392B) onward into smaller chunks.
Hope this helps.

Sorry i have edited my first post.

I want all events from block 6109481 but still i get more then 10K results error:

query returned more than 10000 results. Try with this block range [0x5D3929, 0x5D3929]

FYI i use the response to set a range to fetch logs from the blockchain. So i try to listen to the return values and then put those values in the options of getPastLogs.

If i look at the block explorer, i dont see more then 10K results, but still the infura RCP is giving this error.

i fixed it, the block 6109481 has no logs that are interesting so we didnt +1 the next blocknumber.

Now i get this error:
Returned error: query returned more than 10000 results. Try with this block range [0x5D3935, 0x5D3934]

But the fromBlock is greater then the tillBlock. thats odd to me…

That’s strange indeed, can you let me what was the block range you queried when you got the response
Try with this block range [0x5D3935, 0x5D3934], as I couldn’t figure it out from your reply.

Its around the 0x5D3935 block -1 or +1 cant see the log anymore

Thanks @nonation , the issue you spotted was fixed. Found it my self as well, when querying "params": [{"fromBlock": "0x5D3935", "toBlock":"0x5D3936"}], . Now when the logs are too large, like it happened for the ones in block 0x5D3935, the correct hint would be shown.