eth_newPendingTransactionFilter - Optimism

Example code for the eth_newPendingTransactionFilter json-rpc method. Сomplete guide on how to use eth_newPendingTransactionFilter json-rpc in GetBlock.io Web3 documentation.

This method creates a filter that can be polled to receive notifications about new pending transactions.

Parameters

  • None

Request Sample

cURL
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_newPendingTransactionFilter",
    "params": [],
    "id": "getblock.io"
}'

Response

A successful response returns the following:

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "0x2871b63cab64878d61f16974fbf11c7d"
}

Response Parameters

  • id: A unique request identifier, matching the id sent in the request body.

  • jsonrpc: Specifies the use of JSON-RPC version 2.0.

  • result: A filter ID that can be used with eth_getFilterChanges.

Use Case

The eth_newPendingTransactionFilter method is commonly used for:

  • Mempool monitoring

  • Transaction tracking

  • Pending transaction analysis

Error Handling

Error Code
Description

-32603

Internal error

-32601

Method not supported

Web3 Integration

Last updated

Was this helpful?