One of the most significant challenges facing database developers is scaling. As data volumes and numbers of operations involved grow, system performance must also be improved.
Sharding is a database scaling technology based on splitting databases into separate segments, each of which can be housed on a different server.
If we apply this technology to the blockchain, sharding represents the division of the network into separate sectors. Each sector, or shard, contains a unique set of smart contracts and account balances, and specific network nodes are assigned to each shard.
These nodes are responsible for verifying transactions only in their assigned shard rather than for all transactions on the blockchain.
What problems does sharding solve?
The more popular a project becomes, the more users it attracts. These users conduct more transactions, launch more DApps, and run more processes on the network. As a result, transaction speeds fall, and commissions increase, impeding the project's future expansion and development. Dividing the network into shards allows you to solve the problem by increasing the processing capacity of the blockchain.
When a group of nodes is responsible for a particular segment of the ledger, all the nodes in the network are relieved of the requirement to maintain the entire blockchain for every transaction to be completed. Operations are validated in parallel rather than linearly, thereby increasing the network's throughput and eliminating the scaling issue.
Additionally, blockchain nodes that use sharding work more efficiently without increasing computing power due to the reduced load.
How it all works
Blockchains require the work of thousands of computers to function, and their computing power enables distributed ledgers to conduct transactions, execute smart contracts, deploy DApps, and more. If the network operates based on sequential execution, then each node must process every transaction. The verification of operations, therefore, takes a lot of time. Ethereum, for example, processes up to 10 transactions per second.
If nodes are added to the blockchain, its performance won't increase. All that will happen is the verification chain will become longer.
The principle of sharding lies in abandoning the linear execution model in favor of a parallel one, in which shards only carry out certain calculations and process many transactions simultaneously. They are a kind of "blockchain within a blockchain," transferring all their information to the main chain, albeit in a compressed format.
The downsides of sharding
There are two key problems in sharding: communication between shards and security.
- Communication. If you split the network into isolated sectors, each becomes a de facto separate blockchain. Users and decentralized applications in one shard will only be able to communicate with users and applications in another by using a specific communication protocol.
- Security. In a sharded network, it's much easier to take full control of one shard than an entire unsharded network, as the hash rate required is much lower. For example, a 51% attack on the Bitcoin network would require billions of dollars in hardware and hundreds of millions daily in electricity. It's expensive, unprofitable and unfeasible. Capturing a single shard, however, is far cheaper and easier.
Sharding isn't an exact fix. It comes with complexities and security concerns. Hackers could exploit a single shard within a segmented blockchain, as it requires less computing power to control individual sections. This could lead to malicious transactions disrupting the entire network.
Additionally, because different groups of nodes manage different blockchain segments, each shard essentially operates as a separate network. Special mechanisms are needed to allow smooth communication between these segments.
Improper implementation can result in issues like double-spending, which significantly impacts network security. Sharding is also challenging to implement on existing blockchain networks, as it involves network splits and the reassigning of data.
Ethereum offers a solution to this problem that uses random sampling. Shard protocols are randomly assigned to different sections to confirm block authentication. This was made possible by the network's switch to the proof-of-stake consensus method.
The networks already deploying sharding
The first network to introduce sharding was Zilliqa. It bills itself as a blockchain platform aiming to solve scalability issues with sharding. At the testnet stage, it achieved 2,828 transactions per second.
The NEAR blockchain ecosystem calls itself a sharded PoS blockchain and claims that its sharding technology supports nodes that are small enough to run on low-performance devices.
Ethereum also plans to implement sharding technology. Other sharded networks include Cardano, QuarkChai,n, and Plian.
Conclusion
In theory, sharding technology can finally solve the blockchain trilemma if it can resolve its flaws. If it does, it will become possible to scale blockchains without sacrificing decentralization or security.