pendingTxs

pendingTxs is a stream of all new transactions as they enter the BSC transaction pool.

After basic network validation, making them more likely to be mined. This comes with slightly higher latency (milliseconds) but provides cleaner, more reliable data.

For monitoring or analytics, pendingTxs gives cleaner data.

Service available via Gateway-API and Cloud-API.

Stream Endpoint

  • Method: pendingTxs

  • Cloud API Endpoint: wss://<region>.eth.blxrbdn.com/ws

  • Gateway-API Endpoint: ws://127.0.0.1:28333/ws

  • Request type: gRPC,WSS

Parameters

Key

Description

include

[Default: all] - See below for the list of available fields Fields to include in the transaction stream.

blockchain_network

Use BSC-Mainnet

duplicates

Boolean. Default: False. Whether or not to include transactions already published in the feed.

include_from_blockchain

Boolean.Default: True. Whether or not to include transactions received first from the connected blockchain node. (Mainly used for testing)

filters

See Filters page for more details. You can specify filters in SQL-Like format to only receive certain transactions.

The Gateway or Cloud API can leverage connected blockchain nodes for additional transaction validation (for example, verifying that the transaction will be accepted into the TxPool) before publishing it to the pendingTxs feed. Users who plan to use pendingTxs with a Gateway should enable validation against their local node for optimal accuracy and performance.

Below is the full list of fields available in the include parameter.

Available Fields

tx_hash, tx_contents.chain_id, tx_contents.input, tx_contents.v, tx_contents.r, tx_contents.s, tx_contents.type, tx_contents.to, tx_contents.value, tx_contents.nonce, tx_contents.gas, tx_contents.gas_price , tx_contents.max_priority_fee_per_gas,tx_contents.max_fee_per_gas, tx_contents.max_fee_per_blob_gas, tx_contents.blob_versioned_hashes,tx_contents.yParity, local_region ,raw_tx

Examples - Websocket

Requests (Cloud-API)

Notes:

  • Follow the examples below based on your subscription plan. We suggest you to use "try...catch" to better handle exceptions caused by potential disconnections. The examples below contain the minimum code required for all transactions stream subscriptions.

Requests (Gateway-API)

Notes:

  • We assume that the Gateway IP is 127.0.0.1 with default ws port 28333 in the examples below. By default, the WebSocket endpoint is ws://127.0.0.1:28333/ws for the Gateway.

  • For the Gateway, the authentication header is always required for ws connection.

Response (Tx Event)

Last updated