Links

Sharding

Sharding allows blockchains to increase throughput by splitting state and/or execution across many threads. Quai uses sharding to create the first multithreaded blockchain execution environment in which all threads share objective Proof-of-Work security.

What is Sharding?

The tradeoffs and benefits of sharding databases are well understood in information science. Sharding is a method of partitioning a database into smaller, more manageable pieces called shards. Each shard is a separate database which stores a subset of data on a separate server in a different location. Sharding allows large databases to service many requests beyond the limits imposed by read/write operations of data storage media. By distributing the data across multiple servers, sharding can help to reduce the load on any one server and improve the overall performance and availability of the database.

Sharding in Quai

Quai Network utilizes sharding to improve the performance of a decentralized database in largely the same way that sharding is used to improve centralized databases. In a single-threaded, unsharded blockchain, all nodes must maintain the state of the entire network, and all transactions must pass through the same single execution thread. Quai Network, as a multithreaded blockchain, allows for nodes to choose to only maintain shards of the Network rather than the entire state. Lower node resource requirements reduces the barrier to participation in the network. Further, each shard within Quai acts as a unique execution thread, which enables data partitioning, allowing the optimization of network performance though the introduction of shard-specific subnets.

Sharded Address Space

Quai Network utilizes a sharded address space to allow nodes and wallets to quickly identify which Quai blockchain an address resides on. The set of address prefixes currently occupies a byte prefix for each blockchain in the network. In the future, as the network grows, the amount of prefixes included in this list will increase.
Example Addresses:
  • Prime: 0x0087245518127A1e11fCDBD54b285BCb4173df8C
  • Cyprus: 0x115046125D6Ba88C1FBcbE7203Ef663e37F08870
  • Cyprus One: 0x1558F443A1bE597021fDa16C38c4AA126Fc569c3
Chain
Number Range
Bytecode Prefix
Chain ID
Prime
0-9
0x00 - 0x09
9000
Cyprus
10-19
0x0a - 0x13
9000
Cyprus 1
20-29
0x14 - 0x1d
9000
Cyprus 2
30-39
0x1e - 0x27
9000
Cyprus 3
40-49
0x28 - 0x31
9000
Paxos
50-59
0x32 - 0x3b
9000
Paxos 1
60-69
0x3c - 0x45
9000
Paxos 2
70-79
0x46 - 0x4f
9000
Paxos 3
80-89
0x50 - 0x59
9000
Hydra
90-99
0x5a - 0x63
9000
Hydra 1
100-109
0x64 - 0x6d
9000
Hydra 2
110-119
0x6e - 0x77
9000
Hydra 3
120-129
0x78 - 0x81
9000

Shared Network Security Between Shards

The major barrier to the adoption of sharding in distributed ledger technology has been the splitting of network security across shards. Quai Network utilizes a simple extension of Nakamoto consensus, referred to as Proof-of-Work 2.0, in order to maintain shared, full-network security within each shard. Proof-of-Work 2.0 functions by organizing shards into a hierarchical structure, with hash linked references between shards produced through merged mining. These hash linked references, produced in coincident blocks, enforce atomic chain progression and rollbacks across the entire network.