Polygon
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Polygon
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
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.| # | Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|---|
| 1 | filter | object | Sí | 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). |
| Tipo | Descripción |
|---|---|
| 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.
| Código | Mensaje | Causa |
|---|---|---|
-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.Parámetros
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).