eth_getFilterChanges | Optimism

Optimism API method eth_getFilterChanges retrieves the changes of a filter since it was last accessed. This method is crucial for applications that need to monitor specific events or blocks on the Optimism blockchain.

🚧

Disclaimer

Note that the default interactive example in this page will not work as the filter will be expired.

To test eth_getFilterChanges in this page, first create a new filter using one of the following:

Then use the fresh filter ID as the parameter for 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

  • filterId — the ID of the filter whose changes are being queried. This ID is returned by filter creation methods such as eth_newBlockFilter, or eth_newFilter. For this example, a random value "0x4a2b3c" is used.

Response

  • result — an array of changes. For log filters, this will be an array of log entries. For block filters, it will be an array of block hashes. For pending transaction filters, it will be an array of transaction hashes. Each log entry object contains details such as the log index, transaction index, transaction hash, block hash, block number, address, data, and topics.

Use case

The eth_getFilterChanges method is essential for:

  • DApps that need to react to new events on the blockchain, such as token transfers or contract interactions.
  • Services that monitor the blockchain for security or compliance reasons, needing to track specific transactions or blocks.
  • Wallets and exchanges that require real-time information about transactions or blocks for processing or notification purposes.

Try the eth_getFilterChanges RPC method yourself

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