eth_getFilterChanges
Last updated:
`eth_getFilterChanges` is the polling half of the stateful filter API. You first create a filter — with [`eth_newBlockFilter`](eth_newBlockFilter.md) for new blocks or `eth_newFilter` for logs — and receive a filter ID. You then call `eth_getFilterChanges` with that ID, and the server returns the items that have appeared **since your previous call** (or since the filter was created, for the first poll). Each call advances the filter's cursor, so consecutive polls never return the same item twice.
This is the HTTP-based alternative to WebSocket subscriptions (`eth_subscribe`): instead of the server pushing updates to you, your client polls on an interval. On Polygon, where block time is roughly 2 seconds, a polling loop of about that interval keeps you close to the chain tip. The trade-off versus a WebSocket subscription is more requests and slightly higher latency, in exchange for working over plain request/response HTTP with no persistent connection.
The shape of the returned array depends on the **type** of filter the ID refers to: a block filter yields an array of 32-byte block hashes, while a log filter yields an array of log objects. A poll that finds nothing new returns an empty array — this is normal and not an error.
Filters are server-side resources with a limited lifetime. If a filter ID is unknown — never created, already removed with `eth_uninstallFilter`, or expired through inactivity — the call fails with `-32000 filter not found`. Treat that as a signal to recreate the filter and resume polling.
Parameters
This method takes no parameters.
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getFilterChanges","params":[]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "eth_getFilterChanges",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"eth_getFilterChanges","params":[],"jsonrpc":"2.0"})
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet.
- Credit cost: 1 per call.
FAQ
- What does eth_getFilterChanges do?
- Polls a previously created server-side filter and returns everything that has matched since the last poll.
- How many credits does eth_getFilterChanges cost?
- eth_getFilterChanges costs 1 credit(s) per call on Triport by default.
- Is eth_getFilterChanges available over WebSocket?
- eth_getFilterChanges is an HTTP JSON-RPC method.