What Is Sharding in Blockchain, and How Does It Work?
Sharding splits a blockchain into parts called shards, so each one handles a share of the work. Here is how it raises throughput, and the trade-offs it brings.
On this page
Short answer
Sharding in blockchain is a way to split a network into smaller parts, called shards, so that each part handles a share of the work instead of every node processing every transaction. The aim is to raise throughput without giving up the security of the whole network.
What is sharding in blockchain?
Sharding in blockchain is a way to split a network into smaller parts, called shards, so that each part handles a share of the work instead of every node processing every transaction. The aim is to raise throughput without giving up the security of the whole network.
In a network without sharding, every node stores the full history and checks every transaction, which keeps the network secure but limits how many transactions it can handle. With sharding, a node only stores and checks the transactions of its own shard, so the network can process many shards in parallel.
Sharding is a scaling idea borrowed from databases, where large tables are split across servers. In a blockchain the split has to be done carefully, because the network must still agree on one shared state and stop any single shard from being taken over.
How sharding splits the work
Sharding splits the work by assigning each transaction, account or smart contract to one shard, usually by a rule such as the first characters of an address. A node that joins a shard only follows that shard, which keeps its storage and computing load small.
Each shard has its own validators, its own block history and its own state. When a user sends a transaction, it goes to the shard that owns the sender's account, and that shard's validators check it and add it to the shard's chain.
The split raises capacity because the shards work at the same time. If one shard handles 100 transactions per second, four shards running in parallel can handle roughly four times as much, minus the cost of coordinating between them.
Coordination is the hard part. A main chain, often called a beacon chain or hub, keeps track of the shards, assigns validators to them and records a short summary of each shard's state so the network can agree on the whole picture.
Types of sharding
There are several ways to shard a blockchain, and they differ in what is split and how the shards talk to each other.
| Type | What is split | Strength | Weakness |
|---|---|---|---|
| State sharding | Accounts and balances | Low storage per node | Cross-shard reads are slow |
| Transaction sharding | Transactions by sender | Simple to assign | Shared state still needed |
| Network sharding | Nodes into groups | Parallel gossip | Groups must stay honest |
| Full sharding | State, transactions and network | Highest throughput | Most complex to build |
Most live networks use a mix rather than one pure type. They shard transactions and state together, and they rotate validators between shards so that no group of validators stays in control of one shard for long.
How shards stay in sync
Shards stay in sync through a shared reference that records the state of every shard at regular intervals. Each shard posts a short summary, such as the root hash of its state, to the main chain, so any node can check what a shard claims without storing the whole shard.
Cross-shard transactions need extra care. If a user on shard A pays a user on shard B, the payment is split into two steps: shard A locks or deducts the amount, and shard B credits it once it sees proof that the first step happened. The main chain orders these steps so the same funds cannot be spent twice.
This two-step pattern is slower than a payment inside one shard, which is why designers try to keep related accounts on the same shard. A payment app, for example, would keep a user and their frequent contacts together where possible.
Finality also changes with sharding. A transaction is final when its shard confirms it and the main chain records the shard's summary, so users may wait for both steps before treating a payment as settled.
Security trade-offs of sharding
Security is the main trade-off in sharding, because splitting the network also splits its defences. A network with 1,000 validators is hard to attack, but a shard with only 50 of them is a smaller target.
Designers answer this in three ways. First, they assign validators to shards at random, so an attacker cannot choose which shard to attack. Second, they rotate the assignment often, so a group that controls one shard today loses it tomorrow. Third, they set a minimum number of validators per shard, so no shard is ever guarded by a handful of nodes.
Data availability is another risk. If a shard's data is not stored by enough nodes, a user cannot prove what happened in that shard. Networks handle this by requiring validators to publish their data and by letting other nodes sample it at random to check it is really there.
These defences add work, which is why sharding is usually added after a network has enough validators to split safely. A small network that shards too early can end up weaker than it was before.
Example (hypothetical): a payments chain with four shards
Example (hypothetical): a payments chain handles 400 transactions per second with one shard, and each node stores 200 GB of history. The team splits the chain into 4 shards and assigns accounts to shards by the first digit of the address.
Each shard now handles about 100 transactions per second, and each node stores about 50 GB, since it only follows one shard. A payment inside one shard confirms in the usual time, while a payment across shards takes two steps and confirms a little later.
The team checks the arithmetic: 4 shards at 100 transactions per second give 400 per second in total, the same as before, but each node now does a quarter of the work. To raise throughput they add validators and raise the per-shard limit, so the total grows as shards are added rather than staying flat.
The trade-off shows up in the validator count. With 800 validators split across 4 shards, each shard has 200, which the team judges enough. They decide not to split into 16 shards yet, because 50 validators per shard would be too few to trust.
Common mistakes
The most common mistakes with sharding are treating it as a free speed boost, ignoring cross-shard costs and splitting a network that is too small.
- Assuming linear scaling. Coordination between shards costs time, so four shards rarely give exactly four times the throughput.
- Ignoring cross-shard traffic. If most transactions cross shards, the two-step pattern wipes out the gain.
- Too few validators per shard. A shard guarded by a small group is easier to attack than the whole network.
- Forgetting data availability. A shard whose data cannot be checked cannot be trusted, however fast it is.
- Sharding too early. A young network should grow its validator set first, then split it.
Teams planning a chain that may need to scale often start with blockchain development advice on architecture, and compare scaling options before choosing sharding over alternatives such as rollups.
For background on how tokenised assets move across chains, see the earlier post on how tokenization works.
Key takeaways
- Sharding splits a chain into shards so each one handles a share of the work
- Each shard has its own validators, history and state, coordinated by a main chain
- Cross-shard transactions take two steps and are slower than payments inside one shard
- Random validator assignment and rotation protect small shards from attack
- A network needs enough validators before sharding makes it stronger, not weaker
Frequently asked questions
What problem does sharding solve?
It solves the throughput limit of a chain where every node checks every transaction. By splitting the work across shards that run in parallel, the network can handle more transactions while each node stores and checks less.
Is sharding the same as a layer 2 rollup?
No. Sharding changes the base chain itself by splitting it into parts, while a rollup processes transactions off the chain and posts a summary back. The two ideas can be combined, and many networks use both.
Do all blockchains use sharding?
No. Some chains scale by making blocks bigger or faster, and others use rollups. Sharding fits chains that want many parallel lanes of work, but it adds real complexity, so it is not the right choice for every network.
Why are cross-shard transactions slower?
A payment across shards needs two steps: the first shard deducts the amount and the second credits it once it sees proof. The main chain orders these steps so the same funds cannot be spent twice, which adds a wait.
Can a single shard be attacked?
A shard is a smaller target than the whole network, which is why validators are assigned at random and rotated often. With enough validators per shard and random assignment, taking over one shard is about as hard as attacking the full chain.
When should a chain add sharding?
When it has enough validators to split safely and its traffic is high enough to need parallel lanes. A small network should grow its validator set first, because splitting too early leaves each shard guarded by too few nodes.