Polygon
准备好在生产环境中调用了吗?
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Polygon
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_getLogs returns every event log on Polygon PoS (chain ID 137) that matches a filter object built from an address, a set of topics, and a block range (or a single blockHash). It is the primary one-shot method for log queries and backfill indexing: instead of maintaining a stateful filter, you describe exactly what you want and get the full matching set in one response. On Polygon, where MATIC pays for gas and the EVM-equivalent chain emits enormous volumes of Transfer and swap events from USDC, USDT, QuickSwap, and Aave, eth_getLogs against https://polygon.therpc.io/YOUR_API_KEY is how most indexers and analytics pipelines pull historical activity.
Transfer events for a token over a historical block range — for example tracing USDT on Polygon at 0xc2132D05D31c914a87C6611C10748AEb04B58e8F across a window of blocks.transactionHash-bearing block.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | filter | object | 是 | Filter object. Fields: `fromBlock` (string, default "latest"), `toBlock` (string, default "latest"), `address` (string | string[]), `topics` ((string | string[] | null)[]), `blockHash` (string — mutually exclusive with fromBlock/toBlock). |
| 类型 | 描述 |
|---|---|
| array | Array of log objects. Each log: `address`, `blockHash`, `blockNumber`, `data`, `logIndex`, `removed` (bool — true on reorg), `topics`, `transactionHash`, `transactionIndex`. |
Try it live in the Polygon playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32005 | query exceeds max block range | The fromBlock–toBlock window exceeds the provider's block-range cap. |
-32005 | query returned more than 10000 results | Too many matching logs; narrow the filter or paginate. |
-32602 | invalid argument | blockHash combined with fromBlock/toBlock, or malformed topic format. |
removed field and re-query once the range is finalized.address/topics cause timeouts or range-cap errors; given Polygon's ~2-second blocks and high event density, paginate in chunks of roughly 1000–5000 blocks.eth_getLogs with fromBlock: "latest" in a tight loop wastes CUs and can miss events — use eth_newFilter + eth_getFilterChanges or eth_subscribe for live streams instead.参数
Filter object. Fields: `fromBlock` (string, default "latest"), `toBlock` (string, default "latest"), `address` (string | string[]), `topics` ((string | string[] | null)[]), `blockHash` (string — mutually exclusive with fromBlock/toBlock).