Lack of scalability is the worst nightmare of any distributed ledger. Many decentralized networks strive to introduce a single solution to a sensitive issue. Sharding is a promising concept that has the potential to finally resolve the scalability problem while saving the decentralized nature of blockchains.
Changelly keeps on providing explanations, tutorials, and guides about cryptocurrencies and blockchain technology. We are going to explain what sharding is and how it can help blockchain in the future.
Sharding is a data partitioning method that aims to unload the system while providing quick access to any stored data. Each separated yet connected with each other parts of database call shards. Every database shard is stored on a separate server.
The concept of sharding has been used since the late 1990s by giant databases around the globe. The term ‘shard’ had gained popularity thanks to the massively multiplayer online role-playing game (MMORPG), Ultima Online. The game was so popular, the developers had to partition the load on servers by introducing new worlds to the game’s universe. In their core, new worlds are separated servers that obtain distributed traffic.
Sharding in blockchain follows the same logic. Investopedia provides the following sharding definition:
“Sharding is a database partitioning technique that will be used to dramatically scale ethereum’s blockchain and enable it to process more transactions per second.”
The definition is quite accurate. However, the sharding technique is not the prerogative of the Ethereum network. It also had to be introduced in the notorious TON blockchain, but the project was ceased.
To sum it up, sharding in the blockchain is aimed to spread the load over the decentralized network by partitioning data through shards. Shards are horizontal portions of data.
How Does Sharding Work?
Let’s get back to the basics. A blockchain consists of nodes – independent entities that maintain the proper work of a decentralized network. Each node is a significant part of the ecosystem that shares its computational resources in order to add blocks to the blockchain.
Ethereum, for instance, has over 8,200 active nodes that sustain the healthy environment within the network. The Ethereum blockchain is currently based on the Proof-of-Work (PoW) consensus protocol that requires users to pay gas fees. The more users utilize the Ethereum blockchain, the higher will be gas fees. Ethereum and many other blockchains are currently following the linear execution model, which requires every node to process every operation.
With sharding, the execution of transactions within a particular blockchain will follow a parallel execution model. This means transactions will be processed simultaneously and in parallel on each shard, increasing the transaction throughput significantly. Nodes will process certain operations and not the whole bunch as they do in the linear model.
Sharding: PoW or PoS?
We’ve recently explained the possibility of the 51% attack on a decentralized network. The fact that a malicious miner or a mining pool can obtain 51% of the network’s hash and thereby control the blockchain is quite scary. Especially in terms of decentralization that promises transparency, trust, and fairness all the way through.
Imagine a blockchain built on the Proof-of-Work consensus mechanism that wants to implement sharding for better scalability. A PoW-based blockchain requires mining – mining requires a hash rate – hash rate is produced by miner’s computers. Each shard requires less computational resources (hashrate) to produce a block. Imagine a PoW-based blockchain that has 100 shards. In this situation, a bad actor that obtains a 1% hashing power of the whole network can achieve 100% control of the hash rate of a single shard.
The Proof-of-Stake protocol does not need miners. To initiate a 51% attack, a malicious user must obtain over 50% of the cryptocurrency. Each and every validator within a PoS-based blockchain has to stake a certain amount of crypto assets to be able to add blocks to a blockchain. To exclude the possibility of malicious performance in a PoS blockchain, it is proposed to use a random sampling scheme.
“ Each shard is assigned a certain number of notaries (e.g. 150), and the notaries that approve collations on each shard are taken from the sample for that shard. Samples can be reshuffled either semi-frequently (e.g. once every 12 hours) or maximally frequently (i.e. there is no real independent sampling process, notaries are randomly selected for each shard from a global pool every block),” claims the Ethereum Wiki.
How Sharding Can Help Blockchain
The dreams of mass adoption might become a reality with sharding implementation in blockchains. The truth is, decentralized technology is too complex for regular users. As time went by, ingenious blockchain developers managed to put complicated technological solutions into a user-friendly form. Decentralized applications (dApps) look native and quite simple, while the user experience is intuitive. However, one of the main obstacles on the way to mass adoption is the speed of transactions that take too much time.
The obvious example: Visa can process over 24,000 transactions per second (TPS), Bitcoin handles 5-7 TPS, Ethereum processes 15 transactions per second. Back to golden for cryptocurrencies year of 2017, legendary Ethereum dApp, CryptoKitties, could slow down the whole ETH network due to increased traffic in the game.
When implemented in a blockchain, the sharding technique is to spread the network load between shards. Therefore, the speed of transactions may increase drastically, bringing better throughput and, as a result, attracting new users.
A long-awaited Ethereum 2.0 is going to resolve the scalability issue by implementing a sharding solution into its network. Ethereum blockchain also plans to migrate to a PoS consensus protocol, making the sharding implementation possible and efficient.
Ethereum 2.0 will introduce 64 equal shards that are able to process transactions simultaneously and concurrently to other shards. All of 64 shards are closely tied to the main chain forming the Merkle Tree. By spreading the load between shards, Ethereum 2.0 will be capable of performing up to 100,000 transactions per second.
Are There Any Drawbacks of Sharding?
Vitalik Buterin often talks about the scalability trilemma. According to this great issue, the blockchain that will be scalable, secure, and decentralized at the same time is currently not possible. However, it seems that the issue can be addressed by sharding.
The greatest concerns regarding the sharding technique are security and communication problems. The latter is quite essential. How will the (N) number of shards seamlessly communicate with each other? To resolve the miscommunication between shards, Ethereum 2.0 will utilize the Beacon chain that aims to be a backbone for the entire Ethereum 2.0 network.
According to Eth 2.0 advisor and researcher, Ben Edgington:“There are a number of aspects to this: managing validators and their stakes; nominating the chosen block proposer for each shard at each step; organizing validators into committees to vote on the proposed blocks; applying the consensus rules; applying rewards and penalties to validators; and, being an anchor point on which the shards register their states to facilitate cross-shard transactions.”
The aforementioned 1% attack is a threat to sharding’s mass implementation. However, the proof-of-stake consensus mechanism can partially solve it. Randomly assigned Ethereum validators are going to support the decentralized nature of the blockchain while keeping it secure. Buterin also believes that Ethereum’s transition to the PoS algorithm will make ETH more secure than the Bitcoin’s network. It is just too expensive to compromise the blockchain, as an attacker should obtain over 50% of the network’s assets.
Sharding’s future is quite bright. A range of reliable and trustable projects have already implemented and utilized sharding. One of the first platforms to implement sharding was Zilliqa. During the testnet stage, the Zilliqa network could gain over 2,800 transactions per second.
The Cardano blockchain has recently released its scalability solution, Hydra protocol. Just like the mythological creature, each head of the Hydra protocol (meaning each shard) can handle around 1,000 tps. As a result, the Cardano blockchain can potentially reach the transaction throughput of one million (!) transactions per second.
Ethereum 2.0, Facebook’s Libra, notorious Telegram Open Network, and many other notable projects work hard to bring the future into today, and sharding is a vital part of the whole picture.
Sharding may become the long-awaited solution of a scalability problem. Once blockchains become scalable, they could attract more active users, developers, dApps, and so on. Consequently, the more native the decentralized networks become, the faster the mass adoption will burst into a blockchain industry. Most likely, we are lucky enough to witness the massive exodus to the world of decentralization.
Changelly is a non-custodial instant cryptocurrency exchange service that acts as an intermediary between crypto exchanges and users, giving the latter an opportunity to exchange over 160 cryptocurrencies at the best market rates. Changelly offers its API and a customizable payment widget to any crypto service that wishes to broaden its audience and implement new exchange options.