> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Hierarchical Structure

> Detailed specification of Quai Network's hierarchical structure.

## The Scaling Challenge

Traditional blockchains face an impossible choice: stay small and secure, or grow large and vulnerable. Quai's hierarchical structure breaks this limitation.

**The Innovation:**
Imagine a tree where every branch processes transactions independently, but the trunk ensures all branches stay secure. That's Quai's hierarchical structure - multiple blockchain "branches" working in parallel while sharing the security of the entire "tree."

## How It Works

**Three Levels of Organization:**

1. **Prime Chain** (The Trunk): Coordinates the entire network
2. **Region Chains** (Main Branches): Organize geographical areas
3. **Zone Chains** (Leaves): Process your actual transactions

**The Key Breakthrough:**

* **Traditional sharding**: Splits security (dangerous)
* **Quai's approach**: Splits only workload (safe)

Each zone processes transactions independently while maintaining the full security of the entire network through [merged mining](/learn/advanced-introduction/merged-mining/overview).

## Why This Matters

**For Users:**

* **50,000+ TPS**: Process more transactions than Visa
* **Sub-penny fees**: Sustainable even at massive scale
* **5-second blocks**: Near-instant transaction confirmation
* **Global scale**: Ready for billions of users

**For the Network:**

* **Unlimited growth**: Add new zones as demand increases
* **Maintained security**: Every zone has full network protection
* **Optimized performance**: Miners self-organize for best efficiency

## The Security Innovation

**Traditional Sharding Problem:**
When blockchains split into shards, each shard typically gets only a fraction of the security. A network with 10 shards might give each shard only 10% of total security - making them vulnerable to attacks.

**Quai's Solution:**
Through [merged mining](/learn/advanced-introduction/merged-mining/overview), every transaction in every zone receives 100% of the network's security. This maintains the full hash-based security guarantees while allowing unlimited parallel processing.

## Self-Optimizing Performance

**The Latency Problem:**
[Network latency](/learn/advanced-introduction/hierarchical-structure/latency) - the time it takes for data to travel between nodes - is the primary bottleneck in blockchain performance.

**Quai's Unique Solution:**
Miners naturally organize themselves for optimal performance because:

1. **Higher latency = Lower profits** (more uncle blocks)
2. **Miners choose their zone** based on best connection
3. **Result**: Geographic self-organization without central planning

**The Math Behind the Improvement:**

This relationship is described by t = p*n*log\_m(n) where:

* **t** = time to propagation
* **p** = ping time between nodes
* **n** = number of nodes in the network
* **m** = average number of connected peers

**Real-World Example:**

* **Bitcoin**: 8 hops × 100ms ping = 800ms total propagation time
* **Quai zones**: 3 hops × 10ms ping = 30ms total propagation time
* **Improvement**: 25x faster data propagation

This self-organizing system creates naturally optimized regional networks without any central coordination.

## Parallel Processing Power

Think of Quai as a [multi-core processor for blockchains](/learn/advanced-introduction/multithreaded-execution). Each zone chain operates like an independent CPU core, processing transactions in parallel while staying perfectly synchronized.

**How Chains Work Together:**

* **Independent operation**: Each zone produces blocks on its own schedule
* **Perfect coordination**: [Hash linked references](/learn/advanced-introduction/merged-mining/coincident-blocks) keep all chains in sync
* **Atomic operations**: Cross-chain transactions either complete fully or not at all

**The Three-Tier Architecture:**

| Chain Type | Level in Hierarchy | % of Network Hashrate | Block Time† |
| ---------- | ------------------ | --------------------- | ----------- |
| Prime      | 1 (top)            | 100%                  | \~20s       |
| Region     | 2 (middle)         | \~33%                 | \~10s       |
| Zone       | 3 (bottom)         | \~11%                 | \~5s        |

† *Block production in Quai Network is a stochastic process, meaning that real-world block times will have minor variance. These times are calculated for a 2×2 network configuration (2 regions, 2 zones per region, 4 total zones).*

### Starting Simple: Single Shard Launch

**Why Start with One?**
Quai Network launches with a single zone chain because adding unnecessary shards would:

* **Reduce aggregate security**: Splitting hashrate when not needed
* **Increase settlement times**: More complexity without benefit
* **Waste resources**: Running infrastructure for unused capacity

**Automatic Expansion Trigger:**
When sustained demand causes the uncle rate to exceed 20% for an extended period, the network automatically expands by adding new shards. This ensures optimal security and performance at every stage of growth.

### Prime Chain: The Global Coordinator

**Purpose**: Acts as the network's backbone, ensuring all regions stay synchronized (when multiple exist)

* **Security**: Mined by 100% of network hashrate for maximum security
* **Function**: Pure coordination - no transactions or accounts
* **Role**: Becomes active when network expands beyond single shard

### Region Chains: Geographic Organization

**Purpose**: Organize zones within geographical areas for optimal performance (activated during expansion)

* **Security**: Each region gets \~1/N of total hashrate (where N = number of regions)
* **Function**: Coordinate zone chains within their region
* **Activation**: Created when network demand triggers expansion

### Zone Chains: Where Transactions Happen

**Purpose**: The actual workhorses - processing all user transactions

* **Speed**: 5-second average block times for near-instant confirmations
* **Function**: The only chains that store accounts and process transactions
* **Initial state**: Network launches with one zone chain
* **Expansion**: Additional zones added based on demand

Each zone operates as an independent execution thread. As the network grows, this creates a truly [multithreaded blockchain environment](/learn/advanced-introduction/multithreaded-execution).

## Cross-Chain Communication

**The Innovation:**
Through [coincident blocks](/learn/advanced-introduction/merged-mining/coincident-blocks), Quai creates natural bridges between all chains in the network. These hash linked references enable trustless cross-chain transactions without any additional infrastructure.

**How It Works:**

* **Automatic creation**: Merged mining naturally produces these connections
* **Zero overhead**: No extra work required from miners
* **Trustless transfers**: Move assets between chains without intermediaries
* **Atomic operations**: Cross-chain transactions complete fully or not at all

This represents the first truly decentralized bridge between hash-based blockchains, enabling seamless interoperability across the entire network.
