Rapidchain: Scaling Blockchain via Full Sharding
1 Abstract
Rapidchain是采用全分片结构的区块链系统,全分片是指对Computation,Storage和Communication分片,Rapidchain的提出,目的是解决Bitcoin中的低TPS,低拓展性和低存储能力的瓶颈。但是作为一种全分片系统,系统运行中存在着许多挑战,例如跨分片交易,跨分片共识以及如何克服双花等,Rapidchain对这些问题提出了解决措施。
2 Background
目前传统区块链系统(Bitcoin、Ethereum等)低吞吐量,低拓展性,高延迟,低存储性能,女巫攻击,并且针对目前已有的分片系统中的强假设性和O(n^2)即线性的交互量转化为O(n)。
3 Question and Solution
Question:
- O(n^2) 交互问题(PBFT,或者类似的BFT方案)
- 之前系统仅仅容错1/4 (可能看的几篇论文都比较新,一般都是1/3容错)
- 共识算法的效率低
- 跨链交易的安全性问题,主要是处理UTXO模型的多输入多输出(容易引发『双花问题』)
- 应对adaptor attack(由于分片缩小了每个委员会规模,所以容易出现针对某个特定分片的攻击)
- 中心化引导问题(传统区块链采用创世区块(其实就是提供几个可信节点))
Solution
for 1. 引入leader节点,从而将prepare和commit的过程合并,缩减为leader向其他节点转发消息,其他节点收到消息并广播,然后如果可信节点收到多个版本的来自leader签名的消息,就证明当前leader是拜占庭节点,并且会拒绝广播;如果可信节点没有收到多个版本的leader消息,就证明当前leader是非拜占庭节点。
for 2. 部分同步网络下的1/3的容错
for 3. for1中谈论了
for 4. 针对UTXO模型提出了output-committee和input-committee
for 5. reconfiguration
for 6. 采用bootstramp进行去中心化引导
4 Rapidchain
4.1 Overview
Bootstrap—Consensus—Reconfiguration—Consensus—Reconfiguration…
分为这几个重复的过程,不断的进行Reconfiguration,为了防止adaptor attack。规定了Consensus和Reconfifuration为一个Epoch。
- First epoch: Bootstrap a reference committee
- Creates epoch randomness
- Creates a reconfiguration block in every epoch
- Epoch randomness
- Samples Sharding committtees(first epoch)
- New nodes join the system
- Re-origanize existing committee
- UTXO midel
- Each user sends its tx to some arbitary node
- tx is routed to the output committee, Cout
- Cout verifies the inputs and adds tx to a block
- Cross-Shard verification
- Verify input transactions of tx
- Batch requests based on input committees
- Forward them via an inter-committee routing protocol—Kademlia Protocol
4.1 Bootstrap Process
主要目的:Establish PKI(Public Key Infrastructure) without inital randomness, CRS, etc ,这个过程的目的其实是在不利用任何随机数的前提下,完成对随机数产生器,即reference committee建立,进而能根据这个委员会完成对其它委员会的创建过程。(我理解这个过程是通过不断的查找和选举过程找到若干个初始的可信节点)
建立过程:
- 构造sampler graph,如Level 0和level 1所示,构成一个随机二分图,一部分是nodes,一部分是groups。
- Subgroup election。所有节点进行计算,每个group内哈希值最小的选为subgroup成员。
- Subgroup Peer Discovery。被选中节点发送消息告知全部节点。
- Committee Formation。重复上述过程直到选出root group。
4.2 Consensus in Committee
- Idea: Gossip the block, then agree on the hash of the block
- Up to 1/2 malious nodes
- Gossiping a 2M block in a 250-node committee takes 12sec.
For Large Block(拆分过程中采用了EC码,保证了数据的可还原性)
We use IDA(Information Disperal Algorithm)
- Encode M into k chunks M1, … ,Mk
- Compute a Merkle tree over chunks M1, … ,Mk
- Give each neighbor k/d chunks along with Merkle proofs
- d is the node degree
- Consensus over Merkle hash
For Join Node- Intar-Committee Routing Overlay network — Kademlia Protocol
- Cuckoo rule
- Assign the new node to a random shard
- Evict k node from the shard
Inter-Committee
4.3 Cross-Shard Transaction
- UTXO midel
- Each user sends its tx to some arbitary node
- tx is routed to the output committee, Cout
- Cout verifies the inputs and adds tx to a block
简单的解释一下这个过程:首先,通过reference committee产生一个randomness,利用randomness对节点进行随机选取,选中的节点所在的委员会将作为input committee(这个我不是很确定?可以做一下讨论),它回去根据tx ID路由查找对应的分片(图中Transaction(ID:TX9)),分片存储这个tx,并且生成一个可用于验证输入和将交易写入区块的Cout,完成整个过程。
如何克服双花的:同一笔tx只能作为唯一的输入,并且分片是按照tx ID存储的,最后又通过output committee对其进行验证。
4.4 Committee Reconfiguration
这个过程主要是为了抵抗adaptor attack,采用cuckoo rule
- Assign the new node to a random shard
- Evict k node from the shard
核心是随机分配,对单个委员会而言,并不是对其进行完全重组。
5 reference
[1]https://eprint.iacr.org/2018/460.pdf
[2]https://www.youtube.com/watch?v=h1WpShwEtwE
[3]https://blog.csdn.net/shuqian6246/article/details/84658443