bloXroute Documentation
WebsiteBlogTwitterDiscord
  • Welcome to bloXroute
  • Introduction
    • Why Use bloXroute?
    • Products
    • Create An Account
    • Technical Support
  • SOLANA
    • Trader API
      • Introduction
        • Regions
        • Authorization
        • Rate Limits
        • Tip and Tipping Addresses
      • Quick Start
        • Transaction Submission
        • Front-Running Protection & Transaction Bundle
        • Go SDK
        • Python SDK
        • Typescript SDK
        • Rust SDK
      • API Endpoints
        • Core Endpoints
          • submit
          • submit-paladin
          • submit-batch
          • balance
          • rate-limit
          • transaction
          • priority-fee
          • GetPriorityFeeStream
          • GetBundleTipStream
          • submit-snipe
        • Pump.fun
          • quotes
          • swap
          • swap-sol
          • GetPumpFunNewTokensStream
          • GetPumpFunSwapsStream
          • GetPumpFunAMMSwapsStream
        • Raydium
          • quotes
          • pools
          • pool-reserves
          • swap
          • cpmm-swap
          • clmm-swap
          • route-swap
          • GetPoolReservesStream
          • GetSwapsStream
          • GetNewRaydiumPoolsStream
          • GetNewRaydiumPoolsByTransactionStream
        • Jupiter
          • quotes
          • swap
          • swap-instructions
          • route-swap
        • Openbook
          • markets
          • orderbooks/{market}
          • depth/{market}
          • tickers/{market}
          • open-orders/{market}
          • unsettled/{market}
          • place
          • replace
          • cancel
          • settle
          • GetOrderbooksStream
          • GetTickersStream
      • Best Performance for Landing Transactions
      • Support
        • API Health
        • Contact us
        • Suggestions
        • Wiki
          • Terms & Concepts
          • Resources
    • Optimized Feed Relay (OFR)
      • Transaction Streamer
      • Gateway and OFR Requirements
      • Gateway and OFR Setup
      • Gateway Startup Arguments
      • OFR performance
      • Logging
      • Submitting Transaction
      • Upgrading Gateway
      • Troubleshooting
  • BSC & ETH
    • EVM Blockchain Distribution Network (BDN)
      • How to Connect
      • The bloXroute Gateway
        • Local Gateway
          • Installation and Startup
            • Authentication & Certificates
            • Requirements
            • Supported Clients
            • GitHub repository option
            • Docker container option
            • Startup Script
            • Startup Arguments
          • General Connectivity Troubleshooting
          • Logging
          • Upgrading your Gateway
        • Add Your Gateway as a Trusted Peer to Your Execution Layer Client
        • Connecting Your Gateway with the Consensus Layer
      • IPs & Relays
        • Relays IPs
        • Private Relays
        • Cloud-API IPs
          • ⏩Reducing Latencies using the BDN
    • APIs
      • Authorization
      • Check Transaction Quota
      • Submit a Transaction
        • Raw Transaction Construction
        • Tx-Validation
        • Batch Transaction
      • Private Transactions
        • ETH Private Transactions
        • BSC Private Transactions
      • Transaction Bundles
        • Bundle Simulation
        • Bundle Validation
        • Bundle Submission
          • BSC Bundle Submission
            • List of BSC Validators
          • ETH Bundle Submission
          • Bundle Submission with Gateway
        • Bundle Tracking
          • BSC Bundle-Trace
          • ETH Bundle-Trace
          • ETH Bundle Inclusion Status
        • Bundle Refunds
          • Priority Fee Refund
          • Bundle Refund
          • Latest Bundle Refunds
      • Backrun Arbitrage
        • BackRunMe: Bundle Submission
          • BSC submit arbOnly
          • ETH submit arbOnly
            • blxr_info
            • ETH arbOnly Simulation
      • Token Launch Sniping
      • Other Utilities
        • List of bloXroute Builders
        • List of External Builders
        • Tx-Trace
        • Ping
    • Streams
      • Requirements
      • Subscription limits
      • Working With Streams
        • Creating a Subscription
          • Websocket
          • gRPC
        • Handling the Notification
          • Websocket
          • gRPC
        • Cancelling a Subscription
          • Websocket
          • gRPC
        • Local Node Validation
      • newTxs and pendingTxs
        • Filters
        • Raw TX Reconstruction
      • BackRunMe: arbOnlyMEV
        • ETH arbOnlyMEV
        • BSC arbOnlyMEV
      • transactionStatus
      • txReceipts
      • newBlocks
      • bdnBlocks
      • ethOnBlock
      • MEVBlockValue
      • MEVNextProposerInfo
    • Block Builders and Validators
      • Validator Gateway
      • MEV Relay (For Validators)
      • Block Submission
      • Proposer MEV-Protect
      • Compliance Lists
      • Preconfirmations
    • Protect RPCs
      • ETH Protect RPC
      • ETH Gas Protect RPC
      • BSC Protect RPC
      • SOL Protect RPC
  • Base Network
    • Submit Transactions
    • Streams
      • GetBdnBlockStream
  • TON NETWORK
    • TON Trader API
      • Quick Start
      • Fee Schedule
      • Connection
      • Submit Signed Transaction
  • Resources
    • BDN Explorer
    • Block Explorer
    • Guides
      • Algorithmic Trading
      • Setting Up a Local Gateway
      • Gateway as Web3 Bridge
    • Architecture
      • BDN Architecture
        • Network Components
        • Performance Techniques
          • Block Compression
          • Cut-through Routing
          • Optimized Topology
      • bloXroute Protocol
        • Versioning
        • Message Structure
        • Message Types
    • Contact Us
Powered by GitBook
On this page
  1. BSC & ETH
  2. Streams
  3. newTxs and pendingTxs

Filters

PreviousnewTxs and pendingTxsNextRaw TX Reconstruction

You can specify filters when subscribing to pendingTx and newTx streams to only receive certain transactions.‌ The filter string uses a SQL-like syntax for logical operations.

This filter dictionary is passed into the options argument of the subscribe() call:

ws.subscribe("newTxs", {"filters": "...", ...})

Available Filters

value : Restrict transactions based on their value, denominated in wei. Hex values are also valid.

from : Deprecated. Restrict transactions sender to the specified Ethereum addresses. Requires --tx-include-sender-in-feed argument. See local gateway

to: Restrict transactions recepient to the specified Ethereum addresses.

gas_price, max_fee_per_gas , max_priority_fee_per_gas and max_fee_per_blob_gas: Restrict transactions based on their gas price attributes, denominated in wei. Hex values are also valid.

method_id: Restrict transactions based on their method ID in the TX input.

chain_id: Restrict transactions based on their chain ID.

The SQL-like syntax also supports and and or : logical operations.

Examples

Filter transactions between 1-4 ETH

# "filters" Example
"({value} > 1000000000000000000) AND ({value} < 4000000000000000000)"
# wscat Subscribe Example
{"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": ["newTxs", {"include": ["tx_hash"], "filters": "({value} > 1000000000000000000) AND ({value} < 4000000000000000000)"}]}

Filter transactions with specific to account

# "filters" Example
"{to} == '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'"
# wscat Subscribe Example
{"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": ["newTxs", {"include": ["tx_hash"], "filters": "{to} == '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'"}]}

Filter transactions from two accounts

# "filters" Example
"({from} IN ['0x6671799F031059e017bBc9E9FCbE6721cc2Bd798',
 '0x09eDBC6ed492C6D4274810E257A690a11d71ce43'])"
# wscat Subscribe Example 
{"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": ["newTxs", {"include": ["tx_hash"], "filters": "({from} IN ['0x6671799F031059e017bBc9E9FCbE6721cc2Bd798', '0x09eDBC6ed492C6D4274810E257A690a11d71ce43'])"}]}
 

Filter transactions with specific gas price

# "filters" Example
"({gas_price} > 183000000000)"
# wscat Subscribe Example
{"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": ["newTxs", {"include": ["tx_hash"], "filters": "({gas_price} > 183000000000)"}]}

Filter transactions with specific method ID

# "filters" Example
"{method_id} == '0xa9059cbb'"
# wscat Subscribe Example
{"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": ["newTxs", {"include": ["tx_hash"], "filters": "{method_id} == '0xa9059cbb'"}]}

‌Furthermore, logical operations and and or may also be used to combine multiple filters. The above examples can be used together as shown in the examples below:

# "filters" Example
"{TO} == '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' AND
 ({value} > 4000000000000000000 AND {value} < 5000000000000000000) 
 OR ({from} IN ['0x8fdc5df186c58cdc2c22948beee12b1ae1406c6f',
  '0x77e2b72689fc954c16b37fbcf1b0b1d395a0e288'])"
# wscat Subscribe Example
{"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": ["newTxs", {"include": ["tx_hash"], "filters": "{TO} == '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' AND({value} > 4000000000000000000 AND {value} < 5000000000000000000) OR ({from} IN ['0x8fdc5df186c58cdc2c22948beee12b1ae1406c6f','0x77e2b72689fc954c16b37fbcf1b0b1d395a0e288'])"}]}
# "filters" Example
"{method_id} == '0xa9059cbb' AND
({from} IN ['0x8fdc5df186c58cdc2c22948beee12b1ae1406c6f',
        '0x77e2b72689fc954c16b37fbcf1b0b1d395a0e288']) AND
({gas_price} < 30000000000000000000)"
# wscat Subscribe Example
{"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": ["newTxs", {"include": ["tx_hash"], "filters": "{method_id} == '0xa9059cbb' AND({from} IN ['0x8fdc5df186c58cdc2c22948beee12b1ae1406c6f', '0x77e2b72689fc954c16b37fbcf1b0b1d395a0e288']) AND ({gas_price} < 30000000000000000000)"}]}
Startup Arguments.