Skip to main content
POST
eth_newFilter
BNB API method that generates a filter object based on the filter parameters. It returns a filter ID, which can be used to retrieve the filter results using the eth_getFilterChanges method. By creating a filter for specific events, developers can receive notifications when those events occur and use them to trigger actions in their applications.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • object — the filter parameters:
    • fromBlock — (optional, default: latest) integer that specifies the starting block number from which the logs should be fetched.
    • toBlock — (optional, default: latest) integer that specifies the ending block number until which the logs should be fetched.
    • address — (optional) the contract address from which the logs should be fetched. It can be a single address or an array of addresses.
    • topics — (optional) an array of DATA topics. The event topics for which the logs should be fetched. It can be a single topic or an array of topics.
    • blockhash — (optional) the hash of the specific block. Limits logs to a specific block with a 32-byte hash value. It takes precedence over fromBlock and toBlock.
Possible tags forfromBlockandtoBlock
  • latest — the most recent block in the blockchain and the current state of the blockchain at the most recent block.
  • safe — the latest justified block. Under BSC fast finality, a block becomes justified when more than two-thirds of the validators vote for it and its direct child carries their attestation in its header, so safe usually trails latest by a block or two.
  • finalized — the latest finalized block: a justified block whose direct child is also justified. Two conflicting blocks can both reach finality only if one-third or more of the validators violate the voting rules.
  • earliest — the earliest available or genesis block.
  • pending — the pending state and transactions block. The current state of transactions that have been broadcast to the network but have not yet been included in a block.
See the default block parameter and How The Merge Impacts Ethereum’s Application Layer.

Response

  • result — a hexadecimal string representing the ID of the newly created filter
The filters created are stored on the blockchain client instance. The filter is automatically deleted if not polled within a certain time (5 minutes by default).
Use the following methods with the filter ID:

eth_newFilter code examples

Note that the web3.eth.filter methods have been deprecated and replaced with the web3.eth.subscribe in web3.js. See web3.js subscriptions.

Use case

You can use eth_newFilter to create a filter for a specific action on a smart contract, for example, to monitor the transfer transactions from the Wrapped BNB token. The idea is to create a filter using the eth_newFilter method to monitor an ERC-20 smart contract, WBNB in this case.

Body

application/json
method
string
default:eth_newFilter
params
object[]
id
integer
default:1
jsonrpc
string
default:2.0

Response

200 - application/json

The filter ID.

jsonrpc
string
id
integer
result
string
Last modified on November 13, 2026