BNB Smart Chain

BNB Smart Chain

eth_getFilterChanges

BNB Smart Chain settles BNB-denominated transactions into blocks roughly every three seconds, so a stateless application needs an efficient way to ask "what is new?" eth_getFilterChanges does exactly that: hand it a filter ID and it returns only the events that arrived since your previous call, advancing an internal cursor each time. The payload type follows the filter — log objects for a log filter, block-hash strings for a block filter, or transaction-hash strings for a pending filter. Direct the poll at https://bsc.therpc.io/YOUR_API_KEY on chain ID 56 to keep an indexer current without re-sending the filter criteria.

Use cases

  • Pull fresh BEP-20 or PancakeSwap log events on a short interval while the heavy filter definition stays server-side.
  • Run a block-tick loop on chain 56: register an eth_newBlockFilter once, then call this method on repeat to learn of each newly sealed block.

Parameters

#NameTypeRequiredDescription
1filterIdstringYesThe filter ID to poll.

Response

TypeDescription
arrayFor log filters: array of log objects. For block filters: array of block hash strings. For pending-tx filters: array of transaction hash strings. Empty array if no new events.

Example request

curl https://bsc.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getFilterChanges",
"params": ["0x1"],
"id": 1
}'

Try it live in the BNB Smart Chain playground.

Errors & troubleshooting

CodeMessageCause
-32000filter not foundFilter ID is invalid, expired (>5 min inactivity), or was already uninstalled.

Common pitfalls

  • A node forgets an idle filter after about five minutes, so catch the filter-not-found error and transparently rebuild the filter before resuming the loop.
  • When the filter emits logs, read the removed flag on each one to catch entries rolled back by a BSC reorg and undo them downstream.
  • There is a balance to strike: calling too often wastes compute units on empty arrays, while waiting too long lets the filter expire out from under you.

Supported networks

  • Mainnet — Chain ID: 56
  • Testnet — Chain ID: 97

See also

Parameters

Hex filter ID from eth_newFilter, eth_newBlockFilter, or eth_newPendingTransactionFilter

curl https://bsc.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getFilterChanges","params":["0x1"]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.