Sharding is a technique in blockchain derived from traditional databases with the purpose of scalability, enabling them to process more transactions per second. Sharding originates from a technology called database partitioning, also referred to as horizontal partitioning. The process involves dividing a large database into smaller units, known as "shards". This division facilitates improved accessibility to information on the database. [2]
Each shard is comprised of its own data, making it distinctive and independent when compared to other shards. A database shard, or simply a shard, is a horizontal partition of data in a database or search engine. Each shard is held on a separate database server instance, to spread load. Some data within a database remains present in all shards, but some appear only in a single shard. Each shard acts as the single source for this subset of data.
Sharding can help reduce the latency or slowness of a network since it splits a blockchain network into separate shards. However, there are some security concerns surrounding sharding in which shards can be attacked.[7]
Sharding takes the stress off the single chain processing all the interactions and transactions on the blockchain network. Each shard has its own ledger and can process then process its own transactions and holds a unique set of smart contracts. [1][3]
- Scalability: Sharding is well suited for large, distributed enterprise applications. It allows for the fast execution of a command or a query. Storage segmentation, which is a key feature of the sharding pattern, enables the physical infrastructure to scale in a controlled manner.[8]
- Decentralization: In addition to its positive impact on blockchain scalability, sharding also holds significant implications for decentralization. Sharding facilitates the involvement of a greater number of nodes in the network, enabling them to handle transactions. Consequently, this augments the degree of decentralization and equitable power distribution within the network. Such an arrangement could potentially enhance security, as the absence of a singular central point of vulnerability in an extensively decentralized network can contribute to heightened security levels.[5]
- Performance: By distributing the data across multiple machines, a sharded database can handle more requests than a single machine can. Sharding is a form of scaling known as horizontal scaling or scale-out, as additional nodes are brought on to share the load.[8]
Although sharding might seem like a potential resolution to blockchain's scalability concerns, its implementation comes with a few challenges. There are two primary drawbacks associated with sharding a blockchain: complexity and security.
- Complexity: Introducing sharding to existing blockchain networks is a formidable task due to the intricate process of network partitioning and the necessary reassignment of state. Sharding greatly increases the complexity of a software development project. Additional logic is required to shard the database and properly direct queries to the correct shard. This increases development time and cost. [3][4]
- Security Concerns: Security concerns surrounding sharding include a hack or shard takeover, where one shard attacks another, resulting in a loss of information. Inadequate implementation can lead to the risk of double spending, significantly impacting the overall security of the network. In addition, a segmented blockchain could become vulnerable to attacks, as hackers might find it easier to gain control over a single shard due to the reduced hash power necessary to manipulate individual segments. If a segment is compromised, malicious transactions could potentially be disseminated to the broader network, causing disruptions to the entire system.[3][6][7]
- Infrastructure Costs: A more elaborate network mesh is often necessary, which leads to an increase in lab and infrastructure costs.[9]
- Expertise Required: The sharding pattern requires that DBAs have both specific domain expertise and experience with the best practices of the database technologies in play in order to manage the sharding segmentation effectively.[8]
- Network Traffic: Shards distributed over a large number of geolocations can be susceptible to performance degradation due to excessive network traffic.[8]