Shard hierarchy
Quai's approach to scaling is to divide the network into multiple chains (shards), each processing its own transactions in parallel to one another. Through the process of merge-mining, miners contribute their hash power to at least 3 chains at a time, greatly increasing the network security and reducing energy usage. New shards can be dynamically added, providing infinite scalability.
The network was released with a single Region and a single Zone. As it grows in usage, it can automatically increase the number of shards, easily multiplying its effective transaction throughput. In what is called a "Sharding event", the network can add new Zones or Regions reaching a maximum of 16 Regions with 16 Zones each. That's 256 parallel chains! (technical spec)
Example network that has gone through 4 Sharding events, growing to have 3 Regions of 3 Zones each. (source)
Each Region has a different name, the first one being "Cyprus". When creating a Quai wallet in Koala, you automatically get an address for each available zone, each with its individual balance. In the future when multiple zones are active, you will be able to filter balances and transactions per Region in the main Quai page, find the address for each one in its "Receive" page, as well as choose which shard to send from in the "Send" page.
Address assignment
The start of an address (ignoring the "0x" prefix) defines which Region and Zone it belongs to. The first hexadecimal digit defines the Region number (from 0 to F, representing a maximum of 16 Regions) and the second digit defines the Zone number inside that region (also from 0 to F, to a maximum of 16 Zones in a Region). As the network starts with a single Region and Zone, all addresses start with "0x00" to define they belong to the 1st Zone of the 1st Region. As the network grows, an address starting with "0xA8" for example means it belongs to the 11th Region, 9th Zone. (technical spec)
Cross-shard sending
When Quai grows to have multiple zones, it will be possible to send Quai between them, even though zones are isolated from one another. When sending to a different zone in the same region, the transaction will have to travel up to the Region shard, then back down to the new zone. When sending to a zone in a different region, the transaction travels up to the Prime shard, then back down the hierarchy. This makes such transactions take a bit longer to confirm, but atomicity is guaranteed. It's not possible to "lose" funds in the process.
Examples:
- Transaction in same zone: 0x02A2... → 0x02C5...
- Transaction in same region: 0x00CC... → 0x0191...
- Transaction between regions: 0x10F0... → 0x21CB...
Quai's network is EVM compatible. This means developers on Ethereum should feel right at home to build on Quai. Those used to transacting on Ethereum should also be familiar with the concept of smart contracts and gas fees.
All of this technology is conveniently abstracted away from everyday users. They do not need to know what shards they are interacting with or how to calculate gas fees. Koala Wallet handles all on the background so the entire experience is simple and seamless.