参与评论
收藏
BM与V神再次交锋 EOS针对DPOS BFT共识机制做出改进
来源: IMEOS
2018-05-17 10:08
本文翻译自BM在Medium的文章,比较了当前的几种主流共识算法,论述了在DPOS在拜占庭容错机制下...

本文翻译自BM在Medium的文章,比较了当前的几种主流共识算法,论述了在DPOS在拜占庭容错机制下的优势和可用性,原文见https://medium.com/@bytemaster/dpos-bft-pipelined-byzantine-fault-tolerance-8a0634a270ba

原文翻译

There are two general blockchain consensus systems: those that produce unambiguous 100% finality given a defined set of validators and those which do not provide 100% finality but instead rely on high probability of finality.

有两种普遍的区块链共识系统:在给定一系列验证者下,达成100%的确认;依赖于大概率,但不保证100%的最终确认。

The first generation blockchain consensus algorithms (Proof of Work, Proof of Stake, and BitShares’ Delegated Proof of Stake) only offer high probability of finality that grows with time. In theory someone could pay enough money to mine an alternative “longer” Bitcoin blockchain that goes all the way back to genesis.

第一代区块链共识算法(PoW,PoS,以及BitShares的DPoS)仅提供了随时间增长的大概率的确定性。从理论上讲,有人可以支付足够的钱来分叉一条更长的比特币区块链,分叉的链甚至可以追溯到创世区块。

More recent consensus algorithms, whether HashGraph, Casper, Tendermint, or DPOS BFT all adopt long-established principles of Paxos and related consensus algorithms. Under these models it is possible to reach unambiguous finality under all network conditions so long as more than ⅔ of participants are honest.

最近的共识算法,无论是HashGraph,Casper,Tendermint还是DPOS BFT都采用Paxos早已经确定的原则和相关共识算法。在这些模式下,只要有超过2/3的参与者是诚实的,就可以在所有网络条件下达成确定性的共识。

Objective and unambiguous 100% finality is a critical property for all blockchains that wish to support inter-blockchain communication. Absent 100% finality, a reversion on one chain could have irreconcilable ripple effects across all interconnected chains.

对于所有希望支持跨链通信的区块链来说,客观而明确的100%共识确认是一个关键属性。如果没有100%的确认,一条链上的重复,可能会在所有相互关联的区块链上产生不可调和的连锁反应。

The abstract protocol for these more recent protocols involves:

1.Propose block

2.All participants acknowledge block (pre-commitment)

3.All participants acknowledge when ⅔+ have sent them pre-commitments (commitment)

4.A block is final once a node has received ⅔+ commitments

5.Unanimous agreement on finality is guaranteed unless ⅓+ are bad and evidence of bad behavior is available to all

▲Abstract BFT Life Cycle

一些最新共识协议的摘要包括以下几点:

1.提案区块

2.所有参与者承认这个区块(处于“预提交”状态)

3.当⅔的区块已经发送给参与者“预提交”状态消息, 所有参与者承认这个“预提交”(处于已提交状态)

4.一旦节点收到⅔+的“已提交”消息,这个区块就被确定下来。

5.最终被确定下来的明确协议是有保证的,除非⅓+节点的诚信度不高,并且所有人都看到不良行为记录。

What makes the various consensus protocols different are:

1.Deciding when and who gets to propose a block

2.Deciding how commitments are logged & communicated

3.How byzantine behavior is documented

4.Punishment for byzantine behavior

使各种共识协议的区别在于:

决定何时和何人去提案一个区块。

决定如何记录和交流保证承诺

拜占庭行为的记录方式

拜占庭行为的惩罚方式

 

Some of these differences are political and some of them are technical in nature.Examples of political differences include:

1.DPOS elects the set of proposers & validators based upon stake

2.Casper relies on proof-of-work to determine when and who and when gets to propose and bonded-stake-weight to determine who the validators are

3.DPOS punishes objective and subjective bad behavior by voting people out

4.Casper only punishes objective bad behavior by slashing bonds

其中一些差异是政治性的,其中一些差异性是技术性的。政治差异的例子包括:

1.DPOS根据权益选举一组提案者和验证者

2.Casper依靠PoW来确定何时和何人提案一个区块,以及用抵押权益权重来决定谁是验证者。

3.DPOS通过票选出局来惩罚主观和客观的不良行为

4.Casper通过削减保证金,而且仅惩罚客观的不良行为

Under normal conditions, the political differences make no day-to-day impact on the experience of users relying on the consensus mechanism to order and finalize transactions. The threshold for malicious behavior is so high and the penalties so great that for all practical purposes it doesn’t happen.

It is the technical differences in the protocols that give rise to real-world impact on user experience. This includes things such as latency until finality, degrees of finality, bandwidth, and proof generation / validation overhead.

在正常情况下,政治分歧不会对依靠共识机制订购和确定交易的用户的体验产生日常影响。恶意行为的门槛如此之高,惩罚如此之大,以至于所有的实际目的都不会发生。

协议的技术差异会对用户体验产生真实的影响。这包括直到确认的延迟,确认的程度,带宽以及证明生成/验证的开销等事情。

The simplest possible algorithm has everyone reach consensus on one block before any progress can be made on the next block. This involves every participant sending every other participant two messages per block. In a global network the speed of light limits the practical latency from time of proposal to the time a node receives ⅔+ commit messages to about one second (500ms round trip latency * 2 round-trips). All networks I have observed seem to be in the 2–3 second latency camp. These simple protocols also have a “timer” which introduces a new proposal if no consensus can be reached over the validity of the current proposal. This timer is generally longer than the expected confirmation time.

Protocols like Casper attempt to minimize the overhead by relying on proof-of-work for short-term consensus and only reaching finality over every 100th block (checkpoint). This means Casper-based chains reach finality every 20 to 30 minutes.

最简单的算法是每个人都可以在一个区块上达成共识,然后才能在下一个区块上取得进展。这意味着,每一个参与者给其他参与者在每个区块上发送两条信息。

在全球网络中,光速限制了实际的延迟,从提案的时间到节点接收⅔+提案消息的时间大约为1秒(500ms往返延迟* 2次往返)。

我观察到的所有网络似乎都在2-3秒的延迟阵营中。这些简单的协议也有一个“计时器”,如果没有就当前提案的有效性达成共识,则会引入新的提案。该计时器通常比预期的确认时间长。

像Casper这样的协议试图减小开销,它的方案是依靠工作证明来达到短期共识,并且每第100个区块(即检查点)就会达成最终的确定性。这意味着基于Casper的区块链每20到30分钟才能达成最终的确定性。

DPOS BFT Pipeline Consensus

Modern Delegated Proof of Stake with BFT as implemented in EOSIO uses a pipelined approach to deliver the proposal, pre-commitment, and commitment messages. This means under normal operating conditions, every block advances the finality of one block and this is achieved by only requiring one proposal per time slot. In other words, the cost of DPOS with BFT finality in terms of signature verifications, hash calculations, network bandwidth, etc., is equal to the cost of older DPOS systems that relied upon eventual consistency and the longest chain rule similar to Bitcoin and Ethereum (pre Casper).

DPOS BFT 流水线化的共识机制

如今在EOS系统中所采取的的基于拜占庭容错的DPOS共识机制使用了一种流水线的方式来传输提案、预提交、已提交这三个状态的消息。这意味着在正常的情况下,每一个区块都会促进区块的确定性,并且这是通过每个时间空档仅需要一个提案来实现的。换而言之,基于拜占庭容错的DPOS的传输机制,无论是在签名验证、哈希计算还是网络带宽等方面,都与之前的DPOS体系是一样的,他们都基于最终的一致性和最长链法则,有点类似比特币和以太坊。

Only DPOS BFT can efficiently scale to an unlimited number of validators (at cost to latency). Other protocols grow the resource requirements for finality with O(2N) the number of participants as everyone must talk to everyone twice for each block or checkpoint. With more parties involved,more signatures, network overhead, and storage are required and there is greater latency.

只有DPOS BFT可以高效的扩展至无限的验证者数量(基于延迟成本)。其他协议以0(2N)个参与者的数量增加了对达成确定性的资源需求,因为对于每一个区块或检查点来说,每个人都必须与其他人交流两次。有了多方参与,就需要更多的签名、网络成本和存储空间,这会造成巨大延迟。

 

Assuming DPOS BFT with two second block interval and 21 producers, finality can be reached after 1 minute, but a new block reaches finality every two seconds. This is achieved by pipelining the BFT confirmations. Platforms like EOSIO produce blocks every 500ms, but only rotate proposers every 12 blocks. This means BFT finality takes about 3 minutes based upon pure BFT DPOS block confirmations. The end result is 10x faster than Casper for finality for individual blocks, but a new block reaches finality every two seconds versus every 30 minutes.

假设在DPOS BFT机制下出块间隔为两秒并具有21个生产者,这保证可以在1分钟后可以达成最终确认,但是新的区块每两秒达成最终确定性。 这是通过流水线化BFT确认实现的。 像EOSIO这样的平台每500毫秒产生一个区块,但是只能每12个区块进行一次更迭。 这意味着基于纯粹的BFT DPOS区块确认,最终需要大约3分钟。 结果就是以比Casper快10倍的速度获得单个区块,一个新区块每两秒就可以完成最终的确定性,比Casper漫长的三十分钟快多了。

▲DPOS BFT w/ optional Low-Latency Confirmation

DPOS Hybrid Pipeline / Realtime BFT

There are many applications where a three minute time for finality is undesirable and/or the DPOS proofs for light clients for a particular block are larger than desired. In this case, a blockchain can make the design choice to do a BFT pre-commit & commit message over every pending block. This gives DPOS-BFT chains finality latency of 1–2 seconds at the expense of the additional network overhead, storage requirements, and CPU usage. Unlike protocols such as Tendermint/Cosmos there can be multiple proposals “in-the pipeline” at the same time. It is even possible that some blocks never receive the “real time” commitment due to network splits, but never the less they are eventually indirectly confirmed.

DPOS混合流水线化/即时拜占庭容错

有许多应用程序需要三分钟的时间才能达成确定性,并且特定区块的轻客户端DPOS证明比预期的要大。 在这种情况下,区块链可以让设计人员选择在每个待形成区块上执行BFT预提交和提交消息。 这会使DPOS-BFT链的终端延迟为1-2秒,但会增加网络开销、存储要求和CPU使用率。 与Tendermint / Cosmos等协议不同,同时可以有多个“在线”提案。 由于网络分裂,有些区块甚至有可能从未收到“实时”消息,但他们最终会被间接确认。

With the hybrid approach light clients can validate a block with 15 signatures and/or use more advanced cryptographic techniques to merge commit signatures into a single signature. Without the commit messages light clients can still reach BFT finality using a number of consecutive block headers.

使用混合方法,轻客户端可以验证具有15个签名的区块或使用更高级的加密技术将提交签名合并到单个签名中。 如果没有提交消息,轻客户端仍然可以使用多个连续的块头来达到BFT的确定性。

 

Degrees of Security

It has long been understood that for many applications, such as blog posts and social media voting, waiting for 100% finality is overkill when 99.999% finality can be achieved in less than a second. Protocols like Casper give users the option of relying on Proof of Work confirmations when waiting for the next checkpoint is overkill.

安全性

人们早就知道,对于很多应用程序,比如博客文章和社交媒体投票,等待100%的确定性是浪费时间的,而99.999%的确定性可以在不到一秒内完成。 像Casper这样的协议,让用户在等待下一个检查点时依赖工作量证明来确认是不值得的。

Some full nodes may not care to process the overhead of all BFT pre-commit/commit messages when all they require is blockchain state. It is enough to know that the block producers (proposers/validators) are reaching real-time consensus and that their blockheaders eventually prove BFT consensus a couple minutes later.

当所需要的是区块链状态时,一些完整的节点可能并不在意处理所有BFT预提交/提交消息的开销。 知道区块生产者(提议者/验证者)正在达成实时共识,并且他们的区块头最终在几分钟后达成BFT共识,这已经足够了。

Each consensus algorithm makes certain choices for users and degrades to less-secure variations in different ways. 

Tendermint/Cosmos/Ripple don’t give users a choice to operate with anything less than full finality. Ethereum gives users a fall-back to proof-of-work, and DPOS-BFT falls back to the original DPOS guarantees.

每一个共识算法都会为用户作出明确的选择并通过不同的方法消除不安全的可变因素。

Tendermint / Cosmos / Ripple不允许用户选择使用未经完全确定的任何事物。 以太坊使得用户退回到PoW的时代,而DPOS-BFT则可以回归到最初的DPOS证明机制。

It is even possible to layer the Casper checkpoint algorithm with slashing conditions on top of the DPOS BFT block proposal system. Such an approach would create multiple independent validator sets with both political and economic incentives for good behavior.

在DPOS BFT区块提案系统之上,甚至可以通过削减保证金的机制将Casper检查点算法分层。 这种方法将创建多个独立的验证者集合,对于良好的行为既有政治激励又有经济激励效果。

User Experience

Delegated Proof of Stake with BFT optimizes the nominal case while being no-worse in the worst case. Under normal conditions, elected block producers are trusted public figures with legal liabilities and highly reliable nodes. The probability that a produced block will reach finality is already 99.999% which means that the average user gets near-certain finality in under a second. This is reliable enough for almost all day-to-day financial transactions. Larger financial transactions, such as buying a car, merely require the user to wait a few seconds for absolute finality.

用户体验

DPoS机制结合BFT不仅优化了常规情况,并且能在最坏的情况下及时挽救。在常规情况下,当选的节点是被公众信赖的,肩负法律责任且高度可靠。最终能够成功出块的概率早已达到了99.999%,这意味着每个用户在一秒内就能获得基本确定的结果,完全能够满足所有的日常交易。对于诸如购买汽车等这类较大型的金融交易,用户也只需要等待几秒钟就能完成交易。

Each user can decide for themselves how much overhead and/or delay they wish to incur and how big the proofs they want to generate for inter-blockchain communication, whereas other protocols do not give users that choice.

每个用户都可以自行决定开销数目或者他们想要搁置的、以及区块链间通信交流中他们想要得到的证明,而其他协议不会给用户这种选择。

Conclusion

All modern consensus algorithms that follow the BFT consensus principles originally introduced the 1980’s can reach a secure and final state in the worst-case of a partitioned network with ⅓ byzantine participants. Only DPOS BFT and EOSIO is optimized for the 99.999% case of 100% honest nodes without network partitions. DPOS BFT achieves this optimized performance without sacrificing the security guarantees that other protocols provide.

所有遵循BFT共识原则的现代共识算法最初都是于二十世纪八十年代引入的,可以在分区网络的最坏情况下保证三分之一的“拜占庭”参与者达到最终安全状态。 只有DPOS BFT和EOSIO实现了对99.999%诚实节点进行优化,而无需网络分割。DPOS BFT无需牺牲其他协议提供的安全保证就实现了此项优化性能。

 

参与评论
收藏
来自主题:
柚子EOS
相关资讯
参与评论