newTxs and pendingTxs

Name: newTxs , pendingTxs






Fields to include in the transaction stream. The subscription plan determines the list of available fields.

tx_hash,tx_contents[Default: all]


Whether or not to include transactions

already published in the feed.



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



You can specify filters in SQL-Like format to only receive certain transactions.

Users can customize the filters.


Blockchain network name. Use with Cloud-API when working with BSC

Mainnet [Default, Ethereum Mainnet], BSC-Mainnet , Polygon-Mainnet

The BDN supports subscribing to two transaction streams:

  1. newTxs is a stream of all new transactions as they are propagated in the BDN.

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

For expedience, all transactions received through the BDN are immediately published to the newTxs feed. By design, the Gateway/Cloud-API do not perform the same detail of transaction validation that the Ethereum nodes do, and cannot completely guarantee that all transactions propagated are valid (e.g. the Gateway/Cloud-API do not check for double spends). Therefore, these transactions have had basic validations done (e.g. checksums and other sanity checks) but may not be accepted into the TxPool.

The Gateway/Cloud-API can then leverage the Ethereum nodes for further validation of the transaction (e.g. check that it will be accepted into the TxPool), and publish results to the pendingTxs feed. Users planning to use pendingTxs with a Gateway feed should enable validation against their local Ethereum node.

It is expected that newTxs stream will perform faster than pendingTxs. The performance difference can be significant (10-100ms). Users interested in timely transaction information could find newTxs stream more appealing, while those who rely on strict correctness of the transactions data should utilize the pendingTxs stream.

The newTxs stream can send transactions that have been (a) previously confirmed hours or days prior, or (b) replaced by a higher priced transaction with the same nonce. 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 fields allowed in the include section, which is currently available via Websocket only, depends on the user's subscription plan:


Available Fields



Professional and above

tx_hash, tx_contents.chain_id, tx_contents.input, tx_contents.v, tx_contents.r, tx_contents.s, tx_contents.type,, 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

Deprecated: tx_contents.from : requires --tx-include-sender-in-feed if you are running Local Gateway. See Startup Arguments.

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.

The transaction feeds are available via both Websocket and gRPC.

Examples - Websocket

Requests (Cloud-API)


  • 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.

  • See Cloud-API IPs to work directly with IP ( wss://<IP>/ws)

  • Enterprise plan users can choose to work directly with wss://<region>.<network name> for ETH)

    for the best performance.

  • Non-Enterprise plan users should use wss://

## ETH Example
wscat -c wss:// --header "Authorization: <YOUR-AUTHORIZATION-HEADER>"
> {"id": 1, "method": "subscribe", "params": ["newTxs", {"include": ["tx_hash"]}]}
< ......

## BSC Example
wscat -c wss:// --header "Authorization: <YOUR-AUTHORIZATION-HEADER>"
> {"id": 1, "method": "subscribe", "params": ["newTxs", {"include": ["tx_hash"], "blockchain_network": "BSC-Mainnet"}]}
< ......

## Polygon Example
wscat -c wss:// --header "Authorization: <YOUR-AUTHORIZATION-HEADER>"
> {"id": 1, "method": "subscribe", "params": ["newTxs", {"include": ["tx_hash"], "blockchain_network": "Polygon-Mainnet"}]}
< ......

Requests (Gateway-API)


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

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

wscat -c ws:// --header "Authorization: <YOUR-AUTHORIZATION-HEADER>"
> {"id": 1, "method": "subscribe", "params": ["newTxs", {"include": ["tx_hash"]}]}
< ......

Response (Tx Event)

# Examples for Professional and Enterprise plan:
# Type 0 legacy transaction:
<<< {
 # Type 2 dynamic fee transaction:
 <<< {
					"yParity": "0x1",
					"blobVersionedHashes": [],
# Type 3 blob transaction
<<< {
	"method": "subscribe",
	"params": {
		"subscription": "a9daaa94-3712-49e4-8615-6e1fa03d1ed6",
		"result": {
			"txHash": "0xc9...c8b",
			"txContents": {
				"accessList": [],
				"blobVersionedHashes": [
				"chainId": "0x4268",
				"from": "0x96...d3e",
				"gas": "0x5208",
				"gasPrice": null,
				"hash": "0xc...c8b",
				"input": "0x",
				"maxFeePerBlobGas": "0xdf8475800",
				"maxFeePerGas": "0x8bb2c97000",
				"maxPriorityFeePerGas": "0x165a0bc00",
				"nonce": "0x3969",
				"r": "0xcbd8c81ebe0cfb85ee5d...e277281ec2c1317ae4",
				"s": "0xb1f33cac1924...9d94224aa3615a3",
				"to": "0x184a8b4...6fa73ce7",
				"type": "0x3",
				"v": "0x1",
				"value": "0x0",
				"yParity": "0x1"
			"localRegion": true,
			"time": "2024-03-05 13:00:44.137835"
	"jsonrpc": "2.0"

Examples - gRPC

Subscribing to Gateway Stream in Go using gRPC (ex: PendingTxs stream):

package main

import (

	pb ""

type blxrCredentials struct {
	authorization string

func (bc blxrCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
	return map[string]string{
		"authorization": bc.authorization,
	}, nil

func (bc blxrCredentials) RequireTransportSecurity() bool {
	return false

func main() {
	// gRPC server default values
	gatewayHostIP := "localhost"
	gatewayGRPCPort := 5001

	// Open gRPC connection to Gateway.
	conn, _ := grpc.Dial(
		fmt.Sprintf("%v:%v", gatewayHostIP, gatewayGRPCPort),
		grpc.WithPerRPCCredentials(blxrCredentials{authorization: "<YOUR-AUTHORIZATION-HEADER>"}),

	// Use the Gateway client connection interface.
	client := pb.NewGatewayClient(conn)

	// create context and defer cancel of context
	callContext, cancel := context.WithTimeout(context.Background(), 24*time.Hour)
	defer cancel()

	// Create a subscription using the stream-specific method and request.
	stream, _ := client.PendingTxs(callContext, &pb.TxsRequest{Filters: ""})

	for {
		subscriptionNotification, err := stream.Recv()
		if err == nil {
			fmt.Println(subscriptionNotification) // or process it generally

Response (Tx Event)

    "tx": [
            "from": "rmuf7AnbsJ...fUPVcONV9uc=",
            "local_region": true,
            "time": "1709652345242830000",
            "raw_tx": "AviPgkJogwkGG4Q7msoAhDuayvyCVAiU/.....TUNrTkSgO+tvr58mEdB+vViw+rXeY9NL9QEdf/O7Ndw9gOyf0Mc="

Last updated