Skip to main content
POST
eth_newPendingTransactionFilter
Gnosis Chain API method that creates a filter that listens for new pending transactions on the blockchain. It returns a filter ID, which can be used to retrieve the results using the eth_getFilterChanges method. The eth_newBlockFilter method is useful for developers who must be notified of new blocks on the blockchain in real time.
Get your 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

Code examples

The filters created are stored on the blockchain client instance. The filter is automatically deleted if not polled within a certain time (5 minutes by default).
Use the following methods with the filter ID:

eth_newPendingTransactionFilter code examples

Note 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 way to use the eth_newPendingTransactionFilter method is to listen for new pending transactions at predefined intervals and extract specific data from them. For instance, a decentralized application might check for pending transactions every second and identify those that transfer a value greater than a certain amount of the ETH token. This could be useful for monitoring high-value transactions or detecting potential fraud or security threats in real time. Here is an implementation of this concept using ethers.js:
index.js
This code sets up an Gnosis Chain filter to listen for new pending transactions and extract specific data from them. The code consists of three functions: createFilter, getValue, and main. Here’s an overview of how each function works: The createFilter function sets up a new filter using the eth_newPendingTransactionFilter method. It returns the ID of the filter, which can be used to retrieve data from the filter later. The getValue function retrieves the list of new pending transactions using the eth_getFilterChanges method and loops through each transaction. For each transaction, it retrieves the transaction data using the eth_getTransactionByHash method and checks if the transaction value is greater than or equal to 100 ETH. If the value is above this threshold, the function logs information about the transaction to the console. The main function sets up the program by first calling the createFilter function to create a new filter and retrieve its ID. It then sets an interval to call the getValue function every 1 second, passing the filter ID as an argument to retrieve the latest transaction data at regular intervals.

Body

application/json
jsonrpc
string
default:2.0
method
string
default:eth_newPendingTransactionFilter
params
array
id
integer
default:1

Response

200 - application/json

The new filter ID.

jsonrpc
string
id
integer
result
string[]
Last modified on June 22, 2026