Sharding is a technique of database partitioning used by blockchain companies with the purpose of scalability, enabling them to process more transactions per second. Sharding splits a blockchain company’s entire network into smaller partitions, known as “shards.” Each shard is made up of its own data, making it distinguishable and independent when compared to other shards.
Sharding can help minimize the latency or slowness of a network since it splits a blockchain network into separate shards. However, there may be some security concerns regarding sharding in which shards can be attacked.
Scalability
- The major challenges with blockchain technology is that as additional computers are added to the network and more transactions are processed, the network can become bogged down, slowing the process—called latency.
- Latency is an obstacle to blockchain. In other words, scalability is a challenge for blockchain since the networks may not be able to handle the increased amounts of data and transaction flow.
- One of the solutions for creating latency-free scalability is the process of sharding. Sharding is designed to spread out the workload of a network into partitions, which may help reduce latency and allow more transactions to be processed by the blockchain.
Blockchain Consensus
- Blockchain technology was introduced by Bitcoin in 2008, which accepts the agreement of the ledger among distributed nodes through a specific consensus mechanism. This is the reason why blockchain is called “chain” because each block is linked to the previous one in a specific cryptographic way. The contents stored in a block mainly include the transactions generated in the network during each period of time.
- Blockchain technology is currently a hot area of research and has great application potential since it has the following characteristics:
- Decentralization
- Trustlessness
- Permissionless
- Transparency
- Tamper resistance
- Anonymity
- …..
- Sharding technology was first proposed and used in the field of databases. By dividing all participating nodes in the network into multiple shards, each shard is only responsible for maintaining its own corresponding data. In this way, the scalability of network processing capabilities could be achieved.
- As the number of nodes in the network increases, the enhancement of processing capabilities is realized by adding more shards. The sharding blockchain was first proposed by ELASTICO, which combines sharding technology and blockchain technology, with the aim of increasing transaction throughput, i.e., the number of transactions processed per second. After that, there have been many studies on sharding blockchains, such as Omniledger, Chainspace, RapidChain and Monoxide.
Sharding Process
- Currently, in blockchain, each node in a network must process all the transaction volumes within the network.Nodes in a blockchain are particularly independent and are responsible for maintaining and storing all of the data within a decentralized network. In other words, each node must store critical information, such as account balances and transaction history.
- While it ensures a blockchain’s security by storing every transaction in all of the nodes, this model slows transaction processing considerably. But, slow speeds for processing transactions are not acceptable and advisable as blockchain is becoming responsible for millions of transactions.
- Sharding can help since it partitions or spreads out the transactional workload from a blockchain network so that every node doesn’t need to handle or process all of the blockchain’s workload.
Horizontal Partitioning
- Sharding can be accomplished through the horizontal partitioning of databases through division into rows.
- For example, one shard might be responsible for storing the state and transaction history for a specific type of address. Also, it might be possible to divide shards based on the type of digital asset stored in them.
Shard Sharing
Each shard can be shared amongst the other shards, which maintains a key aspect of blockchain technology i.e. the decentralized ledger. In other words, the ledger is still accessible to every user allowing them to view all of the ledger transactions.
Types of Blockchains Sharding
- Communication Sharding
Here, participating nodes are divided into different shards where nodes in each shard only need internal communication most of the time. The clients and nodes within each shard could obtain the current state of the blockchain by communicating with the intra-shard nodes that are responsible for maintaining the blockchain, e.g., a committee.
- Computation Sharding
It means that each shard is only responsible for processing its corresponding transactions. The distribution of transactions to shards is diversified, e.g., by selecting the corresponding shard according to the transaction ID. So transactions are handled by different shards in parallel. When the number of nodes in the network increases, more shards could be added to realize scalability.
- Storage Sharding
It indicates that nodes of different shards only needs to store the data of its corresponding shard. The data includes transaction history and unspent transaction output (UTXO) data. Transaction history data exists in the form of a blockchain, Storage sharding allows nodes to store a fraction of the entire blockchain system data, reducing the storage burden of nodes.
Sharding and Security
One of the major problems in this practice is security. Though each shard is separate and only processes its own data, there is a security concern regarding the corruption of the shards, where one shard takes over another shard, resulting in a loss of information or data.
Conclusion
Of course, blockchain may be sharded or partitioned and considering both pros and cons, the following points can be concluded.
- Sharding is a database partitioning technique being considered by blockchain networks and being tested by Ethereum.
- The more users in a blockchain network results in a slower network, leading to significant latency.
- Sharding can improve network latency by splitting a blockchain network into separate shards-each with its own data, separate from other shards.
- Security concerns regarding sharding include a hack or shard takeover, where one shard attacks another, resulting in a loss of information.