In the world of blockchain technologies, the quest for scalability and performance is relentless. One of the most promising techniques for achieving these goals is sharding. Popularised by Ethereum 2.0, sharding divides a blockchain into parallel segments, called shards, which can process several transactions simultaneously. This method revolutionises the way blockchains can evolve, enabling them to meet growing needs without compromising security or decentralisation.
The concept of sharding has its roots in traditional computing, used to optimise databases by dividing them into more manageable parts. However, the adaptation of this technique to the world of blockchains is relatively recent. In 2017, Vitalik Buterin, co-founder of Ethereum, proposed sharding as a solution to improve the scalability of the Ethereum blockchain. Since then, several blockchain projects have incorporated or explored this technique, with Ethereum 2.0 leading the way, marking a crucial step in the evolution of blockchains.
Sharding is based on dividing the blockchain into several segments, each of which functions as an autonomous mini-blockchain. Each shard can process transactions and execute smart contracts independently of the others. Instead of storing and processing all the data on the blockchain, the nodes focus on one or more specific shards. This considerably reduces the workload and increases transaction throughput.
To understand this innovation in a simple way, imagine a very busy library. If everyone who wants to borrow a book has to go through a single librarian, this creates a long queue and slows down the process. Now imagine that the library decides to divide its space into sections (fiction, non-fiction, science, history, etc.) and places a librarian in each section. Visitors can then go directly to the appropriate section and deal with the librarian for that section. This speeds up the process, as several people can borrow books simultaneously from different sections, without creating a bottleneck.
Similarly, sharding divides the blockchain into different sections (shards), allowing several transactions to take place in parallel. Each shard can manage its transactions and smart contracts independently, while a main chain ensures overall coordination and security. Sophisticated mechanisms such as proofs of validation and committees of validators are used to maintain the coherence and security of the network.
Many projects have adopted or are exploring sharding. Ethereum 2.0 is probably the best known, aiming to transform the Ethereum ecosystem to make it more scalable and efficient. Other notable projects include Polkadot, which uses a form of sharding called parachains, and MultiversX (formerly Elrond), a blockchain that implemented sharding from its launch. Websites and protocols such as NEAR Protocol are also exploring this technique, each with their own variants and improvements.
MultiversX has established itself as the leader in blockchain sharding with the introduction of its Sovereign Chains, a major innovation. These autonomous chains enable entities such as companies or governments to create custom blockchains while benefiting from the security and robust infrastructure of MultiversX. Sovereign Chains offer great flexibility and seamless interoperability with other network shards, enabling horizontal scalability without overloading existing resources. For example, an e-commerce company can use a Sovereign Chain to optimise its real-time transactions and data management, while integrating payment solutions and smart contracts, thereby benefiting from the security and performance of MultiversX.
For Web 2, although the adoption of sharding is less straightforward, the underlying principles can inspire improvements in the management of databases and distributed systems. Companies can adopt similar models to improve the scalability of their infrastructures, reducing bottlenecks and optimising overall performance.
In the context of Web 3, sharding enables blockchains to support an increased number of decentralised applications (dApps) and transactions, making networks more robust and usable on a large scale. This facilitates the creation of larger, more interactive decentralised ecosystems.
Sharding has applications in a variety of fields. For example, decentralised finance platforms (DeFi) can greatly benefit from increased scalability, enabling complex financial transactions to be processed quickly and efficiently. Blockchain games, which require a high transaction throughput to function properly, can also benefit from sharding. Another area is digital identity management, where the ability to process thousands of verifications simultaneously can improve the security and efficiency of systems.
A concrete example of the use of sharding is Ethereum 2.0, which, once fully deployed, plans to divide its network into 64 shards. This configuration will significantly increase the number of transactions per second, reducing gas costs and improving the user experience. Polkadot, with its parachains, enables different shards to operate in parallel and interact with each other via its relay chain.
Sharding represents a major advance in the world of blockchains and offers promising solutions to scalability and performance problems. By dividing blockchains into parallel shards, this technique allows more transactions to be processed simultaneously, paving the way for more complex decentralised applications and wider adoption. As blockchain technologies continue to evolve, sharding is likely to become a key element of their architecture.
Sharding divides a blockchain into several autonomous segments, called shards. Each shard is an independent mini-blockchain, capable of managing its own portion of the data and transactions. Technically, each shard maintains its own state, which is a database containing all the information on the accounts and smart contracts it manages. In addition, each shard has its own transaction log, which means that each transaction is validated and recorded locally on the corresponding shard.
Coordination between these shards is ensured by a main chain, which is dedicated to managing the synchronisation and security of the network. The main chain is responsible for the pseudo-random distribution of validators across the shards, a crucial process for preventing Sybil-type attacks and collusion. Validators are network nodes that participate in the consensus by validating transactions and blocks. The pseudo-random selection of validators for each shard is often derived from a cryptographic algorithm executed by the main chain, ensuring a regular and unpredictable rotation of validators.
Inter-shard communication, particularly for cross-shard transactions, is a complex technical aspect of sharding. Cross-shard transactions are transactions that involve multiple shards, for example, a user wishing to transfer assets from an account on one shard to an account on another shard.
Several techniques are used to ensure the consistency of these transactions.
A consensus protocol is used to ensure that cross-shard transactions are executed atomically. This means that the transaction is either validated by all the shards involved or rejected in its entirety. Distributed locks or two-phase validation protocols are commonly used to achieve this. In a two-phase validation protocol, a preparation phase verifies that all shards can execute the transaction, followed by a final validation phase where the transaction is either confirmed or cancelled.
Relay chains, like those used by Polkadot, mediate communications between shards. They act as a centralised communication channel that facilitates the secure transfer of data and assets between shards. The relay chain validates and relays messages between shards, ensuring that cross-shard transactions are secure and consistent.
Each shard can include light clients for other shards. A light client is a client that downloads only a small part of the blockchain, usually the block headers, to verify cross-shard transactions. This method allows each shard to check the status of the other shards without requiring full synchronisation. Light clients use cryptographic proofs, such as Merkle proofs, to validate transactions efficiently and securely.
The security of a sharded network relies on sophisticated validation and validator distribution mechanisms. Here's how it works technically.
The selection of validators for each shard is carried out in a pseudo-random way. This algorithm uses cryptographic functions derived from the main chain to ensure that the selection is unpredictable and that validators change regularly. This process reduces the risk of collusion and Sybil attacks, where an attacker could create multiple identities to manipulate the network.
Committees are groups of validators who validate the blocks of each shard. Each block must be approved by a committee of validators, ensuring a multi-level consensus. In addition, some systems use notaries, who are special validators responsible for checking cross-shard transactions and ensuring consistency between shards.
In sharding systems based on Proof of Stake, such as Ethereum 2.0, validators must deposit a stake of crypto-currencies to participate in the validation. This stake provides an economic incentive for validators to behave honestly, as any attempt at malicious behaviour can result in the loss of their stake. This mechanism aligns the economic incentives of validators with the security and integrity of the network. Validators are chosen to validate blocks according to the size of their stake and in a pseudo-random way, reinforcing the security and decentralisation of the network.
Register for free to the Summit Research newsletter
and receive our weekly newsletter every Saturday at 10 am (CET).
Nous rendons le monde de la blockchain et des crypto-monnaies accessibles en construisant ensemble un écosystème transparent et compréhensible.