Sharding in blockchain. Adding highway lanes.

Gepubliceerd op 19 december 2021 om 10:00

Sharding is an incredibly important development in the blockchain domain. Sharding allows more transactions to be processed. This is because a problem with blockchain is that transactions are slow and relatively few transactions can be processed at once. Sharding was introduced in Ethereum 2.0 and should make it possible to process more transactions.

What is sharding? How does sharding relate to sidechains


Analogy: Checkout at the supermarket.

Suppose you are in the supermarket and you want to check out. You see that there is only 1 cash register manned by 1 person. As more people want to checkout, the queue gets longer and longer. If you join the back of the queue, it takes a long time before you can pay for your groceries. This is not efficient. It is much more efficient to open multiple checkouts so that the queue can be divided into several rows. This allows more people to be helped at the same time. This prevents congestion. The same thing happens with blockchain. If there are too many transactions to process, the blockchain cannot handle it. Thus, multiple ''cash registers'' must be opened to quickly process the amount of transactions. Sharding of blockchain should overcome this congestion of transactions.

What is the problem of blockchains?

As discussed in previous blogs, blockchain can process less transactions per minute than, for example, VISA.

Each node (computer/participant in the blockchain network) must verify that the transaction being verified on the network is correct. If a lot of transactions need to be processed at once, the more transactions need to be verified by the same network. This takes a lot of energy to process all transactions quickly, especially as the blockchain continues to grow in size.

Sharding ensures that the network becomes faster and more efficient as it grows. In theory, this means it can provide infinite scalability, but what exactly is sharding?

What is sharding?

In a nutshell, sharding is actually dividing the transactions between multiple cash registers. Sharding is a technology where transactions are distributed between all the nodes in the network. Sharding creates horizontal scaling. That is, multiple transactions can be processed and verified simultaneously as the network grows. The number of people who want to checkout are distributed among the other checkouts by sharding.

Sharding works as follows: suppose there is a blockchain network consisting of 1000 nodes. On this network, 2 transactions are to be processed. Without sharding, all the nodes would have to check these two transactions (1000 nodes process and check transaction 1 and transaction 2). As you can see, this takes a long time. With sharding, the work is divided. 500 nodes process and check transaction 1 and the other 500 nodes process and check transaction 2. The network is divided into 2 shards of 500 nodes each. This saves time. It now takes 2x less time than without sharding. Each time a shard agrees that the transaction is correct and legitimate, then the transaction is verified by miners on the blockchain.

Sharding and sidechains

The benefit of sidechains is really the same as sharding. Both ensure that transactions are processed and verified faster. Also, both techniques ensure that work is distributed. The problem with sidechains is that all these sidechains have to communicate with the main chain. More sidechains means that potentially more blockchains are also created that operate on the proof of work consensus mechanism (if a crypto is based on the Proof of Work). This causes more electricity that has to be used. If these blockchains operate on the proof of stake consensus, then the burden on the climate is a lot less.

If the communication between a sidechain and mainchain is not flawless, this can cause problems. Therefore, an important condition is that the lock up and release of crypto (by the federation) between the mainchain and sidechain goes without problems.

If sidechains can also only process 7 transactions per second, then 2 or 3 sidechains are not enough. VISA can process over 1700 transactions per second.

If the network grows larger, then sharding ensures that the transactions are distributed among the nodes. This ensures that the network can process transactions faster and more efficiently. Sharding has more potential than sidechains, although sidechains is also a good technique to take work off the mainchain so that it can focus on another parts of the blockchain.

Advantage and disadvantages of sharding

Advantages

- Sharding provides more flexibility to the blockchain. There is always enough capacity to process the amount of transactions.

- Sharding also speeds up the time to process a transaction. Having multiple ''checkouts'' also allows more and faster transactions to be processed.

- The main advantage of sharding is that it limits the damage done by malicious parties. This is because a malicious party only targets a single shard at all times. As a result, not the entire blockchain is compromised, but only a portion of it. This leads to the blockchain network being able to keep running.

Disadvantages

- Implementing a shard is not easy. Therefore, the implementation of a shard must be done carefully. If it is not done adequately, the chances of successful hacks are high.

- Sharding causes more electricity consumption if this blockchain is based on the proof of work consensus. More electricity usage creates more environmental strain.

Reactie plaatsen

Reacties

Er zijn geen reacties geplaatst.