I want to get the address of an event for a contract I created in mumbai test network, but I get the following error

Error: Internal JSON-RPC error.
  "message": "Blockheight too far in the past: eth_getLogs. Range of blocks allowed for your plan: 1000",
  "code": -32005

I tried this.

const polygonContractAddress = 'CONTRACT_ADDRESS';
const polygonTokenContract = new polygonWeb3.eth.Contract(

const txs = await polygonTokenContract.getPastEvents('Mint', {
  filter:{tokenId: '2'},
  fromBlock: 0,
  toBlock: 'latest',

I could get events in rinkeby test newwork. How can I get it ?

I don't get a meaning of "your plan".

3 Answers 3


The reason can be about both the network you're working on (Mumbai testnet / Polygon mainnet) and the API URL limitations.

I was using the free version of the QuickNode API URL and I was working on the Mumbai testnet. After changing the API to Alchemy and the network to Goerli, everything started to work normally. (By the way, I was using the thirdweb-dev/sdk package to deploy and work with my contract, but it's not different from implementing the contract using Solidity)


You get that because of fromBlock: 0. It's telling you that your 'plan' only allows you to retrieve 1000 blocks but from 0 to the latest is more than 1000. I was confused too... perhaps Polygon has different plans for different types of users. I couldn't find any documentation on this.

What I did was get the current block using web3.eth.getBlockNumber, then when that returns set the option fromBlock: currentBlock - 50

Make sense?


It maybe very late since the date you pose this question but I had this problem too.

I am using metamask and the issue is the rpcUrl in it.

I was using https://rpc-mumbai.maticvigil.com, which maticvigil have tier plans. So I switch to Alchemy rpc url in network settings in metamask and it work with fromBlock: 0.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.