eth_newFilter
JSON-RPC method creates a filter object to notify when logs match the specified criteria. This method returns a filter ID that can be used with eth_getFilterChanges
and eth_getFilterLogs
to retrieve matching logs. Filters are essential for monitoring specific events on the blockchain.
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
- filter_object (object) — The filter criteria object with the following properties:
fromBlock
(string, optional) — Block number (hexadecimal) or tag (“latest”, “earliest”, “pending”)toBlock
(string, optional) — Block number (hexadecimal) or tag (“latest”, “earliest”, “pending”)address
(string or array, optional) — Contract address or array of addresses to filtertopics
(array, optional) — Array of topic hashes to match (supports null wildcards)
Response
The method returns a filter ID as a hexadecimal string that can be used to retrieve filter results.Response structure
Filter ID:- Returns a unique filter identifier as a hexadecimal string
- Use this ID with
eth_getFilterChanges
to get new matching logs - Use this ID with
eth_getFilterLogs
to get all matching logs - Filters have a limited lifetime and may expire
Filter object options
Block range:fromBlock
andtoBlock
define the block range to monitor- Use “latest” to monitor from the current block
- Use specific block numbers in hexadecimal format
- Single address:
"0xB7C609cFfa0e47DB2467ea03fF3e598bf59361A5"
- Multiple addresses:
["0xAddr1", "0xAddr2"]
- Omit to match logs from any address
- Topics are indexed event parameters
- Array position corresponds to topic index (topic0, topic1, etc.)
- Use
null
as wildcard for any value at that position - Empty array
[]
matches all topics
Usage example
Basic implementation
Example request
Shell
Use cases
Theeth_newFilter
method is essential for applications that need to:
- Event monitoring: Monitor smart contract events in real-time
- DeFi applications: Track token transfers, swaps, and other DeFi operations
- NFT platforms: Monitor NFT minting, transfers, and marketplace activities
- Trading bots: React to specific blockchain events for automated trading
- Analytics platforms: Collect event data for analysis and reporting
- Notification systems: Create alerts based on specific blockchain events
- Audit tools: Monitor specific contracts for compliance and security
- DEX monitoring: Track decentralized exchange activities and liquidity events
- Governance tracking: Monitor DAO governance events and voting
- Bridge monitoring: Track cross-chain bridge events and transfers
- Staking applications: Monitor staking rewards and delegation events
- Oracle monitoring: Track oracle price updates and data feeds
- Gaming platforms: Monitor in-game transactions and asset transfers
- Supply chain tracking: Monitor supply chain events and product transfers
- Insurance platforms: Track insurance claims and policy events
Body
application/json