Understand the sharding concept of ETH2.0
There are a lot of technical discussions on Ethereum 2.0, but most of the articles fail to explain the basic concepts, which confuses readers.
Although ETH2.0 is very complicated in general, the design ideas of those basic concepts, such as sharding and beacon chain, are very simple and can be understood without much professional knowledge.
Let's put aside the complicated technical implementation details, and then we can describe the concept of fragmentation in very concise text.
Ethereum address
Let's take a look at the address format of Ethereum first. The following is a typical Ethereum address, I just copied it in my browser.
0x506dDF5a547EaaE34bAE6Ff57c78B5aD50a6A1BF
The first two characters of all Ethereum addresses are 0x, which means that hexadecimal is used. Starting from the third character, each character is from 0 to F, a total of 16 possibilities.
We start the classification from the third character. If one character is used, 0 to F are divided into one category, and then it can be divided into 16 categories. And if two characters are used, such as from 00 to FF, they can be divided into 16^2 = 256 categories. And choose three digits to divide, that is, 16^3=4096 category.
(We do not consider some restrictions in the Ethereum address specification, such as capitalization, such as check codes. First consider only the idea of sharding. If you consider the address design specification, the actual classification is less.)
At present, all accounts of Ethereum 1.0 are not treated differently according to the above letters. All addresses have the same status, including external accounts and contract accounts, which are the same.
What I said here is the same. It means that Ethereum nodes, wallets, and various software will not classify addresses into different categories and treat them equally. Including Ethereum's block packaging, it will not be sorted by address.
In the sharding design idea of ETH2.0, addresses will be classified according to the first few letters.
Fragmentation
The address design rules of ETH2.0 will be classified, and a type of address is a fragment. This is the famous sharding, it's that simple.
In the first stage, Ethereum 2.0 will have 64 slices, which means that you only need to select the 3rd and 4th characters of the address to classify.
After categorizing by address, ETH2.0 nodes, wallets, and various software, with block design, can treat transactions of various addresses differently.
After address classification, the blocks will be packaged according to address classification. Only one type of address can be contained in a block. And all these blocks of the same classified address together form an Ethereum shard.
Definition
Now we can define the sharding of ETH2.0.
First classify the address by the first few letters.
Fragmentation is all blocks that package transactions of the same type of address, and the same shard only packages transactions of one type of address.
Cross-film
If a piece of address sends coins to each other, it is very easy to handle. But what if you send transactions across regions? This will use the beacon chain.
We will talk about the beacon chain later, here is a brief description of how the beacon chain helps different types of addresses communicate across slices.
For example, 0x00 address needs to send 1ETH to 0x01 address.
Each shard block is a block following the beacon chain, in a one-to-one relationship.
The method is to first send 1 ETH to the beacon chain block in its own area by 0x00. The beacon chain has something called a state transition function. This state transition function will send this 1 ETH to the area of the beacon chain in the 0x01 partition. Block, and then forward to the 0x01 address.
Supplementary description
My description above is very simple and can be understood without basic knowledge. I still want to emphasize that this is just a description of the idea of sharding, and its implementation details are very complicated.
Reference materials are here: https://eth.wiki/sharding/Sharding-FAQs
