Easily understand the sharding concept of ETH2.0
There’s a lot of technical discussion going on at Ethereum 2.0 right now, but most of the articles fail to get the basic concepts across and leave readers in a daze.
Although ETH2.0 is generally very complex, the basic concepts, such as sharding and beacon chains, are designed to be simple and do not require much expertise.
Leaving aside the complicated technical implementation details, we can describe the concept of sharding in very concise words.
Let’s look at the ethereum address format first.Below is a typical Ethereum address that copied at random from the browser.
All ethereum addresses begin with 0x, which means that hexadecimal is used.Starting with the third character, each character is going from 0 to F, with a total of 16 possibilities.
Let’s start with the third character.If you divide by one character and divide 0 through F into one class, you can divide it into 16 classes.If you divide by two characters, say from 00 to FF, you can break it into 16² = 256 classes.And you pick three digits, that will be 16³=4096.
(Let’s ignore some of the limitations in the Ethereum address specification, such as case, check codes, and so on.Let’s just think about the idea of sharding.If address design specifications are taken into account, there is less actual classification.
Now all accounts on ethereum 1.0 are not treated differently according to the above letter, all addresses have the same status, including external accounts and contract accounts.
By that it means ethereum nodes, wallets, and software don’t categorize addresses.Blocks that include Ethereum are packaged and not sorted by address.In the sharding design of ETH2.0, addresses are sorted by the first few letters.
ETH2.0’s address design rule decide to clarify the addresses, and a class of addresses is a sharding. It’s that simple.
In the first phase, ETH2.0 will have 64 shardings, which means you only need to select the 3rd and 4th characters of the address for clarification.
ETH2.0 nodes, wallets, software, and blocks are designed to treat transactions by address differently.
Once the addresses are clarified, the blocks will be packed by addresses.A block can only contain one type of address.And all these blocks of the same clarification address together make up a sharding of ethereum.
Now we can define the sharding of ETH2.0.
First clarify the addresses by the first few letters.
A shard is any block that packages a transaction of the same type of address, and only a transaction of the same type of address is packaged in the same shard.
If addresses in the same sharding send token to each other, it’s very easy to handle.But what about sending transactions across shardings?And that’s where the beacon chain comes in.
As we’ll talk about in the future, here’s a brief description of how a beacon chain can help different shardings of addresses communicate across shardings.
For example, if 0x00 address wants to send 1ETH to 0x01 address.
Each shard block is a block following a beacon chain, a one-to-one relationship.
The theory is when 0x00 sends 1ETH to the block of the beacon chain in its own block, which has something called a state transition function, which sends the 1ETH to the block of the beacon chain at the 0x01 sharding, and forwards it to the 0x01 address.