How to Subscribe to Stream

Learn how to direct real-time access to transaction and block streams sourced from the BDN, bypassing RPC node-level execution and processing entirely.

Stream subscription provides you with direct access to blockchain data as it propagates through the BDN network. Unlike standard RPC subscriptions that must wait for node-level processing, streams deliver data directly from the high-speed distribution layer.

Why Use Streams

Streams bypass the node's internal processing pipeline:

Stream subscription pipeline

This architecture saves up to 10 milliseconds compared to node-based subscriptions—critical for latency-sensitive systems. With stream subscription, you enjoy:

  • Faster blocks — Receive new blocks before standard RPC propagation

  • Mempool access — See pending transactions before they're mined

  • Lower latency — Edge infrastructure minimizes network hops

Performance Characteristics

Metric
Value

Block latency

<50ms from validator

Message throughput

70,000+ msg/sec

Reconnect time

~3 seconds

Latency Comparison

Source
Typical Latency

Standard RPC

200-500ms

GetBlock MEV Streams

<50ms

Improvement

4-10x faster

Available Streams Methods

Stream
Description
Use Case

bdnBlocks

New blocks with headers and transactions

Block monitoring, analytics

newTxs

New transactions entering mempool

MEV detection, copy trading

pendingTxs

Pending transactions

Front-running protection

txReceipts

Transaction receipts after confirmation

Trade confirmation

Quickstart

Here you will be checking if you are connected to streams

Subscribing to Streams

1. Block Streams (bdnBlocks)

Subscribe to new blocks as they're produced.

Include Options

Field
Description

header

Block header (number, hash, timestamp, gasUsed, gasLimit)

transactions

Full transaction list

hash

Block hash only

Example: Subscribe to Blocks

2. Transaction Streams (newTxs / pendingTxs)

Subscribe to mempool transactions as they propagate through the network.

Include Options

Field
Description

tx_hash

Transaction hash

from

Sender address

to

Recipient address

value

Transaction value (hex)

gas_price

Gas price (hex)

input

Transaction calldata

Filters

Reduce bandwidth by filtering server-side:

Filter
Type
Description

to

array

Transaction recipient addresses

from

array

Transaction sender addresses

method_id

array

Function selectors (first 4 bytes of calldata)

Example: Monitor PancakeSwap Transactions

3. Transaction Receipts (txReceipts)

Subscribe to transaction confirmations.

Include Options

Field
Description

receipt

Full transaction receipt

logs

Event logs emitted

Example

Unsubscribing

To stop receiving notifications, unsubscribe using the subscription ID:

Best Practices

1. Request Only What You Need

  1. Use Server-Side Filters

  1. Handle Reconnection

  1. Process Messages Asynchronously

Rate Limits

Tier
Concurrent Subscriptions
Message Rate

Standard

5

1,000/sec

Pro

20

10,000/sec

Enterprise

Unlimited

Unlimited

Contact supportenvelope to upgrade your tier.

Troubleshooting

Problem
Solution

No messages received

  • Check subscription response—did you receive a subscription ID?

  • Verify filters aren't too restrictive

  • Confirm your API key is valid and active

High latency

  • Reduce the number of include fields

  • Add filters to reduce message volume

  • Check your network connection

Missed messages

  • Process messages asynchronously

  • Increase your message queue buffer

  • Consider multiple connections for different streams

Connection Drop

  • Implement automatic reconnection (see example above)

  • Re-subscribe after each reconnect—subscriptions don't persist

  • Check your network stability

Last updated

Was this helpful?