Docs
Docs
Home
Getting Started
Agent Tooling
CLI
Supported Chains
Acala
Aptos
Arbitrum
Arc
Asset Hub
Astar
Avalanche
Base
Berachain
Bifrost
Binance Smart Chain
Bittensor
Blast
Boba Network
Bridge Hub
Celo
Centrifuge
Chiliz
Cronos
Enjin
Ethereum
Etherlink
Flow EVM Gateway
Gnosis
Hydration
Hyperliquid
Immutable
Ink
IoTeX
Kusama
Linea
LISK
Manta Atlantic
Manta Pacific
Mantle
MegaETH
Monad
Movement
Neuroweb
opBNB
Optimism
Plasma
Polkadot
Polygon
Pulsechain
Robinhood
Ronin
Scroll
Sonic
Starknet
Taiko
Tempo
Sui
TRON
Unichain
Viction
World Chain
XDC Network
XX Network
Zetachain
zkSync Era
Zora
Supported ChainsPlasmaJSON-RPC APISmart Contract Methods

eth_newPendingTransactionFilter - Plasma RPC Method

Create a filter for pending transaction notifications on Plasma. Essential for mempool monitoring, transaction tracking, and MEV opportunity detection for stablecoin transfers, payment apps, and wallets that need 1 second confirmation.

Plasma RPC endpoint: endpoint URLs, plans and pricing.

Creates a filter on Plasma that notifies when new pending transactions are added to the mempool. Once created, poll the filter with eth_getFilterChanges to receive an array of transaction hashes for pending transactions that have appeared since your last poll.

Why Plasma? Build on an EVM Layer 1 for stablecoin payments with PlasmaBFT consensus and Reth execution with 1 second blocks, XPL gas, full EVM JSON-RPC, and debug plus txpool on Dwellir.

When to Use This Method

eth_newPendingTransactionFilter is essential for payment app developers, wallet teams, and teams shipping Solidity contracts for dollar transfers:

  • Mempool Monitoring - Observe unconfirmed transactions on Plasma to understand network activity and congestion
  • Transaction Tracking - Detect when a specific transaction enters the mempool before it is mined
  • MEV Opportunity Detection - Identify arbitrage, liquidation, or sandwich opportunities by watching pending transactions
  • Gas Price Estimation - Analyze pending transactions to estimate optimal gas pricing for stablecoin transfers, payment apps, and wallets that need 1 second confirmation

Best Practices

  • High data volume from mempool monitoring requires efficient handling; filter and process selectively
  • Use WebSocket eth_subscribe("newPendingTransactions") for production-grade pending transaction monitoring
  • Pending filter results may include transactions that are never mined; do not treat them as confirmed
JSON-RPC request
{
  "jsonrpc": "2.0",
  "method": "eth_newPendingTransactionFilter",
  "params": [],
  "id": 1
}

Code Examples

Bash
# Create the pending transaction filter
FILTER_ID=$(curl -s -X POST https://api-plasma-mainnet.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_newPendingTransactionFilter",
    "params": [],
    "id": 1
  }' | jq -r '.result')

echo "Filter ID: $FILTER_ID"

# Poll for pending transactions
curl -X POST https://api-plasma-mainnet.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d "{
    \"jsonrpc\": \"2.0\",
    \"method\": \"eth_getFilterChanges\",
    \"params\": [\"$FILTER_ID\"],
    \"id\": 2
  }"

Common Use Cases

1. Mempool Activity Dashboard

Monitor mempool throughput and transaction types on Plasma:

JavaScript
async function mempoolDashboard(provider) {
  const filterId = await provider.send('eth_newPendingTransactionFilter', []);

  const stats = {
    totalSeen: 0,
    contractCalls: 0,
    transfers: 0,
    intervalStart: Date.now()
  };

  setInterval(async () => {
    const txHashes = await provider.send('eth_getFilterChanges', [filterId]);
    stats.totalSeen += txHashes.length;

    for (const hash of txHashes) {
      try {
        const tx = await provider.getTransaction(hash);
        if (!tx) continue;

        if (tx.data && tx.data !== '0x') {
          stats.contractCalls++;
        } else {
          stats.transfers++;
        }
      } catch (e) {
        // Transaction may have been mined or dropped
      }
    }

    const elapsed = (Date.now() - stats.intervalStart) / 1000;
    const txPerSec = (stats.totalSeen / elapsed).toFixed(1);
    console.log(`Mempool: ${stats.totalSeen} txs (${txPerSec}/s) | Calls: ${stats.contractCalls} | Transfers: ${stats.transfers}`);
  }, 2000);
}

2. Track Specific Address Activity

Watch for pending transactions involving a target address:

JavaScript
async function watchAddress(provider, targetAddress) {
  const filterId = await provider.send('eth_newPendingTransactionFilter', []);
  const target = targetAddress.toLowerCase();

  console.log(`Watching pending transactions for ${targetAddress}...`);

  setInterval(async () => {
    const txHashes = await provider.send('eth_getFilterChanges', [filterId]);

    for (const hash of txHashes) {
      try {
        const tx = await provider.getTransaction(hash);
        if (!tx) continue;

        const isFrom = tx.from?.toLowerCase() === target;
        const isTo = tx.to?.toLowerCase() === target;

        if (isFrom || isTo) {
          console.log(`Pending tx detected for ${targetAddress}:`);
          console.log(`  Hash: ${hash}`);
          console.log(`  Direction: ${isFrom ? 'OUTGOING' : 'INCOMING'}`);
          console.log(`  Value: ${tx.value} wei`);
          console.log(`  Gas price: ${tx.gasPrice} wei`);
        }
      } catch (e) {
        // Transaction already mined or dropped
      }
    }
  }, 1000);
}

3. Large Transaction Alert System

Detect high-value pending transactions:

JavaScript
async function largeTransactionAlerts(provider, thresholdEth = 10) {
  const filterId = await provider.send('eth_newPendingTransactionFilter', []);
  const thresholdWei = BigInt(thresholdEth * 1e18);

  setInterval(async () => {
    const txHashes = await provider.send('eth_getFilterChanges', [filterId]);

    for (const hash of txHashes) {
      try {
        const tx = await provider.getTransaction(hash);
        if (!tx || !tx.value) continue;

        if (BigInt(tx.value) >= thresholdWei) {
          const ethValue = Number(BigInt(tx.value)) / 1e18;
          console.log(`LARGE TX: ${ethValue.toFixed(4)} ETH`);
          console.log(`  From: ${tx.from}`);
          console.log(`  To: ${tx.to}`);
          console.log(`  Hash: ${hash}`);
        }
      } catch (e) {
        // Transaction may have already been mined
      }
    }
  }, 1000);
}

Error Handling

Common errors and solutions:

Error CodeDescriptionSolution
-32603Internal errorNode may not expose mempool data - check node configuration
-32000Filter not foundFilter expired (~5 min inactivity) - recreate with eth_newPendingTransactionFilter
-32005Rate limit exceededReduce polling frequency - mempool can be very active
-32601Method not foundNode does not support pending transaction filters - requires a full node with txpool enabled
JavaScript
async function createPendingTxFilter(provider) {
  try {
    const filterId = await provider.send('eth_newPendingTransactionFilter', []);
    return { supported: true, filterId };
  } catch (error) {
    if (error.code === -32601 || error.message.includes('not found')) {
      console.warn('Pending transaction filter not supported by this node');
      console.warn('This method requires a full node with txpool access');
      return { supported: false };
    }
    throw error;
  }
}

Related Methods

  • eth_getFilterChanges - Poll this filter for new pending transaction hashes
  • eth_uninstallFilter - Remove the filter when no longer needed
  • eth_getTransactionByHash - Fetch full transaction details for hashes returned by the filter
  • eth_sendRawTransaction - Submit a transaction that will appear in the pending pool

eth_newBlockFilter

Create a filter for new block notifications on Plasma. Essential for block monitoring, chain progression tracking, and reorg detection for stablecoin transfers, payment apps, and wallets that need 1 second confirmation.

debug_traceBlock

Trace all transactions in a block on Plasma using a serialized block payload. Essential for block-level debugging, gas profiling, and MEV analysis.

On this page

When to Use This MethodBest PracticesCode ExamplesCommon Use Cases1. Mempool Activity Dashboard2. Track Specific Address Activity3. Large Transaction Alert SystemError HandlingRelated Methods