Exchange rates:
561522
Exchangers:
419
Updated:
11:32:22

Sharding with simple examples

Over time, blockchains have faced the need to improve their efficiency. Limited bandwidth and high fees created artificial barriers to the widespread adoption of cryptocurrencies.

Previously, we covered existing solutions in What are Layer 1 and Layer 2 solutions? Today, we will examine the work of sharding in more detail and provide simple examples.

To simplify, sharding is the division of the database into several parts. The term comes from the English word "shard," which means a shard. In this scheme, the blockchain is divided into separate parts and assigned to certain nodes. It is easier for network nodes to control individual parts than the entire blockchain.

The idea of fragmenting transaction processing dates back to the creation of computers, so the concept itself is not new. Before blockchain, sharding was used to distribute databases across different servers. But in the context of distributing transaction processing for blockchains, it's a relatively recent idea.

For example, if there are 300 validators in some network, they can at any moment randomly split into two groups (two "shards" or shards) of 150 validators each. With the same level of decentralization, they process transactions in parallel twice as fast.

Each shard in such a scheme performs its transactions and adds blocks in conjunction with its nodes.

The application of this tool is in the Ethereum roadmap on the way to the transition to the updated version of the ETH 2.0 ecosystem, where it is planned to break the network into 64 interconnected segments.

By the way, the TON blockchain has already implemented sharding, where a dynamic number of segments is programmed depending on the load on the blockchain.

Can we make it simple?

Let's look at this concept with a simple example to understand how sharding works. The example explicitly describes the process of taking an exam.

You have 100 professors and 10,000 students who need to take exams. Now, using this example, let's try to describe each concept.

If we describe the workings of a normal blockchain with a PoS algorithm, 10 representatives will be randomly selected from 100 professors; these professors will take the exams of 100 students together and make a collective judgment on each one. The results of the first hundred students will be entered into a sheet, and then a new draw will begin for the following 10 faculty members who will take the exam. And so on until all students have passed the exam.

When we talk about sharding, the scheme can be visualized as follows: 100 teachers are randomly divided into 10 groups of 10 and take exams in parallel in different classrooms. At the same time, students cannot choose the auditorium with their favorite professors: who they get to is also decided by lot.

In practice, with the same degree of protection against corrupt teachers (when a consilium decides 10 random people), we get a 10 times higher rate of exam acceptance.

If we talk about sharding on the Ethereum model, everything is exactly the same as in the example above. But when we consider dynamic sharding (like TON), new risks appear.

So, for example, if 1,000,000 students come to the exam instead of 10,000, the "ETH teachers" will simply sit 100 times longer, while the "TON teachers" will split into 100 groups instead of 10 to take the exam in the same amount of time.

That is, a consilium of 10 independent people will no longer take the exam but by each teacher alone. This situation opens up opportunities for abuse — from bias to bribery.

Therefore, to ensure the correct operation of dynamic sharding, the staff should be expanded along with the increase in the number of students. Otherwise, the independence of such a solution will decrease.

But it's worth complicating the example by mentioning another interaction problem for shards. Imagine that the exam is a paired thesis project, but each student defends the work separately. The project grade should be the same for both students in the pair.

If it is no problem for teachers "without sharding" to look into the report of the previous group to check if the project has already been evaluated earlier, then for teachers "with sharding," everyone has his report, and setting up the process of information exchange between parallel groups is a big problem, which developers are still trying to solve as efficiently as possible.

Briefly about the advantages:

Let's conclude by noting why sharding is needed and what opportunities it opens for projects:

  • transaction processing is distributed across different nodes, i.e., shards, which reduces the load on each node and speeds up transaction processing as a whole;
  • due to more efficient transaction processing, transaction costs are reduced, and the blockchain becomes more cost-effective for users;
  • distributed architecture through sharding increases the resilience of the network to failures and attacks, providing higher levels of availability and security for users.

© BestChange.com – , updated 04/09/2024
Reprints are allowed only with permission of BestChange

See also