eth_newBlockFilter method is useful for developers who must be notified of new blocks on the blockchain in real-time.
Get you 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
none
Response
result— a hexadecimal string representing the ID of the newly created filter.
- eth_getFilterChanges to retrieve updates
- eth_uninstallFilter to remove the filter
eth_newBlockFilter code examples
web3.eth.filterdeprecationNote 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
One use case foreth_newBlockFilter in a simple DApp is to listen for new blocks and update the user interface with the latest block information.
When the DApp starts, it creates a new filter using eth_newBlockFilter to listen for new blocks. When a new block is added to the blockchain, the filter is triggered, and the DApp retrieves the latest block information using a Web3 library.Body
application/json