eth_newFilter | Base

Base API method eth_newFilter creates a new filter object for monitoring log entries that match specified criteria. This method is crucial for applications that need to track events or changes in smart contracts.

The example tracks all transfers of the USDC token.

Once you install the filter, track the changes with eth_getFilterChanges.

👍

Get you own node endpoint today

Start 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

  • filterObject — an object containing filter options:
    • fromBlock — (optional) the block number (in hexadecimal) or one of the strings "earliest", "latest", or "pending" from where to start filtering. Default is "latest".
    • address — (optional) an address or a list of addresses to only get logs from specific contracts.
    • topics — (optional) an array of topics to filter for log entries. Each event signature generated by the EVM logging mechanism has a unique topic.

Response

  • result — the ID of the created filter. This ID is used to identify and manage the filter with other filter methods like eth_getFilterChanges or eth_getFilterLogs.

Use case

The eth_newFilter method is essential for:

  • DApps that need to react to specific events emitted by smart contracts, such as token transfers or contract state changes.
  • Wallets and services that provide users with notifications based on contract interactions.
  • Developers and analysts monitoring specific contracts or topics for changes or patterns.

Try the eth_newFilter RPC method yourself

Language
Click Try It! to start a request and see the response here!