# Mechanism

The BDN achieves performance gains through a combination of protocol-level optimizations and network-level design choices. Here’s how it works:

#### Compressed Blocks

Rather than forwarding full blocks, the BDN sends a compressed version by referencing transactions using short IDs (SIDs).

* Transactions are indexed and cached across the network.
* Gateways replace full transaction data with 4-byte SIDs when sending blocks.
* Receiving Gateways reconstruct the original block from cached data.

#### Cut-Through Routing

The BDN reduces propagation delay by forwarding block data as it arrives, rather than waiting for the full block to be received and validated.

* Enables real-time streaming of blocks between Relays and Gateways.
* Reduces per-hop delay compared to traditional peer-to-peer networks.

#### Optimized Topology

The BDN avoids the inefficiencies of random p2p connections by using a smart, latency-aware topology.

* Relays are strategically deployed in key regions.
* Gateways connect to Relays based on ping latency and server load.
* Redundant links ensure failover paths in case of disconnection or degradation.

#### Relay Selection Process

When a Gateway starts, it follows a discovery and selection process to optimize its Relay connections.

* Detects its public IP address (auto or user-defined).
* Contacts the Control Plane for a list of suggested Relays.
* Measures latency and selects the lowest-latency Transaction and Block Relay.
* Stores a backup Relay pair for redundancy.
