Skip to main content
Tempo API method that uninstalls a filter created by eth_newFilter, eth_newBlockFilter, or eth_newPendingTransactionFilter. Filters should be uninstalled when no longer needed to free server resources.

Parameters

  • filterId — the filter ID to uninstall

Response

  • resulttrue if the filter was successfully uninstalled, false otherwise

eth_uninstallFilter code examples

const ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);

const filterLifecycle = async () => {
    // Create a block filter
    const filterId = await provider.send("eth_newBlockFilter", []);
    console.log(`Created block filter: ${filterId}`);

    // Use the filter
    const blocks = await provider.send("eth_getFilterChanges", [filterId]);
    console.log(`Got ${blocks.length} new blocks`);

    // Uninstall when done
    const uninstalled = await provider.send("eth_uninstallFilter", [filterId]);
    console.log(`Filter uninstalled: ${uninstalled}`);

    // Trying to use it again will fail
    try {
      await provider.send("eth_getFilterChanges", [filterId]);
    } catch (e) {
      console.log("Filter no longer exists (expected)");
    }
  };

filterLifecycle();