Sharding [ /ˈʃɑːdɪŋ/ ] is a method of partitioning a database horizontally across separate servers to improve scalability, performance and data availability.

In the context of DLTs, sharding refers to the process of dividing the network's computational and storage workload across multiple smaller groups of nodes, called shards, each responsible for processing a subset of the network's transactions and storing a portion of the global state.

https://youtu.be/u0GyEYvK7EI

Background

The primary goal of sharding in DLTs is to increase the overall throughput and capacity of the network without sacrificing decentralization or security. By allowing multiple shards to process transactions in parallel, sharding aims to overcome the limitations of ‘full replication’ where every node must process and store all transactions.

Sharding has gained significant attention in the blockchain community as a potential solution to the scalability trilemma, which posits that blockchain systems can only achieve two out of three desirable properties: scalability, security, and decentralization. By implementing sharding, projects such as NEAR, MultiversX and Radix aim to maintain high levels of security and decentralization while dramatically improving scalability.

The concept of sharding in DLTs extends beyond simply partitioning data; it encompasses complex mechanisms for ensuring data availability, cross-shard communication, and maintaining overall network consistency.

Technical Fundamentals

Sharding is a concept borrowed from traditional database systems and adapted for use in distributed ledger technology.

Database Sharding

In traditional database systems, sharding is a method for distributing data across multiple machines. It involves breaking a large database into smaller, more manageable partitions called shards. Each shard contains a subset of the data and is stored on a separate server. This approach allows for horizontal scaling, where additional servers can be added to increase capacity and performance.

There are two main types of database sharding:

  1. Vertical Partitioning: Different tables from the same database are stored in different instances.
  2. Horizontal Partitioning: A database table is split into separate sets of rows, stored in different database instances.

Application to Blockchain and Distributed Ledgers

In the context of blockchain and distributed ledgers, sharding involves dividing the network's computational and storage workload across multiple smaller groups of nodes, each responsible for processing a subset of the network's transactions and storing a portion of the global state.

The key difference in blockchain sharding is that it must maintain the security and decentralization properties of the network while improving scalability. This involves complex mechanisms for ensuring data availability, cross-shard communication, and maintaining overall network consistency.

Radix, for example, implements a unique approach called "pre-sharding", where the network launches with a maximum number of shards (2^64 or approximately 18.4 quintillion) already in place. This allows for future scalability without needing to change the fundamental structure of the network as it grows.

Key Goals: Scalability, Decentralization, Security

The primary objectives of implementing sharding in distributed ledgers are:

  1. Scalability: By allowing parallel processing of transactions across multiple shards, the overall throughput of the network can be significantly increased. In theory, this can lead to "quadratic sharding," where the capacity of the network grows quadratically with the computational power of individual nodes.
  2. Decentralization: Sharding aims to maintain or even improve decentralization by allowing the network to run on consumer-grade hardware. This is in contrast to some high-throughput chains that rely on a small number of powerful nodes.
  3. Security: A well-designed sharding system should maintain the security properties of the network, ensuring that an attacker cannot easily compromise the system by targeting a small subset of shards.