Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth_getLogs from Ethermint with limitations like Alchemy/Infura does #67

Open
fulldiver-ilya opened this issue Aug 26, 2022 · 0 comments

Comments

@fulldiver-ilya
Copy link

fulldiver-ilya commented Aug 26, 2022

Current Behaviour

There is a limit of blocks range for eth_getLogs evmos/ethermint#860 that throws an error like Returned error: maximum [from, to] blocks distance: 10000 before actually fetching logs from blockchain itself

Expected Behavior

Expected by our partners: Alchemy and Infura made this limit with another approach described at their docs:

Alchemy

You can make eth_getLogs requests with up to a 2K block range and 150MB limit on the response size OR you can request any block range with a cap of 10K logs in the response.

If you need to pull logs frequently, we recommend using WebSockets to push new logs to you when they are available.

Infura

To prevent queries from consuming too many resources, eth_getLogs requests are currently limited by two constraints:

  • A max of 10,000 results can be returned by a single query
  • Query duration must not exceed 10 seconds

Steps to Reproduce

  const web3 = new Web3(<#json-rpc url#>);
  const contractAbi = require(<#ABI for contract#>);
  const contract = new web3.eth.Contract(contractAbi, <#contract's address#>);
  
  await contract.getPastEvents(
    "Transfer",
    {
      filter: { from: <#wallet address#> },
      fromBlock: "earliest",
      toBlock: "latest", // make sure there is more than 10k blocks between `earliest` and `latest`
    },
    (err, events) => {
      res.send(err ?? events);
    }
  );  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant