# How Blockcast Works

### Network Overview

{% @mermaid/diagram content="flowchart TD
subgraph "Content Origin"
F1\[Upstream CDN /<br>Content Origin]
end

```
subgraph "Blockcast Solution Layer"
    F1 --> F[Upstream CDN Integration]
    F --> G[Crowdsourced<br>Node Network]
    F --> H[CDN<br>Interconnection]
    F --> I[Open<br>Marketplace]
    F --> J[Automatic<br>Multicast]
end

subgraph "Blockcast Infrastructure"
    G --> K[Node<br>Registration]
    H --> M[Control Plane<br>Management]
    I --> N[Capacity Contracts<br>& SLA Verification]
    J --> L[Source<br>Authentication]
    K --> O[Solana<br>Blockchain]
    L --> O
    M --> O
    N --> O
end" %}
```

###

CDNs pool bandwidth from points of presence (PoPs) worldwide and contract out their ingress (bandwidth into an on-network ISP) and egress (bandwidth to other networks). While CDNs are distributed networks by definition, they have a single owner, so getting coverage of PoPs deeper in networks and closer to end user is challenging for the following reasons:

1. Capital costs of deploying many nodes
2. Lack of financial incentives to operate nodes for resources provided
3. Bottlenecks on ingress to fill caches where there is no fiber
4. Confidentiality of user data and node operation in untrusted environment

Blockcast enables existing and new CDNs to operate as pools, with a permissionless control plane. It incentivizes node operators to bring and deploy their own hardware and contribute their resources.

Additionally, Blockcast automatically converts unicast requests into multicast between nodes, enabling downstream PoPs to share the same ingress bandwidth resources carrying popular content. RELAY nodes work with CAST nodes to expand the coverage of multicast data services to ISPs that don't peer them.

This tree-structured delivery follows the **TreeDN** architecture ([RFC 9706](https://datatracker.ietf.org/doc/rfc9706/)), combining Source-Specific Multicast (SSM) with AMT tunneling overlays ([RFC 7450](https://datatracker.ietf.org/doc/rfc7450/)) and automatic relay discovery ([RFC 8777 DRIAD](https://datatracker.ietf.org/doc/rfc8777/)) to deliver content efficiently across both multicast-enabled and unicast-only networks. For the full technical architecture, see [TreeDN: Multicast Content Delivery](https://docs.blockcast.network/main/overview/control-plane/treedn-multicast).

This allows the services to be run over bandwidth-constrained networks, including satellite or cellular networks. With nodes that can be run anywhere, with the scalability of television broadcasts, everyone enjoys much better latency, faster download speeds, and lower data costs.

{% @mermaid/diagram content="    flowchart TD
%% Main nodes
O\[Content Origin] --> CDN

```
subgraph CDN[Upstream Commercial CDN]
    direction LR
    MC[MultiCDN Selector]
end

subgraph CAST[Cast Group]
    direction LR
    C[Request Router <br \> Topology Monitor]
    D[Mid-Tier Cache <br \> Multicast Sender]
end

subgraph RELAY[Relay Group]
    direction LR
    R[Edge-Tier Cache<br>Multicast Retransmit]
end

subgraph RECV[Receiver Group]
    direction LR
    RCV[Personal Cache<br>Multicast Receiver]
end

%% Connections with annotations
CDN --> |"Regional CDN Offload"| CAST
CAST --> |"Edge Distribution"| RELAY
RELAY --> |"Deep-Edge Distribution"| RECV

%% Simple characteristics
classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
classDef origin fill:#f4f4f4,stroke:#666
class O origin

%% Notes for each layer
note1[/"High Capacity<br>Global Distribution"/]
note2[/"Topology Management<br>Delivery Proofs"/]
note3[/"Subnet CIDR Unicast Distribution"/]
note4[/"Self-IP Unicast Distribution"/]

CDN --- note1
CAST --- note2
RELAY --- note3
RECV --- note4

classDef note fill:none,stroke:none
class note1,note2,note3,note4 note" %}
```

### Content Delivery Flow

{% @mermaid/diagram content="sequenceDiagram
participant CP as Content Provider
participant CDN as Upstream CDN
participant CN as Cast Node
participant RN as Relay Node
participant RC as Beacon Node
participant EU as End User

```
CP->>CDN: Submit configuration
CDN->>CN: Delegate coverage
CN->>RN: Monitor health
CN->>RC: Monitor health

EU->>CDN: Request content
alt If request IP matches receiver IP
    CDN->>CN: Request next host
    CN->>CDN: Delegate receiver
    CDN->>EU: Redirect receiver
    EU->>RC: Request data
    RC->>CN: Forward request (on MISS)
    note over CN,RC: === Multicast Transport ===
        alt If not joined multicast group
            RC->>RN: Subscribe to Stream
            CN->>RC: Unicast early media              
        end
        CN->>RN: Response via Multicast
        RN->>RC: Forward Multicast
        alt Multicast loss
          CN->>RC: Unicast Repairs
        end
    RC->>EU: Send response
else If without personal Beacon but in Relay coverage
    CDN->>CN: Request next host
    CN->>CDN: Delegate relay
    CDN->>EU: Redirect relay
    EU->>RN: Request data
    RN->>CN: Forward request and get data (on MISS)
    RN->>EU: Send response
else Not in Relay coverage area
    CDN->>EU: Traditional delivery
end" %}
```
