Blockchain technology is gaining popularity day by day which in turn attracting more users towards the platform. Rapid adoption leads to an increase in the number of transactions regularly. And here the problem of scalability arises.
Can the technology scale enough to support a large volume of transactions?
How fast the transactions can be processed?
Can it be taken as an alternative to the traditional transactions system?
All these and many more questions will arise in every user’s mind before they can convince themselves to adopt the technology as a part of their regular transaction system.
In my previous article, I have covered one of the scaling solutions of the First layer i.e Hard fork. In continuation of that series, I am writing an article on another First layer scaling solution i.e Sharding.
What is Sharding?
The concept of sharding was taken from a traditional database system where a large database is partitioned into smaller parts so that it can be managed properly and support faster query runtime.
This process involves dividing the transaction processing among smaller groups of nodes, called shards. Each shard represents a unique small subset of the entire system which works in parallel to maximize the performance and allows the system to support large applications.
Thus this method helps in reducing the transactional load as one node is only responsible for maintaining and processing transactions related to its partition.
Why the idea of sharding come into the picture?
We all are aware that Blockchain technology is quite new and is still under development. Many developers, researchers, and pioneers from this field are working hard to add more and more features so that in near future it can be used as a replacement of traditional transactions system.
But if we consider the current scenario, Bitcoin currently processes only 7 transactions per second. Then comes Ethereum with supporting some more features like building smart contracts, withdrawal limits, financial contracts, gambling markets, etc but it also doesn’t process more than 12-30 transactions per second which are quite low if we compare it with traditional transactions processing system like Visa(Approx 2000 transaction per second) and Mastercard.
Thus, to enhance the transactions speed the developers thought to implement one of the scaling methods i.e Sharding.
How does sharding work?
In the Ethereum network, all the transactions are processed sequentially by all network nodes. They also store the state values (like account balances, contract code, storage) and verifies each quite time-consuming transaction.
By implementing sharding, the idea is to split the entire network into smaller unique shards that will execute transactions in parallel and at the same time. The nodes in the network will no longer hold the entire ledger to execute every transaction rather they will be assigned to process and validate only a few computations which will increase the transaction processing speed of the entire network. Thus this method is aiming to provide a solution to the scalability issue.
Key design challenges
- Shards should be uniformly divided among all network nodes to maintain load balance.
- Cross-shard transactions need to be carefully defined to maintain consistency in the network.
- Single-shard takeover attack- The system is more prone to this attack as the attacker just needs to take control over the majority of collators in a single shard to create a malicious shard that can submit invalid collations.
- Since each shard holds unique records thereby corrupting any nodes in a given shard will lead to the permanent loss of the corresponding data.
- Random sampling schemes can be used to control single-shard takeover attacks but this poses another problem as the validators do not always keep up-to-date state information for every shard that they could be assigned to.
- Incase of Fraud how other nodes in the network get informed to reject the collation.
- As the number of computers or nodes increases in the network, it will degrade the efficiency of the entire network.
Benefits of using Sharding
- Increased transaction speed.
- Minimizing processing and storage costs.
- Improved network performance.
Any practical implementation
Currently, the following list of projects is implementing sharding. Find Source here.
Sharding schemes seem to be the most effective candidate as they can overcome both performance and scalability problems. However, sharding mechanisms are still in the development-and-testing phase. Many key components need to be verified before treating it as a permanent solution. The solution must support the blockchain trilemma i.e Decentralisation, Scalability, and security as a prime focal point. The security and network protocol should be clearly defined to prevent any network attack.
Read More: A Guide to Smart Contracts