In Harmony Developing True Decentralized Scalable Blockchain
Harmony Introduction: The blockchain revolution is being compared to the Internet in the 1990s. Thousands of development hours have been invested in research with the aim of replacing our current economic system with one that is more secure and decentralized. Despite blockchain’s incredible potential, it is still plagued by the fundamental problem of scalability.
The most important issues affecting blockchain operation, includes Limitation, Block Size, Response Time, and Fees.
The first Bitcoin scalability problem involves limitations. When a new transaction is processed, every node adds information about it to the ledger. In this way, as payment history increases, it increases blockchain size making it impossible to run a node.
Another important bitcoin scalability problem is block size. Initially, the capacity of every block in the Bitcoin blockchain was 1 MB. Each of these blocks could contain around 2,020 transactions. However, the number of transactions has increased by many times in the network.
In terms of the number of transactions standing in the queue, they usually have to wait a long time for their validation. For instance, in the BTC network, it takes around 10 minutes to build a new block. The process of confirming transactions becomes complicated because mining demands higher computational power.
Today many new blockchain projects are attempting to increase transaction throughput. The new solutions like dPoS in EOS, TRON, Rootchain in Quarkchain cannot make significant performance gains without sacrificing other critical aspects, such as decentralization. Such a system is fast but cuts out ordinary users. Creating a semi-centralized system loses blockchain’s main value proposition: decentralization.
Sharding as a scalability solution preserves both security and decentralization giving network significant performance gain.
Harmony solves this challenge by introducing sharding at the state level in its blockchain. Sharding vastly improves scalability due to the fact that each node only has to carry a portion of blockchain data in order to complete a transaction.
What is sharding – Suppose there are three nodes A, B and C and they have to verify data T. Instead of A, B and C verifying the entire data T individually, the data will be broken into 3 shards: T1, T2, and T3. After that A, B and C will verify one shard each side-by-side. As you can see the amount of time you are saving is exponential.
A simpler way to put it would be imagining the division of the United States into states. While each state (a shard in this case) is part of the larger United States (Harmony network), they have their own specific rules, boundaries, and subsets of populations. However, they do share a universal language and culture as part of their larger network that makes up the country.
Using Ethereum as an example, a full node in the Ethereum network stores the entire state of the blockchain, including account balances, storage, and contract code. Unfortunately, as the network increases in size at an exponential pace, high gas costs and longer transaction confirmation times become noticeable problems.
The network is only as fast as the individual nodes rather than the sum of its parts.
Sharding helps to alleviate these issues by providing an interesting alternative. The concept involves grouping subsets of nodes into shards which in turn process transactions specific to that shard. It allows the system to process many transactions in parallel, thus significantly increasing throughput.
Zilliqa uses network sharding, a mechanism that allows the network to be divided into smaller groups of nodes each referred to as a shard. Simply put, imagine a network of 1,000 nodes, then, one may divide the network into 10 shards each composed of 100 nodes. If each shard is capable of processing 10 transactions per second, then all shards together can process 100 transactions per second.
In Zilliqa, each node has to hold the entire blockchain state to be able to process transactions, however, when the blockchain size grows, it may get difficult and expensive to maintain the full ledger, therefore increasing transaction cost.
Therefore state sharding (implemented by Harmony) where each shard holds a subset of the blockchain state is a much better option.
1% attack explained and how Harmony avoids it:
While the efficiency of sharding technology drastically reduces transaction completion times, the largest obstacle to real-world implementation of sharding has been its potential security concerns which is “1% of the hash-power to attack the network.”
In a blockchain utilizing PoW consensus mechanism, a “51% Attack” can be executed when an attacker has a majority of the total hash power of the network. This attack will allow a participant to double-spend, claim all rewards, censor transactions, etc.
However, having 51% (or more) of the hash power of the entire network would require a lot of electricity & hardware. Currently, the cost of a 51% attack on the Bitcoin network is $8 Billion US in hardware costs & $12.8 Million US Per Day in electricity costs.
Let’s consider a blockchain network that is split into a hundred pieces (Hundred shards), ​then each of the 100 shards will have 1% of the hash power. Therefore, in a sharded PoW system of 100 shards, an attacker can essentially concentrate their hash power on a single shard and take over control of that shard.
One way to prevent this attack is to prevent attackers from focussing their hash-power onto a single shard. Proof Of Stake allows Harmony to easily & effectively (by using random-sampling) take away the attacker’s ability to concentrate hash power on the shard of their choosing. Thus eliminating the 1% Attack vulnerability.
Harmony adopts a different approach with proof-of-stake (PoS) to select validators.
Current Sharding-based blockchains like Zilliqa or Quarkchain use PoW to prevent Sybil attacks, however as described earlier, they are vulnerable to 1% attack. Harmony adopts a different approach with proof-of-stake (PoS) to select validators.
In Harmony, to assign a group of consensus validators to a shard, nodes are randomly assigned to the shards through a secure algorithm called Verifiable Random Function and Verifiable Delay Function.
In order to become a Harmony validator, participants have to stake a certain amount of tokens to be eligible. The number of tokens staked will determine the number of voting shares assigned to the validator.
The validators remain assigned to the specific shard for a fixed period of time and then voting shares are re-computed to randomly assign validators to the shards. The process of reshuffle helps add additional security in preventing malicious attackers from overtaking a single shard over a period of time.
This whole mechanism e
– Attackers cannot choose the shard they want to work on.
– Attackers cannot know what shard they will work on ahead of time.
If reshuffled at a fixed interval, How long it takes for nodes to download new shard state
When validators join a new shard, they will need to quickly synchronize to the current state of the shard in order to validate new transactions.
Unlike the traditional procedure of downloading the blockchain history (it takes days to fully synchronize the Ethereum blockchain history), the new nodes download the historical block header of the shard chain and therefore, are ready within the time window of validators reassignment.
Cross-Shard communication in Harmony :
When transactions are divided across shards, it becomes essential that shards communicate with each other efficiently and effectively. For example, consider that the transaction is trying to book a train and hotel through a sharded protocol network wherein train transactions are processed on a separate shard and hotel transactions on another. What if the user ends up in a situation where the hotel is booked and not the train.
Harmony supports cross-shard transactions with shards directly communicating with each other and able to perform cross-shard operations synchronously.
When each new block is created, its block header is sent to the beacon chain using a mechanism called Kademlia routing. In such an arrangement, each node in the Harmony’s network maintains a routing table that contains nodes distances.
When a message from shard A needs to be sent to shard B, the nodes in shard A will look at the routing table and send the message to the nodes which are closest. This approach ensures a message travels faster and only across a few nodes before it reaches the destination shard.
Compared to normal gossip broadcasting as used in Hashgraph, Zilliqa, Kademlia routing mechanism reduces the overall network load significantly. For example, In a Kademila setup, a network with 10,000,000 nodes requires only about 20 hops at most for communication with any subset of nodes.
A comparison of Harmony with other sharding based blockchain projects
On the other hand, Harmony Protocol employs technical innovations that are already proven in research and implementation. [inlinetweet]Harmony full sharded blockchain design using PoS for validator registration ensures a more secure and decentralized structure.[/inlinetweet]