Sharding is a proposed solution to Ethereum’s scalability problem. Sharding breaks a blockchain into several smaller chains called shards. When necessary, shards communicate with one another through the main chain.
Currently, scalability is the stumbling block of most blockchains. Scalability is the capacity of a network to handle a growing number of transactions.
Scalability of a blockchain network does not have anything to do with the number of its nodes. A large number of nodes provide a high level of network security in that an attack on such network is only successful if attackers control more computing power that the rest of the network. Security is not scalability.
The problem with existing blockchains is that every node in a blockchain network processes each transaction, which puts big constraints on the overall transaction throughput. A blockchain is only as fast as its individual node, and a bigger number of nodes does not in any way alleviate this issue.
Sharding is not a new concept and generally refers to a partitioning of data in a database, i.e. dividing data into chunks and distributing them over a network of devices.
A sharded blockchain uses a system of blockchains (shards) that can talk to each other using a cross-shard protocol. Each shard operates like a regular blockchain unless a transaction occurs between addresses situated in different shards. In this case, the intermediate cross-shard protocol helps two shards settle the transaction.
Ethereum sharding divides the Ethereum blockchain into a beacon chain (the cross-shard protocol) and shard chains. The beacon chain is the main Proof-of-Stake chain, and shard chains, also PoS, contain transactions and contract code.
eacon chain contains a contract called Validator Registration Contract. When a node sends 32 ETH to this contract, they become a validator, a participant of the Casper PoS consensus system. The group of all active validators is called Active Validator Set.
The beacon chain assigns validators to shards by way of random sampling, so no validator knows beforehand which shard they will get. Therefore, they will not be able to execute a cooperated Single-Shard Takeover Attack.
A group of randomly sampled validators called a committee attests a crosslink from each shard and sends it to the beacon chain. A crosslink contains short information about the state of a shard. Crosslinks are created by proposers (or collators), and are the main means by which beacon chain learns about the state of shard chains.
So, to summarize, the beacon chain:
- manages and samples validators for shards;
- processes crosslinks;
- processes its own block-by-block consensus.
- store transaction data and code;
- report to the beacon chain by means of crosslinks.
Ethereum sharding is yet far from being ready and the actual implementation of sharding mechanism may be different from the one described above. Some people believe that Ethereum will adopt a super-quadratic sharding model, where shards have their own mini-shards, but that remains only a concept for now.