Enabling Cross-Shard Communication At Harmony

Abhishek Purushotham
Harmony
Published in
3 min readMay 24, 2022

--

The original bitcoin blockchain was conceptualized as a peer-to-peer payment system that will enable users to send payments. However, As it gained momentum, it was clear that the limited number of transactions per second and high fees were a performance bottleneck. What followed was Ethereum, which enabled the creation of blockchain applications using smart contracts. However, Ethereum too, had difficulties when it came to scalability. As Multiple other projects proposed solutions, creating a blockchain that optimized its network for security, decentralization, and scalability was an endless problem. This is known as the blockchain trilemma.

This is why we created Harmony — a sharded PoS blockchain. Sharding is the ideal scalability solution that preserves both security and decentralization. In simpler terms, sharding is a method for distributing data across multiple machines. In a blockchain, sharding splits an entire network into smaller partitions, which are essentially known as shards. Harmony perfectly executes sharding, creating a highly scalable, extremely fast, and secure blockchain that confirms transactions with negligible fees.

Sharding At Harmony

At Harmony, we split the network into three dimensions: state, network, and transaction.

State Sharding: In Harmony, validators of each shard are required to store 1/N of the global state as they maintain their own chain of blocks and state database (N=number of shards). This eases the data availability concerns for validators. Moreover, cross-sharding further improves the state consistency between shards.

Network Sharding: The Harmony validator network is also divided into shards. Each shard contains a different set of validators closely connected with each other, running consensus among themselves. Usually, validators connect among themselves within the same shard, either to synchronize the blocks or reach a consensus. 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: Instead of going through all shards, transactions at Harmony are addressed to and processed by a single shard. This enables shards to process transactions simultaneously, improving the total transaction capacity of the blockchain. For transactions users can just specify the shard_id field in the signed transaction, indicating the shard the transaction belongs to.

Cross-Shard Communication

Even though sharding is a scalable solution that limits data availability, consensus, and execution to a particular shard, what happens when shards have to interact to share transactions? Efficient cross-shard communication can truly extend the shard’s utility beyond capacity. This is expected to increase the blockchain performance i.e. TPS (transactions per second) and reduce latency in data transfer.

Cross-shard communication can be divided into three types:

  • Mainchain Driven: In mainchain driver sharding, the network is completely dependent on the main chain to achieve transactions across shards.
  • Client Driven: This is where clients form the crux of the network and collect the messages between shards. Furthermore, they share the messages with the relevant shards.
  • Shard Driven: A direct approach where nodes in the shard directly receive and send messages without any external help.

Harmony and Cross-Sharding

With its shard-based approach, Harmony impeccably handles millions of transactions every day. But as we scale for millions of users and wallets, we have equipped ourselves to become one of the first sharded blockchains to accomplish cross-shard messaging. With an effective cross-shard messaging protocol and a fully-meshed design, shards will be able to undergo seamless communication with each other. With the team actively working towards the goal, users and developers can expect a cross-shard messaging protocol at Harmony later this year.

For builders and developers on Harmony, this is a major breakthrough as they can build by collating features and using data that reside on different shards. Alongside, inter-shard data consistency is vital. These two pursuits shall dictate the sustainability of this limitless scalability.

About Harmony

Build on Harmony, Bridge to All Chains.

Harmony is an open and fast blockchain. Our mainnet runs Ethereum applications with 2-second transaction finality and 100 times lower fees.

Harmony is your open platform for assets, collectibles, identity, governance. Our secure bridges offer cross-chain asset transfers with Ethereum, Binance and 3 other chains.

We ❤️ Developers.

Telegram | Twitter | Discord | Youtube | Medium | Facebook | LinkedIn |Reddit | Instagram

--

--