Sharding in blockchain
Low bandwidth expenses and slow transactions were major problems with early-generation blockchains like Bitcoin and Ethereum. Developers offered various options to fix scalability issues, including sharding technology.
What is sharding?
In simple terms, sharding is a mechanism that divides the blockchain into smaller segments or shards that can operate and process transactions in parallel. Sharding is one way to scale blockchain networks horizontally and is already used in Ethereum, Toncoin and Zilliqa.
The concept of sharding has been around since the 1990s when databases had already become quite large. The term "shard" became famous thanks to the massively multiplayer online role-playing game Ultima Online, released by Origin Systems in September 1997. The game became so popular that it couldn't handle the server load, and the developers had to distribute it to several servers.
How does sharding work?
To understand how sharding works, let's know how decentralized networks work. A blockchain consists of nodes or nodes that use their computing resources to process transactions and mine new blocks. Bitcoin has over 10,000 miners, and Ethereum has over 3,300 validators.
Miners and validators not only keep the network up and running but also keep it secure. The mechanics of paying fees in blockchain networks are based on competition: the more users make transactions, the more they pay fees so that their transactions are added to the block as quickly as possible.
Each block holds only a limited number of transactions. For example, each Bitcoin block holds an average of 3,000 to 5,000 transactions. Transactions that didn't make it into the block remain in the mempool, a list of transactions waiting to be confirmed. All transactions are processed one by one, depending on the fees the user has paid.
Sharding is designed to eliminate or at least minimize the wait for transaction confirmation. Each sharding-based network is a multitude of sub-networks. If some transactions do not make it to the block and remain in the mempool, they are redirected to another shard that will process them parallel to the current one.
Features and drawbacks of sharding
Sharding is one of the best and most popular solutions to blockchain network scalability problems. Still, the technique only applies to Proof-of-Stake (PoS) consensus-based networks.
Decentralized Proof-of-Work or PoW-based networks such as Bitcoin, Litecoin and Dogecoin are unsuitable for implementing sharding. The mechanism of cryptocurrency mining in PoW networks is based on hashreit — the processing power of the mining equipment. For an attacker to gain control of the Bitcoin blockchain, they would need more than half of the network's total hash rate — this hypothetical scenario is called a "51% attack".
Imagine that the Bitcoin network consists of 1,000 shards. In such a case, a miner will have complete control over a shard, provided that the processing power of his equipment is at least 0.051% of the network's hash rate.
In PoS networks, the "51% Attack" is unrealisable because validators block their digital assets to mine cryptocurrency. Thus, for example, to gain control of the Ethereum network, an attacker would need to seize more than 50% of all ETH coins circulating on the market, making such attacks unprofitable.
While sharding helps solve the scaling issues of decentralized networks, the technology poses several challenges for developers that they must overcome to defend against attacks.
Sharding is considered by some, including Ethereum co-founder Vitalik Buterin, to be one solution to a common blockchain trilemma, according to which it is extremely difficult to achieve security, decentralization and scalability without sacrificing one of these.
The security of sharding-based networks depends on the stability of communication between shards and the rules for selecting validators for each shard. Interoperability between shards poses a significant challenge, as each shard is essentially an independent blockchain.
As Hyperledger security specialist David Huseby pointed out, developers must ensure that shards are not hijacked. If the validator node responsible for a particular shard becomes corrupted or intentionally performs malicious actions, it could result in the loss of some data.
This problem is solved by randomly assigning validators to each shard so that an attacker cannot know in advance which one will be allocated to him for management.
Conclusion
Sharding is one of the newest and most effective solutions to the scalability problems of old-generation blockchain networks. However, the technology is relatively new to the blockchain industry, so it is too early to say that this approach is entirely safe for decentralized networks.
Developers must prevent any vulnerabilities attackers can exploit to bypass the security and consensus mechanism.