NEAR VISION #2: What is Sharding?

What does sharding exactly mean?

NEAR insights
3 min readJul 5, 2021

In a database, you sometimes have to deal with large bulky data. This dramatically hinders performance and throughput and it makes the entire process extremely inefficient. This is where sharding comes in.

Sharding does a horizontal partition of your database and turns into smaller, more manageable tables.

Example of database sharding

So, why a horizontal partition and not a vertical partition?

Consider this table:

Now, if we were to partition this table vertically:

See that?

Because of the partition, the table turns into two completely different tables.

As opposed to that, what happens when the table gets partitioned horizontally:

Do you see what happens? When you vertically partition a table they tend to become two completely different tables altogether.

However, if we were to partition them horizontally:

See that?

A horizontal partition turns the database into smaller tables of the same database. These smaller databases are called shards.

How does Sharding Help Blockchain?

As we have seen so far, as more and more nodes enter the Ethereum and Bitcoin ecosystem, the entire consensus and verification process takes even more time. Now, what will sharding do to help this?

Sharding is going to break the global state of the blockchain into tinier more manageable shards.

What happens on shard activation?

  • The state gets split into shards
  • Every single unique account is in one shard, and the accounts in that shard will only transact with the other accounts in the same shard.

In simplistic terms, imagine this scenario. There is a hypothetical network with three nodes- A, B, and C and they have to verify data T. The data T is broken down into three shards T1, T2, and T3. Instead of all these nodes working on T as a whole, they can individually work on a shard at the same time. As you can see the amount of time you are saving is exponential.

Unlike a lot of other sharding approaches, which still require nodes to be run on increasingly complex hardware (reducing the ability of more people to participate in the network), NEAR’s technique allows nodes to stay small enough to run on simple cloud-hosted instances.

--

--

NEAR insights

Insights, news and information on NEAR Ecosystem, focusing on NEAR Protocol’s Technology