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
Transferevents 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
Swapevents from a long-running indexer process, letting the server track your read position.
Parameters
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | filter | object | Yes | Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]). |
Response
| Type | Description |
|---|---|
| string | Hex filter ID. Pass this to eth_getFilterChanges, eth_getFilterLogs, or eth_uninstallFilter. |
Example request
Try it live in the BNB Smart Chain playground.
Errors & troubleshooting
| Code | Message | Cause |
|---|---|---|
-32000 | filter not found | Provider rejected filter creation, or filter limit per connection was reached. |
-32602 | invalid argument | Malformed 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_getFilterChangesanswers withfilter 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_subscribelogs 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)[]).