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(
  ownerAddress,
  "0x0000000000000000000000000000000000000000",
  tokenId
);  
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?
https://explorer-mainnet.maticvigil.com/tx/0xd4fec0e73bda001db13d69e66ae1b79ce7c70aa34b4c3943fec51f15ac2cb3c9/logs

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!

Hello,

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",
  "params":
  [
    {
      "fromBlock": "0xd81e41",
      "toBlock":"latest",
      "address":"0x2171a0dc12a9e5b1659fef2bb20e54c84fa7db0c",
      "topics":[
        "0x9f16cbcc523c67a60c450e5ffe4f3b7b6dbe772e7abcadb2686ce029a9a0a2b6",
        "0x6ef022327bebbf68f155f3f606534b62dbced1c011413fa9adae35654c05ec0c"
      ]
    }
  ],
  "id":1,
  "jsonrpc":"2.0"
}

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).