Timeout error when using Polygon network rpc

I have a program that works fine in Rinkeby and Mainnet but not in Polygon.
The program is to query the burn event of ERC721. I use ethers.js.

const BurnEvent = erc721Contract.filters.Transfer(
await erc721Contract.attach(lock.nftContractAddress).queryFilter(BurnEvent, 0, "latest");

Is there any difference between Polygon and Rinkeby/Mainnet network?

I have already enabled Polygon extension and registered my credit card.

Also, do I have any mistakes with the command below to query the data below from the curl?

ccurl https://polygon-mainnet.infura.io/v3/<my-key>\
                            -X POST \
                            -H "Content-Type: application/json" \                                -d 
'{"jsonrpc":"2.0","method":"eth_getLogs","params": [{"fromBlock":"0x10000", 
"address":"0x5D17AC41E53f80eA28AF53014E474b4F227809ed" , "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000003639f46a7c2060fff60c9020bdcc92055a9af1cc","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000002"]}],"id":1}'

I get this error

 {"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"request failed or timed out"}}curl: (3) URL using bad/illegal format or missing URL

Self solved.

Had to input “fromBlock” or “toBlock” in order to decrease the range of search. Assuming Polygon’s RPC is not as high spec as mainnet.

1 Like

Hi @ksuhara, and welcome to the Infura community! Thanks so much for sharing your solution - we appreciate you helping out the community!


I’m facing a similar issue, though I’m specifying fromBlock and toBlock

POST https://polygon-mainnet.infura.io/v3/xxx
Content-Type: application/json

  "method": "eth_getLogs",
      "fromBlock": "0xd81e41",

The response ends up with a timeout:

  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32603,
    "message": "request failed or timed out"

I’m using a similar query on Rinkeby and mainnet since over 2 years with no issues.

Is there any limitation related to Polygon ? What solution do I have ?

Thanks for the help,

Hi @request, and welcome to the Infura community! You can try querying fewer blocks, which should get you started on the right path. We have been seeing some limitations with Polygon, but that can be fixed by iterating over the larger amount of blocks with smaller chunks (if that makes sense).