Ethereum
准备好在生产环境中调用了吗?
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Ethereum
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_newFilter is the log-watching member of the filter family. You hand the node a filter object — a contract address (or list of them), a set of indexed topics, and an optional fromBlock/toBlock window — and it returns a hex filter ID that remembers those criteria. From then on you poll eth_getFilterChanges with the ID to pull only the matching event logs that appeared since your last call, without resending the whole query each time. It is the polling cousin of eth_getLogs, trading one big historical scan for a running incremental feed. Register the filter at https://ethereum.therpc.io/YOUR_API_KEY on chain ID 1. Topics encode signatures like an ERC-20 Transfer or a Uniswap Swap, so you can target exactly the events you care about.
Transfer events by registering its address and the Transfer topic once, then polling roughly each 12-second slot for new hits instead of re-sending the full filter every time.Swap topic so your service ingests trades as blocks land.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | filter | object | 是 | Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]). |
| 类型 | 描述 |
|---|---|
| string | Hex filter ID. Pass this to eth_getFilterChanges, eth_getFilterLogs, or eth_uninstallFilter. |
Try it live in the Ethereum playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-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. |
eth_getFilterChanges returns filter-not-found, recreate the filter and continue from the last block you processed.eth_subscribe with a logs subscription over WebSocket delivers the same events without the recreation dance.参数
Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]).