Clicky

Uncomplicating the Ethereum Sharding


There is a lot of expectation for Ethereum to be scalable. With so many innovations in many different sectors, with the success of NFTs and DeFi, the need for a scalable, decentralized and secure smart contract platform is latent.

Among the scalability solutions for Ethereum, sharding is one of the most important and promising. If you do not yet understand what sharding is, you are in the right place. In this article we will explain the most important concepts in a simple way.

The basic process of a blockchain

basic steps of a blockchain

Before moving on to sharding, you need to understand the process of forming a blockchain. As the name implies, a blockchain is an ordered chain of blocks.

Blocks are sets of information. In the case of Bitcoin, that information is just transactions. In the case of Ethereum, there is a lot of extra information, such as contract storage and contract code, since its protocol is broader and involves smart contracts.

Currently, Ethereum has a single chain, just like Bitcoin. In this scenario, all validators compete with each other for the right to mint each block, and the chain advances one block at a time.

When a block is mined, the full nodes of the network verify that the block is valid and add it to the chain, transmitting the new block to their nearest peers. Similarly, the next miner will only introduce the next block under the previous block if the previous one does not present any problems.

Understanding this, we can proceed.

What is sharding in Ethereum?

Instead of having just one chain, in sharding there will be 64 chains. It is as if there are 64 separate blockchains, each adding a new block following the traditional steps of competing and choosing a validator, propagating the block, and so on.

The only detail is that these 64 blockchains are not independent, but are synchronized via the consensus chain, the so-called Beacon Chain. This is important because if each sharding was a completely independent blockchain, a user’s balance could be 5 ETH in one shard and 3 ETH in another shard. The idea is not to have 64 separate Ethereum projects with separate balances, but a single project where there is consensus on the status of each account and each contract.

So let’s get a better understanding of what the Beacon Chain is.

What is Beacon Chain?

The Beacon Chain is a chain that serves to synchronize the other chains (shards). It does not contain in itself the balance of accounts or records of smart contracts, it only contains attestations about what the validators have done.

In practice, the Beacon Chain receives the addresses of the validators, the state of each validator, its attestations and links to the respective shards.

It is common here to have confusion, because looking at some didactic images on the Internet, one may have the impression that the Beacon Chain is a chain in the same way as the shards, but this is not true. The Beacon Chain does not receive all the contents of the shards.

As a comparison, imagine that the director of a company has 64 managers, and each manager is responsible for recording the various operations of the company. When a manager reports to the director, he will not report all the details of his operation, he will just say: “I did my job, my closest colleagues agree with me, here is the final summary”. After talking to all the managers, the director will forward an official document with the aggregate of the most important things in the company for everyone to see, and the cycle will repeat.

In this example, the managers are the shards, and Beacon Chain is the director. Beacon Chain gathers the information received from all the validators, groups it, validates it, and propagates to each of the 64 shards their new current block so that they can start their work again.

How does sharding work step-by-step?

Imagine a scenario where there are many validators in the Ethereum network. Before sharding they are all competing with each other to mine the current block, and there is only one chain.

With sharding, there will be 64 chains, so 64 blocks will be produced simultaneously. Each of the 64 chains will draw lots to choose a group (committee) of validators responsible for validating its respective block. Then, for the next block, after the new current status of the Beacon Chain, a new draw will take place. In other words, the validators will be constantly participating in different shards, concentrating their work locally for each participation.

These 64 blocks that are being added in 64 chains are being checked by each committee, so that a validator who is working in shard A doesn’t need to check the block of shards B, C or D, he just checks the signatures of the committees in these other shards.

In the same way, a block produced in one shard is not propagated to the entire network, but to its respective sub-net, which are the full nodes responsible for that shard.

The GIF below illustrates this process, showing just 4 shards for ease. Note that the Beacon Chain is important to ensure that there are not 64 independent blockchains with distinct balances, but that everything is connected and there are no inconsistencies:

Basic steps of the ethereum blockchain using sharding

It is not difficult to see that sharding represents a massive gain in scalability, speed, and efficiency, as well as being more decentralized by allowing more agents to act.

However, it is important to make some caveats.

Dependency on rollups

Initially, the shards will not handle transactions or smart contracts. This task will be performed by decentralized applications (dApps), which in turn will organize this raw information by creating a “rollup” of data with a cryptographic proof. Each shard will receive this summarized data. 

In other words, the technique of rollups, which consists of reducing the amount of relevant information that occurred in the network is going to be fundamental to the initial operation of sharding in Ethereum.

Uncertainty about the future

It is not clear to what extent shards will evolve to the point of storing smart contracts on their own or managing accounts. After all, this may never be necessary in the scenario where integration with rollups is sufficient. Since each agent works in a decentralized fashion, there are adoption aspects at play that will reveal the extent to which each strategy is succeeding.

In addition, it is unknown whether 64 shards will be enough to give Ethereum the scalability it will need in the future or whether more shards will be needed. Any change in the number of shards also brings changes to the hardware requirements of each full node, as well as the minimum amount to become a validator, which will initially be 32 ETH.

When will sharding be implemented?

The most current outlook is sometime in the year 2023. Some important steps need to happen first, such as the complete migration of the PoW protocol to PoS by coupling the current chain with the Beacon Chain (an event known as “The Merge”), which is planned for late 2022, as well as the operation and maturation of the rollups, which are in an embryonic stage.

Overall, this process has already begun in 2020 with the introduction of the Beacon Chain, which today (early 2022) already operates in parallel with Ethereum’s main blockchain network that still runs with PoW.

The Beacon chain was commonly called Eth2.0, however the developers decided to retire this name and call this layer the “consensus layer“.

Conclusion

Great projects require great challenges, and with Ethereum it will be no different. The sharding technique is complex, brings some uncertainties, but at the same time represents a good opportunity for Ethereum to scale its applications.

Looking at the steps of its implementation, we can conclude that this process has already begun, and that the success of the rollups will be very important so that the original plans of sharding are not frustrated.

If the rollups have enough adoption in 2022 and 2023 to meet expectations, it is very likely that Ethereum’s scalability will have a promising near future, as any additional tweaks will only serve to give even more capacity to an already powerful network. In fact, everyone wants this powerful network, as the current scenario is still one of high fees and congestion.

We are still waiting, one block at a time.