Sharding

Harmony blockchain is sharded in three dimensions: state, network and transaction.

State Sharding

In Harmony, each shard maintains it's own chain of blocks and state database. Therefore, the validators of each shard only need to store 1/N of the global state, where N is the number of shards. The consistency between states from different shards are guaranteed by the property of eventual atomicity of cross-shard transactions, which guarantees that double spending between shards can not happen.

Network Sharding

Harmony's validator network is also divided into shards where each shard involves a separate set of validators connected closely with each other and running consensus between themselves. Most of the time, validators communicate with other validators within the same shard to reach consensus or synchronize blocks. In cases of cross-shard transactions and beacon chain synchronization, validators from different shards send messages across shards through the globally connected network.

Transaction Sharding

Transactions in Harmony blockchain are sent to and processed by a specific shard instead of all shards. This way, shards can process transactions in parallel which greatly improves the overall transaction processing capacity of the blockchain. Users need to specify a field named shard_id in the signed transaction which indicates which shard this transaction belongs to. For cross-shard transactions, another field named to_shard_idis needed to indicate the destination shard while the shard_id field indicates the source shard.