Polygon
Bereit, das in der Produktion aufzurufen?
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
Polygon
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
eth_newFilter registers a server-side log filter — defined by an address, a block range, and topic criteria — and returns a hex filter ID. You poll that ID with eth_getFilterChanges to pull only the logs that matched since your last poll, without resending the full filter each time. On Polygon, the MATIC-powered PoS chain at https://polygon.therpc.io/YOUR_API_KEY (chain ID 137, 0x89), this is the standard way to follow contract events over plain HTTP — handy for tracking activity on busy DeFi venues like QuickSwap or Aave.
Transfer events — for instance from the Polygon USDT contract at 0xc2132D05D31c914a87C6611C10748AEb04B58e8F — on a short interval without re-specifying the full filter each round.Swap events from a long-running indexer or bot, letting the server track your position in the log stream between polls.| # | Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|---|
| 1 | filter | object | Ja | Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]). |
| Typ | Beschreibung |
|---|---|
| string | Hex filter ID. Pass this to eth_getFilterChanges, eth_getFilterLogs, or eth_uninstallFilter. |
Try it live in the Polygon playground.
| Code | Meldung | Ursache |
|---|---|---|
-32000 | filter not found | Provider rejected filter creation, or filter limit per connection was reached. |
-32602 | invalid argument | Malformed filter object or invalid topic format. |
filter not found error from eth_getFilterChanges by recreating the filter and resuming from a known block.eth_subscribe log subscription over WebSocket pushes matches to you and is more efficient than repeatedly polling a filter.Parameter
Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]).