美文网首页区块链研习社
EOS技术白皮书翻译1-DPOS

EOS技术白皮书翻译1-DPOS

作者: 冰茶solo | 来源:发表于2017-12-07 15:23 被阅读139次

    共识算法DPOS

    EOS.IO系统利用唯一的分布式共识算法DPOS(Delegated Proof of Stake)来满足区块链应用的性能需求。这种算法下,使用EOS.IO软件的代币持有者可以通过持续的批准投票系统选择区块的生产者,任何人都可以参与一个区块的生产,根据他们获得的投票比例获得等比例的生产区块的机会。对于私有链,管理者可以利用代币增删IT人员。

    EOS系统确保每3秒产生一个区块,且在任何时间点只有一个节点被授权生产区块。如果区块没有按照计划时间产生,则该时间区间内的区块会被略过。当多于1个的区块被略过,区块链中就会产生6秒或更多的空白。

    EOS系统的区块产生以21个为一轮,每一轮的开始会选出21个节点生产区块链。获得投票授权的前20个节点自动成为每轮的生产者,最后一个节点的选择取决于他们相对于其他生产者获得投票的比例。被选中的生产者会根据由区块链时间产生的伪随机数重新洗牌。这种洗牌是为了确保生产者之间保持平衡的连接性能。

    如果一个生产者错过了一个区块,且在过去24小时内没有生产任何区块,会被移除直到其重新通知区块链愿意再次开始生产区块。这是通过不列入那些被证明不可靠的节点来最小化区块缺失以确保网络运行的平稳。

    正常情况下DPOS区块链是不会分叉的,因为生产者是合作生产区块而不是竞争关系。如果出现了分叉,共识会自动转入最长的链。这个指标是有效的,因为块被添加到分叉链的速度与拥有相同共识的区块生产者的百分比直接相关。换句话说,一个拥有更多生产者的分叉,在链长度上会增长的更快。而且,生产者不可以同时在两个分叉上生产区块。如果生产者被发现这样做,该生产者则会被踢出。这类双重生产的密码学证据会被用来自动清除违规者。

    交易确认

    典型的DPOS区块链100%由区块生产者参与,一个交易经过广播后平均1.5秒就可以99.9%的认为可靠。

    也存在一些意外情况,诸如软件故障、网络拥堵或者有恶意的区块链生产者创建两个或更多分叉。为了绝对确保一个交易不可逆转,一个节点可以选择等待21个生产节点中的15个确认。根据EOS系统的设置,正常情况下这将会需要平均45秒钟。默认情况下,所有节点都会认为由21个生产节点中的15个确认的块不可逆转,并且不会切换到排除这种块的分支,不管长度多少。

    在一个分叉开始的9秒内,一个节点就可以警告用户其很有可能处于一个较短的分叉。经过2次连续丢失区块后,有95%的可能性处于较短分叉。3次连续丢失区块后可以99%确认处于一个较短的分叉。有可能产生一个鲁棒的预测模型,利用有关错过哪些节点的信息,最近的参与率和其他因素来快速警告运营商有什么问题。

    对这种警告的回应完全取决于商业交易的性质,但最简单的回答是等待15/21确认,直到警告停止。

    交易委托证明TaPOS(Transaction as Proof of Stake)

    EOS系统要求每一个交易包含最近区块头的哈希值。这个哈希值有两个作用:

    1. 防止一个交易在一个不包含参考区块的分叉上双花;
    2. 向网络表明一个特定的用户和他们的委托是在一个特定的分支上。

    随着时间的推移,所有用户最终都会直接确认区块链,这使得难以伪造假冒链,因为假冒伪劣将无法将合法链中的交易移交。

    原文

    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.

    Transaction Confirmation

    Typical DPOS blockchains have 100% block producer participation. A transaction can be considered confirmed with 99.9% certainty after an average of 1.5 seconds from time of broadcast.

    There are some extraordinary cases where a software bug, Internet congestion, or a malicious block producer will create two or more forks. For absolute certainty that a transaction is irreversible, a node may choose to wait for confirmation by 15 out of the 21 block producers. Based on a typical configuration of the EOS.IO software, this will take an average of 45 seconds under normal circumstances. By default all nodes will consider a block confirmed by 15 of 21 producers irreversible and will not switch to a fork that excludes such a block regardless of length.

    It is possible for a node to warn users that there is a high probability that they are on a minority fork within 9 seconds of the start of a fork. After 2 consecutive missed blocks there is a 95% probability a node is on a minority fork. With 3 consecutive missed blocks there is a 99% certainty of being on a minority fork. It is possible to generate a robust predictive model that will utilize information about which nodes missed, recent participation rates, and other factors to quickly warn operators that something is wrong.

    The response to such a warning depends entirely upon the nature of the business transactions, but the simplest response is to wait for 15/21 confirmations until the warning stops.

    Transaction as Proof of Stake (TaPoS)

    The EOS.IO software requires every transaction to include the hash of a recent block header. This hash serves two purposes:

    1. prevents a replay of a transaction on forks that do not include the referenced block; and
    2. signals the network that a particular user and their stake are on a specific fork.

    Over time all users end up directly confirming the blockchain which makes it difficult to forge counterfeit chains as the counterfeit would not be able to migrate transactions from the legitimate chain.

    相关文章

      网友评论

        本文标题:EOS技术白皮书翻译1-DPOS

        本文链接:https://www.haomeiwen.com/subject/dimdixtx.html