Appearance
eth_newFilter
served · same as reth
Creates a log filter on the node and returns its ID. Poll it with eth_getFilterChanges.
When to use
Use it to follow new logs over HTTP, where subscriptions do not work. Over a WebSocket, eth_subscribe with logs is simpler.
Example
bash
curl -s -X POST -H 'Content-Type: application/json' \
--data '{"jsonrpc": "2.0", "id": 1, "method": "eth_newFilter", "params": [{"fromBlock": "0x18facad", "toBlock": "0x18facad"}]}' \
http://127.0.0.1:8547json
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_newFilter",
"params": [
{
"fromBlock": "0x18facad",
"toBlock": "0x18facad"
}
]
}Response
Live mainnet, block 26193069, 2026-10-14. Checked against reth 2.7: equal.
json
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xef5bb4ff9cc00a305f096b0bb94ab63b"
}The filter id is random. The answer changes with time, so it is compared by shape (keys and types; for a list, its first item), not by value.
Parameters
| Name | Type | Required | Meaning |
|---|---|---|---|
filter | object, see Filter | yes | Which logs the filter matches. |
The main fields of filter. The Filter page has all of them.
| Field | Type | Meaning |
|---|---|---|
fromBlock | block number in hex, or a tag | The first block of the range, included. Default: latest. A number below the first block of the node gives the error 4444. |
toBlock | block number in hex, or a tag | The last block of the range, included. Default: latest. A number above the head gives the error -32602. |
address | address, or a list of addresses | Only logs from this contract, or from any contract in the list. Default: any address. |
topics | list of at most 4 items | One item per topic position. Each item is null (any topic), one topic, or a list of topics (any of them). |
Returns
The filter ID, 16 random bytes as hex (0x and 32 hex digits).
Notes and limits
- The node keeps at most 1 024 filters for all clients together. One client can have at most 256 filters (
--rpc-filters-per-client N, 0 for no such limit). The node identifies a client by its IPv4 address or by the first 64 bits of its IPv6 address. - A client on the same host (127.0.0.0/8 or ::1) has no limit of its own. Behind a proxy on another host, all clients have the address of the proxy. Then set
--rpc-filters-per-client 0. A proxy on the same host as the node also removes the limit for all clients behind it. - When the node has 1 024 filters, a new filter replaces the least recently polled filter of the client that has the most filters.
- A log filter has at most 1 024 addresses and topic values together.
- A filter expires 5 minutes after its last poll with
eth_getFilterChanges. - The node keeps filters in memory. A restart removes them.
Errors
| Code | Message | When |
|---|---|---|
| -32603 | too many filters | The client already has 256 filters. |
| -32602 | filter has more than 1024 addresses and topic values | The filter has more than 1 024 values. |
| -32602 | Invalid params | A parameter is missing or does not parse. data has the text of reth, with the position. |
Compared with reth
The filter rules are those of reth, with the same 5-minute expiry. reth has no limit on the number of filters or on the size of a filter.
The live example above gives the same answer on Cinder and on reth 2.7.
Related methods
eth_getFilterChanges, eth_getFilterLogs, eth_uninstallFilter, eth_newBlockFilter.
Schema (OpenRPC)
The official specification: eth_newFilter in ethereum/execution-apis.
Parameter Filter: Filter by block range or Filter by block hash
json
{
"oneOf": [
{
"not": {
"required": [
"blockHash"
]
},
"properties": {
"address": {
"oneOf": [
{
"title": "Any Address",
"type": "null"
},
{
"pattern": "^0x[0-9a-fA-F]{40}$",
"title": "Address",
"type": "string"
},
{
"items": {
"pattern": "^0x[0-9a-fA-F]{40}$",
"title": "hex encoded address",
"type": "string"
},
"title": "Addresses",
"type": "array"
}
],
"title": "Address(es)"
},
"fromBlock": {
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
"title": "from block",
"type": "string"
},
"toBlock": {
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
"title": "to block",
"type": "string"
},
"topics": {
"oneOf": [
{
"title": "Any Topic Match",
"type": "null"
},
{
"items": {
"oneOf": [
{
"pattern": "^0x[0-9a-f]{64}$",
"title": "Single Topic Match",
"type": "string"
},
{
"items": {
"pattern": "^0x[0-9a-f]{64}$",
"title": "32 hex encoded bytes",
"type": "string"
},
"title": "Multiple Topic Match",
"type": "array"
}
],
"title": "Filter Topic List Entry"
},
"title": "Specified Filter Topics",
"type": "array"
}
],
"title": "Topics"
}
},
"title": "Filter by block range",
"type": "object"
},
{
"properties": {
"address": {
"oneOf": [
{
"title": "Any Address",
"type": "null"
},
{
"pattern": "^0x[0-9a-fA-F]{40}$",
"title": "Address",
"type": "string"
},
{
"items": {
"pattern": "^0x[0-9a-fA-F]{40}$",
"title": "hex encoded address",
"type": "string"
},
"title": "Addresses",
"type": "array"
}
],
"title": "Address(es)"
},
"blockHash": {
"pattern": "^0x[0-9a-f]{64}$",
"title": "block hash",
"type": "string"
},
"topics": {
"oneOf": [
{
"title": "Any Topic Match",
"type": "null"
},
{
"items": {
"oneOf": [
{
"pattern": "^0x[0-9a-f]{64}$",
"title": "Single Topic Match",
"type": "string"
},
{
"items": {
"pattern": "^0x[0-9a-f]{64}$",
"title": "32 hex encoded bytes",
"type": "string"
},
"title": "Multiple Topic Match",
"type": "array"
}
],
"title": "Filter Topic List Entry"
},
"title": "Specified Filter Topics",
"type": "array"
}
],
"title": "Topics"
}
},
"required": [
"blockHash"
],
"title": "Filter by block hash",
"type": "object"
}
],
"title": "filter"
}Result: string
json
{
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$",
"title": "hex encoded unsigned integer",
"type": "string"
}