【通读EOS白皮书】DPOS共识机制-01

in #cn7 years ago

今年币圈链圈一个重大事件就是:EOS在6.1日正式发布,但是还有非常多的人从未阅读过EOS技术白皮书。在此我准备做一个通读EOS白皮书系列,主要是翻译官方原文并加入个人解释的形式展现,水平有限,欢迎大家添加微信交流。
微信公众号:blockd-public
微信号微信二维码

共识算法 (DPOS)
EOS.IO软件采用了唯一可以满足区块链应用需求的去中心化共识算法 :委任权益证明机制 Delegated Proof of Stake (DPOS) 。在这种算法下,EOS.IO软件的区块链token持有人可以通过连续投票系统选择区块生产者,并且任何人都可以选择参与区块的生产,以及有机会按照所获得的总投票占比(与其他生产者的比例)生产区块。对于私有链,管理层可以使用token添加或删除技术人员。

解释:有点类似股份有限公司,你持有具有股权的股票,那么你就可以行使对应数量的股票权力。

EOS.IO软件严格按照3秒生成一个区块,并且任何一个给定的时间点只有一个被授权的区块生产者。如果区块未按规定时间产生,那么这个区块就会被跳过。当有一个或更多的区块被跳过之后,这个区块链就会有6秒甚至或更多的间隔。

解释:正常情况下,这个区块链中,每3秒会产生一个区块,如果这个生产者一正正常稳定的工作,那么他这条链一定是最长的。

在EOS.IO软件中,区块是由21个生产都轮流生产的。在每一轮生产开始时,唯一的21个生产者就被选定了。 每一轮,总得票最多的前20个生产者自动选定,而最后一位根据相对其他生产者得票数的比例选出。利用从区块时间获得的伪随机数,选定的区块生产者顺序被打乱。这种打乱的行为是确保生产者与其他生产者保持均衡的连通性。

解释:说明了区块生产者都是哪些以及通过什么方法选定的这些生产者。

如果一个区块生产者错过一个区块并且在最近的24小时没有产生任何区块,那么直到它们通知区块链准备再次生产块的时候才会被纳入考虑之中。通过最大限度减少(已经被证明为不可靠)区块丢失数量来确保网络操作的平稳。

解释:这样做移除了不正常节点的存在

一般情况下,DPOS机制的区块链不会经历任何分叉,因为区块生产者是合作产生区块而不竞争区块。如果发生分叉,共识会自动的切换到最长的链上。这种机制可以运行是因为区块添加到分叉链上的速率与共用该共识的区块生产者比例是正相关的。换句话,一个分叉链有更多的区块生产者,它的链长度增加的更快。除此之处,不允许有一个区块生产者同时在两个链中。如果区块生产者被抓到这样做很可能会被投票出局。这种双重生产的密码学凭证可以用于自动移除滥用行为的生产者。

解释:DPOS机制不产生分叉链的原因。其实不是不产生分叉链,只是这种机制下就把最长的链当做正确的区块链。

原文如下
Consensus Algorithm (DPOS)
EOS.IO software utilizes the only decentralized consensus algorithm capable of meeting the performance requirements of applications on the blockchain, Delegated Proof of Stake (DPOS). Under this algorithm, those who hold tokens on a blockchain adopting the EOS.IO software may select block producers through a continuous approval voting system and anyone may choose to participate in block production and will be given an opportunity to produce blocks proportional to the total votes they have received relative to all other producers. For private blockchains the management could use the tokens to add and remove IT staff.

The EOS.IO software enables blocks to be produced exactly every 3 seconds and exactly one producer is authorized to produce a block at any given point in time. If the block is not produced at the scheduled time then the block for that time slot is skipped. When one or more blocks are skipped, there is a 6 or more second gap in the blockchain.

Using the EOS.IO software blocks are produced in rounds of 21. At the start of each round 21 unique block producers are chosen. The top 20 by total approval are automatically chosen every round and the last producer is chosen proportional to their number of votes relative to other producers. The selected producers are shuffled using a pseudorandom number derived from the block time. This shuffling is done to ensure that all producers maintain balanced connectivity to all other producers.

If a producer misses a block and has not produced any block within the last 24 hours they are removed from consideration until they notify the blockchain of their intention to start producing blocks again. This ensures the network operates smoothly by minimizing the number of blocks missed by not scheduling those who are proven to be unreliable.

Under normal conditions a DPOS blockchain does not experience any forks because the block producers cooperate to produce blocks rather than compete. In the event there is a fork, consensus will automatically switch to the longest chain. This metric works because the rate at which blocks are added to a blockchain chain fork is directly correlated to the percentage of block producers that share the same consensus. In other words, a blockchain fork with more producers on it will grow in length faster than one with fewer producers. Furthermore, no block producer should be producing blocks on two forks at the same time. If a block producer is caught doing this then such block producer will likely be voted out. Cryptographic evidence of such double-production may also be used to automatically remove abusers.

Sort:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://steemit.com/eos/@eosio/eos-io-technical-white-paper