ioppppp-960x426

分片(Sharding)技術解釋

精讀重點:比特幣(Bitcoin)和以太坊(Ethereum)區塊鏈網絡同樣存在處理速度偏慢的問題。分片(Sharding)技術簡單而言即是將網絡挖礦運算程序,劃分為小型的分片(shard),每個分片能夠並行處理交易。分片 = 速度!

A Solution for Blockchain Scalability

The lack of scalability, meaning the blockchain is only capable of processing a few transactions per second, is a major bottleneck for blockchain technology to garner mass adoption. However, with only 5 transactions per second (tps) for Bitcoin and 12 transactions per second for , existing blockchain solutions are not competitive to centralized solutions like Visa as a payments system and AWS as cloud computing service. For example, with the growing popularity of CryptoKitties in 2017, it slowed down the Ethereum network significantly with just a few thousand users. This is certainly a concern for companies using Ethereum to power their services.

Currently, every computer maintaining Bitcoin and Ethereum network are working on the same public ledger. Every node has to process every single transaction. Adding more computers into the network improves only security but not efficiency. A blockchain trilemma is none of the mentioned blockchains can achieve scalability, security, and decentralization at the same time.

Bitcoin and Ethereum are networks security is provided by Proof-of-Work. Hundreds of thousands of computers and machines that specialize in mining around the world help to process transactions. As a P2P cash system / a world computer, Bitcoin and Ethereum are both secure and decentralized. However, they are not immediately scalable. So to improve scalability, a lot of solutions have been suggested. For example, BitcoinCash (fork of Bitcoin) increases block size to allowing the processing of more transactions in each block, while Lightning Network (second layer) utilized off-chain payment channels to reduce the burden on the main chain. Sharding is one of the most popular approaches in development by different blockchain projects including Ethereum, Zilliqa, Quarkchain, etc.

分片(Sharding)技術解釋

Sharding is a horizontal partitioning, a database design principle, that separates database servers to spread the load. It’s introduction is for blockchain to solve scalability issues and latency issues.

Implementing sharding in the blockchain, means the network separates into different teams (shards). So the shards can process transactions in parallel. Similarly, each node will have only part of the data on the blockchain, not the entire information. As a result, more transactions can be processed at the same time. For example, imagine a network of 1,000 nodes; one may divide the network into 10 shards each composed of 100 nodes. The speed should increase by 10-fold.

1000 nodes can be divided into 10 shards (100 nodes each) to achieve 10x performance.

單片區接管攻擊(Single-Shard Takeover Attack)

實施分片的網絡會產生新的運作風險,包括單片區接管攻擊。

Single Shard Attack means one shard is fully controlled by malicious nodes and transactions may be modified.

防止單片區接管攻擊,應對方法是防止攻擊者將其雜湊運算能力(hash-power)集中到單一片區。

The way to assign nodes into different shards is the key. A random sampling of validators on each shard is suggested for Ethereum’s sharding solution. Sufficient randomness can ensure that validators will not know which shard they will get in advance. Also, it requires ⅔ of all validators on a shard to confirm the legitimacy of a block.

Apart from this, the minimum size of a shard should be under limits to reduce the possibility that malicious nodes that could assign to the same shard. With the above strategies, there will not be a sacrifice in the security of the network for the tremendous improvement on efficiency.

總結

Sharding is commonly used in a privately owned system. It can horizontally spread the load for a database or search engine. However, implementing it into a public blockchain is still a challenge. So, the nature of decentralization and transparency makes it difficult to maintain security. Apart from single shard attacks, developers face further issues such as cross-shard communication.

分片被視為解決區塊鏈運作難題最可行的解決方案之一。假如分片技術成功實施,網絡交易成本將會大幅降低,並且讓程式開發者可以建立更複雜的去中心化應用程式(DApp)。

相關資訊:

分片技術常見問題解答 - 以太坊
https://github.com/ethereum/wiki/wiki/Sharding-FAQs

Zilliqa設計(網絡分片)
https://blog.zilliqa.com/https-blog-zilliqa-com-the-zilliqa-design-story-piece-by-piece-part1-d9cb32ea1e65

以太坊分片概述和交易確定性問題
https://medium.com/@icebearhww/ethereum-sharding-and-finality-65248951f649

由Genesis Block 交易員Charlie撰寫
如有任何疑問,請電郵至 charlie.tsang@genesisblockhk.com / @GBCharlie