BNB Smart Chain

BNB Smart Chain

eth_newFilter

Contract activity on BNB Smart Chain surfaces as event logs, and eth_newFilter is how you register interest in a specific slice of them. Chain ID 56 uses BNB as its gas token. Send the method to https://bsc.therpc.io/YOUR_API_KEY with an address and topic criteria, and it creates a server-side log filter that returns a hex filter ID. From then on you call eth_getFilterChanges with that ID to pull, incrementally, only the matching logs mined since your last poll. There is no need to restate the address-and-topics object on every request. The pattern pairs naturally with the chain's ~3-second PoSA block cadence for steady, low-overhead event ingestion.

Use cases

  • Poll for fresh BEP-20 Transfer events on a roughly per-block (~3-second) rhythm without re-specifying the full address-and-topics filter each time.
  • Watch a PancakeSwap pair contract for Swap events from a long-running indexer process, letting the server track your read position.

Parameters

#NameTypeRequiredDescription
1filterobjectYesFilter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]).

Response

TypeDescription
stringHex filter ID. Pass this to eth_getFilterChanges, eth_getFilterLogs, or eth_uninstallFilter.

Example request

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

Try it live in the BNB Smart Chain playground.

Errors & troubleshooting

CodeMessageCause
-32000filter not foundProvider rejected filter creation, or filter limit per connection was reached.
-32602invalid argumentMalformed filter object or invalid topic format.

Common pitfalls

  • After roughly five minutes of inactivity the node garbage-collects the filter, so wire up recreation logic for when eth_getFilterChanges answers with filter not found.
  • Filter state lives on the server tied to your connection and vanishes on reconnect; always assume you may need to re-register the filter from scratch.
  • For genuinely real-time delivery, an eth_subscribe logs subscription over WebSocket beats repeatedly polling this filter.

Supported networks

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

See also

Parameters

Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]).

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

Ready to call this in production?

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