Skip to main content
Monad API method that creates a filter in the node to notify when new pending transactions arrive. Use eth_getFilterChanges to poll for pending transaction hashes.
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 — the filter ID, used to poll for pending transactions with eth_getFilterChanges.

eth_newPendingTransactionFilter code examples

const { ethers } = require("ethers");

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

async function createPendingTxFilter() {
  const filterId = await provider.send("eth_newPendingTransactionFilter", []);
  console.log("Filter ID:", filterId);

  // Poll for pending transactions
  setInterval(async () => {
    const txHashes = await provider.send("eth_getFilterChanges", [filterId]);
    if (txHashes.length > 0) {
      console.log("Pending transactions:", txHashes);
    }
  }, 1000);
}

createPendingTxFilter();

Use case

A practical use case for eth_newPendingTransactionFilter is building mempool monitoring tools, MEV bots, or applications that need to track pending transactions before they are included in blocks.