eth_newFilter
Installs a log filter on the node and returns its ID. Poll the filter with eth_getFilterChanges for logs added since the last poll, or with eth_getFilterLogs for every matching log.
Ethereum specification · All supported methods
Parameters
Parameters are positional, in the order below.
| Parameter | Type | Required | Description |
|---|---|---|---|
Filter | Filter object | Yes | The logs to match. See the fields below. |
Filter fields
| Field | Meaning |
|---|---|
fromBlock, toBlock | Inclusive hexadecimal block numbers or supported block tags; default latest |
address | One contract address or an array of addresses; omit to match all addresses |
topics | Ordered topic filters; null matches any value at a position, and an array matches any listed topic at that position |
Return value
The new filter’s ID as a hexadecimal quantity.
Example
Replace <gateway-url> with your gateway base URL and <service-url> with the chain’s service path, such as service/ethereum.
sh
curl -X POST "<gateway-url>/<service-url>" \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","id":1,"method":"eth_newFilter","params":[{"fromBlock":"latest","address":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}]}'Illustrative response; values depend on the selected network and request:
json
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1"
}