Scaling Blockchain Systems via Sharding on the Example of ETH 2.0

At Numbrs, we are working to shape the future of the financial industry and are constantly exploring new emerging technologies as part of our mission. Recently, our teams have worked on the scalability of blockchain systems. In general, Blockchain systems have a huge disadvantage: they are difficult to scale. Don’t get it wrong — they scale pretty well to meet the needs of cryptocurrency users at the moment, but what if they have to support 10x or even 1,000x more transactions? Moreover, what if we want to use the technology of non-cryptocurrency applications? 

Our team working on Ethereum 2.0 has an answer — sharding. Before explaining how they plan to do it, let’s take a quick overview of what sharding is.

We are hiring:
Head of Software Engineering
Engineering Manager
Machine Learning Engineer
Senior Product Owner

What Is Sharding? 

The concept of sharding isn’t new to computer science. In fact, it has been around for a long time and was used for splitting databases horizontally to spread the load. In plain English, by dividing databases into independent shards (with each containing an instance of the database), you can increase their overall capacity.

Imagine a standard database consisting of rows and columns. Sharding is performed by turning each row into a single shard — a separate database. This is also referred to as horizontal partitioning. Each row is then stored on a separate database server instance, even though they remain connected in a way.

Index size is reduced by applying sharding, which means that database performance is increased. A shard can even be placed on separate hardware, meaning it can be distributed on many machines to improve performance further.

Vitalik Buterin and the team explored this concept and wanted to apply it to the Ethereum blockchain. Even though it’s similar to what’s explained above, there are plenty of things that are very different. However, to understand how sharding could improve blockchain systems, it’s necessary to have an insight into their current state.

The Current State of Affairs in Blockchain Systems

Every blockchain, including the one that supports Ethereum, has to leverage security, scalability, and decentralization at the moment. Paying too much attention to two of these will result in the third one deteriorating in quality and compromising the network.

Sharding is the answer to the scalability problem, which would not affect decentralization and security in any way. Every node on the chain currently stores the entire state of the network, which includes account balances, storage, contract code, and more. Moreover, every node processes every single transaction, and that sets scalability limits, even though it’s the best possible practice security-wise.

To run a node on your device, you’ll need hundreds of gigabytes, as it’s closely approaching its first TB. Simply put, not many people will be willing to have a storage that big to store the entire Ethereum database. That’s perhaps the most important reason why sharding could save the day.

How Ethereum Wants to Implement Sharding

As soon as the network is sharded, the initial 64 shards will immediately lift some of the load up, which will consequently help with scalability. Instead of having to run an entire network on your device, you’ll run just a small portion of it that’s located in one of the shards. In other words, every node will store one shard only, meaning even machines that don’t have a lot of disk space will be able to act as nodes in the chain. The team at Ethereum already works on this big time. Once they introduce shards, however, the real work starts. There are already two versions of shard chains planned.

Shard Chains Version 1

The first version of shard chains will not be able to handle transactions or smart contracts. Still, they will improve the entire network by breaking it into shards and increasing the overall number of transactions per second (TPS).

Increasing TPS will be possible when shard chains are combined with rollups, which is a technology that will allow decentralized apps to “roll-up” a bundle of transactions off the chain, generate a cryptographic proof for it, and then return it to the chain, reducing the data needed to process the transaction. If you combine that with the data availability from the introduction of the first shard chains version, you’ll get up to 100,000 TPS, which is definitely higher than the current 30 TPS. 

Shard Chains Version 2

Developers will continue working on shard chains until they introduce all the other features that are currently present on Ethereum mainnet, such as smart contract execution and storage and account handling. 

However, the Ethereum community is still not certain whether this should happen as there are many arguments both for and against the second version. After all, their initial purpose was to increase TPS and help with scalability.

Vitalik Buterin discussed this in a Bankless podcast, pointing out three possibilities:

  • No code execution — The shards will not be able to handle smart contracts, meaning they’ll just serve their primary purpose, and that’s being data deposits.
  • Partial execution — The version 2 functionality could be added to just some shards and not all 64 of them, speeding up the delivery further.
  • Wait for ZK snarksZero-knowledge snarks are also one of the technologies that could help the Ethereum network make truly private transactions available. The sharding debate could be revisited once again after ZK snarks are introduced.   

The Advantages of Sharding on Eth 2.0

We already mentioned sharding and its benefits regarding scalability. But that’s not the only good thing that will help Ethereum. Let’s take a look at all the advantages.

  • More decentralization — By introducing sharding, Ethereum will not require hundreds of gigabytes of space. In fact, a simple phone or tablet could become a node if proper sharding is introduced, which means there will be a chance to increase the number of nodes, thus improving decentralization levels of the network.
  • Scalability — The network will be able to process up to 100,000 transactions per second with the combination of rollups and sharding.
  • Security — By being more decentralized, the network will have its security improved by far.
  • A step toward mass adoption — Apart from scalability, Ethereum and many other blockchain networks are looking for ways to bring their disruptive technology to the masses and make it adopted around the globe. It’s the steps such as sharding blockchain that could bring it one step closer to the goal.

The ETH2 now seems more real than ever

Still, transitioning from Ethereum 1.0 to 2.0 isn’t a simple process. According to the official pages, it will be conducted in three phases:

0. The Beacon Chain

1. Shard Chains

2. Shards EVM 

3. Light Clients 

In fact, the Beacon Chain already shipped on December 1, 2020, and the next one in line is the introduction of shard chains. Although there are no hard dates, sharding should be introduced sometime during 2021, meaning it could already be part of the network by the time you read this text.

The docking is a process when the Ethereum mainnet that runs the network at the moment will itself become one of the shards. It’s still not quite clear whether it will remain the only “smart” shard and handle code execution or not. However, this is scheduled to take place sometime during 2021 or 2022, and there’s still a lot of room to discuss the best way to implement this.