Blockchain technology is arguably revolutionizing the way data is stored and distributed. However, due to the large number of users that some blockchains have, problems such as the trilemma of scalability, security and decentralization appear. In this article we will talk about how sharding could help solve the problem of scalability. Projects like NEAR, Polkadot or Ethereum propose using state fragmentation to be more scalable, although in public blockchains it is quite a challenge.
what is sharding
The practice of sharding is not new, as it was very common among database administrators before the existence of blockchain technology. When speaking of fragmentation or Sharding, it refers to the process of dividing any type of database into smaller databases, in order to increase the speed with which transactions are executed. The increase in the number of databases is directly proportional to the increase in transaction speed and better simultaneous processing.
Solana, the scalability blockchain that was paralyzed due to excess activity
In a blockchain, the nodes process and store all the transactions in the chain and this makes it such a secure system. The problem comes when the network becomes too large, as in the case of Bitcoin or Ethereum, and the execution time of transactions slows down, leading to increased costs. Scalability is the ability of any system to adapt to increased demand, without being affected. This is why scalability is so important in a blockchain network that wants to reach a large number of users.
Fragmentation in a blockchain
Fragmentation in a blockchain is a model of parallel execution, where there are different nodes that process different transactions simultaneously. So instead of every node recording every transaction on the blockchain, some nodes would process certain transactions, while others would process others. It does not mean that each node, independently, processes some transactions, but rather that several nodes (and not all of them in the network) process the same fragment that is made up of different transactions. This allows for more transactions simultaneously, without long wait times, and better efficiency and scalability.
Let’s take an example to understand it. Let’s imagine a blockchain network that supports 1,000 nodes. This means that we could divide the data into 10 chunks and that each chunk would have 100 nodes associated with it. In this way, each node processes and stores 1/10 of the data, but the data is verified in 100 nodes. This gives us a x10 speed boost.
Increased difficulty in public blockchains
All the keys to why 2021 has been the most productive year for the young crypto industry
Sharding can be an effective tool, especially for private environment blockchains. However, using sharding on public blockchains is more difficult. One of them is communication between fragments. Communication between the shards is difficult and requires a lot of development to implement the communication mechanism. Still, if communication were successful, it could lead to greater overhead, diminishing some of the benefits of fragmentation. Something similar to Sharding could be Interledger, where the interconnection between ledgers is allowed and facilitates a more scalable blockchain with the help of others.
An also important challenge in sharding is the form of consensus and how validators are chosen. There are many types of consensus, but currently the best known are PoW (Proof Of Work) and PoS (Proof Of Stake). In general, PoS is considered better at implementing sharding than PoW, because of the way it validates transactions. The PoS is combined with a pseudo-random sampling selection of validators within a shard. This makes it so that a bad actor doesn’t know which shard it is being placed on, before it is actually placed on it, thus being a random validation and avoiding a possible 1% attack.
Fragmentation of networks and states
There are several types of fragmentation, but the most complicated to apply is stateful fragmentation. It is about dividing the entire state of the network between node operators and the shards. So each fragment only stores a part of the state. Nodes move between shards randomly, and each node will maintain the shard state it is in. Fast communication between shards is needed, as transactions between shards can occur.
Cases of use of blockchain technology in the field of Law
Network sharding refers to the parallel processing of transactions in separate shards. That is, each node stores a local copy of the entire blockchain. Transactions are parallelized and consensus is executed on each shard. The problem with this type of fragmentation is that despite speeding up transactions, the bottleneck is in storage. The capacity of each node is the limiting factor for linear scalability, as the size of each shard inevitably grows.
Blockchains based on state fragmentation
Projects like Ethereum 2.0, Algorand, Polkadot, Cardano, via Hydra, NEAR, and Zilliqa are devising and developing their own blockchain designs based on state sharding. All of them have in common that they are based on the Proof Of Stake consensus algorithm and the pseudo-random selection of validators. For example, Ethereum 2.0 plans to use Verifiable Random Functions (VRFs) to increase security in sharding.
Although a large majority of people agree that the solution to scalability is sharding, there is still no 100% working state sharding implementation beyond testnets and academic papers, but they are very close to it. get implemented. However, it is true that Zilliqa was the first to use sharding. Currently, it only handles network sharding and is investigating how to move to stateful sharding.