Making Blockchains Work Like Modern Databases

Traditional databases solved the scaling problem decades ago through sharding - splitting data across multiple servers. Quai brings this proven approach to blockchain, but with a crucial innovation: maintaining full security across all shards.

What is Sharding?

Database Sharding (Traditional): Imagine a library that gets too big for one building:
  • Solution: Split books across multiple buildings (shards)
  • Benefit: More librarians can help visitors simultaneously
  • Challenge: Need a system to know which building has which book
Blockchain Sharding: The same concept, but for decentralized networks:
  • Traditional approach: Split both data AND security (dangerous)
  • Quai’s approach: Split only data, keep security unified (safe)

How Quai Implements Sharding

Key Benefits:
  1. Parallel Processing
    • Each shard processes transactions independently
    • Like having multiple checkout lines instead of one
    • Result: 50,000+ TPS capacity
  2. Lower Node Requirements
    • Nodes can choose to track only specific shards
    • Reduces hardware requirements for participation
    • More accessible = more decentralized
  3. Geographic Optimization
    • Shards naturally organize by region
    • Minimizes latency within each shard
    • Better performance worldwide

Smart Address System

The Problem: How do you know which shard handles which transaction? Quai’s Solution: Addresses contain built-in routing information - like ZIP codes for blockchain. How It Works: Every Quai address has a 9-bit prefix that acts like a postal code:
  • First 4 bits: Region identifier (like country)
  • Next 4 bits: Zone within region (like city)
  • Last bit: Currency type (Quai or Qi)

Formatting

The table below specifies the format for each bit in the shard identifier.
bits 0-3bits 4-7bit 8
region numberzone numberledger identifier

Simple Examples

Example Address (shortened)LocationCurrency
0x000…Region 0, Zone 0Quai
0x2A4…Region 2, Zone 10Quai
0x008…Region 0, Zone 0Qi
Benefits:
  • Instant routing: Nodes immediately know where to send transactions
  • No lookups needed: Address itself contains all routing info
  • Efficient processing: Eliminates cross-shard confusion
For technical details, see QIP-2.

The Security Breakthrough

Traditional Sharding’s Fatal Flaw:
  • 10 shards = each gets 1/10th of security
  • Attackers can focus on the weakest shard
  • Like having 10 weak locks instead of one strong lock
Quai’s Innovation: Through coincident blocks and merged mining:
  • Every shard maintains 100% network security
  • Attacking one shard requires attacking the entire network
  • Like having the same unbreakable lock protecting every door
How It Works:
  1. Hierarchical structure organizes all shards
  2. Hash linked references connect every chain
  3. Atomic operations ensure all shards advance together
  4. Result: Unlimited shards, uncompromised security

Legacy Testnet Mappings

Early testnets use a lighter 9-shard hierarchy. It has already been concluded that the mainnet should accommodate more than 9 shards, so this mapping is no longer recommended. We make note of it here for wallet compatibility with early testnets. To find the address shard specification in detail please visit QIP-4.