newTxs

newTxs is a stream of transactions as soon as they are broadcast to the BDN, before any validation occurs. This offers the lowest possible latency and earliest visibility, but the data may include invalid or dropped transactions.

It is recommended that users with latency sensitive applications track the latest nonce for each account and use it to filter out stale messages.

The transaction feed will publish the data for each transaction in a separate message. Users that are only interested in a subset of transactions can utilize the feed's filtering options.

Service available via Gateway-API and Cloud-API.

Stream Endpoint

  • Method: newTxs

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

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

  • Request type: gRPC,WSS

Parameters

include

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

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.

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:

  • 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