I'm trying to get the past events from a contract's Deposit method:

const events = await tornado.getPastEvents('Deposit', { fromBlock: 0, toBlock: 'latest' })

However, web3 throws an error saying it's too many blocks:

Error: Error: Returned error: requested too many blocks from 90000 to 97491, maximum is set to 512

How can I increase the max of 512 blocks?

  • How do you connect to the ethereum network? infura, geth, parity.
    – Ismael
    Apr 9, 2021 at 4:25
  • 1
    I'm actually connecting to the Avalanche testnet (Fuji): api.avax-test.network/ext/bc/C/rpc
    – doctopus
    Apr 9, 2021 at 4:42
  • It seems to be a limitation by the api provider, geth doesn't have such problem.
    – Ismael
    Apr 9, 2021 at 4:57
  • That makes sense then, thank you.
    – doctopus
    Apr 9, 2021 at 15:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.