Polkadot 的 VRF 如何实现随机性来对验证器进行 shuffle? [英] How does Polkadot's VRF achieve randomness to shuffle validators?

查看:58
本文介绍了Polkadot 的 VRF 如何实现随机性来对验证器进行 shuffle?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与使用 RANDAO(可能通过 VDF 增强)的以太坊相反,在 Polkadot 中,可验证随机函数 (VRF) 用于洗牌验证器并为某些插槽选择潜在的块提议者.随机性从何而来,即随机性具体是如何工作的?

Contrary to Ethereum which uses RANDAO (possibly enhanced with VDF), in Polkadot, a verifiable random function (VRF) is used to shuffle validators and select potential block proposers for certain slots. Where does the randomness come from, i.e. how does the randomness work specifically?

推荐答案

可验证的随机函数是一个函数,在伪代码中,可以这样表示:

A verifiable random function is a function that, in pseudocode, can be expressed like so:

(RESULT, PROOF) = VRF(SECRET, INPUT)

也就是说,对于一些秘密和一些输入(可以是公开的),结果是RESULTPROOF的元组,其中PROOF 可以被外部观察者用来验证 VRF RESULT 的合法性.

That is, for some secret and some input (which can be public), the result is a tuple of RESULT and PROOF, where PROOF can be used by outside observers to verify legitimacy of the VRF RESULT.

换句话说,进行VRF 滚动"会产生一个随机数并证明您获得了该随机数,而不仅仅是选择它.

In other words, making a "VRF roll" results in a random number and proof that you got that random number, and didn't just pick it.

每个时隙(大约每 6 秒)每个验证者都将运行 VRF 功能.SECRET 将是他们的 VRF 密钥,一个仅用于此目的的特殊密钥,由验证器生成并保密.INPUT 要么是来自创世区块的特定值(如果链中存在的 epoch 少于 2 个),要么是过去 2 个 epoch 中所有 VRF 结果的散列.

Every slot (approx. every 6 seconds) every validator will run the VRF function. The SECRET will be their VRF key, a special key to be used only for this, generated by the validator and kept secret. The INPUT is either a specific value from the genesis block if fewer than 2 epochs exist in the chain, or a hash of all the VRF results in the past 2 epochs.

一旦验证器执行了 VRF,RESULT 就会与协议定义的 THRESHOLD 值进行比较.如果 RESULT 小于 THRESHOLD,则验证器是该插槽的有效块提议者候选者.否则,验证器将跳过该槽.

Once a validator has executed the VRF, the RESULT is compared to a THRESHOLD value which is defined by the protocol. If the RESULT is less than THRESHOLD, the validator is a valid block-proposer candidate for that slot. Otherwise, the validator skips that slot.

这意味着可能有多个验证者为一个时隙生成候选块,在这种情况下,被其他节点拾取的块将占上风,只要它与根据 GRANDPA 确定性小工具的最新确定块.一个时隙不存在区块生产者的情况也是可能的,在这种情况下,AURA 共识将接管.AURA 共识基本上是一种回退,为每个区块选择一个随机验证者.它与 BABE 并行运行,并且仅当插槽没有区块生产者时才重要,否则将被忽略.

This means it is possible for there to be multiple validators who are block producing candidates for a slot, in which case the block that gets picked up by other nodes is the one that prevails, as long as it's on the chain with the most recent finalized block as per the GRANDPA finality gadget. A situation in which no block producers exist for a slot is also possible, in which case the AURA consensus will take over. The AURA consensus is basically a fallback which picks a random validator for each block. It runs in parallel to BABE, and only matters when a slot has no block producers, otherwise it's ignored.

这篇关于Polkadot 的 VRF 如何实现随机性来对验证器进行 shuffle?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆