预言机参与 (Oracle Participation)
通过预言机参与提供资产定价 Providing asset pricing via oracle participation
总结 (Summary)
Sei has an Oracle module to support asset exchange rate pricing for use by other modules and contracts. When validating for the network, participation as an Oracle is expected and required in order to ensure the most reliable and accurate pricing for assets.
Sei 有一个预言机模块,来支持资产汇率定价,供其它模块和合约使用。在对网络进行验证时,预计并需要作为预言机参与,确保对资产进行最可靠和准确的定价。
For oracle pricing, the voting rounds have several steps to ensure integrity and consensus of pricing data prior to accepting the exchange rates as the source of truth. In each voting period, there are two aggregation steps that oracles must participate in.
对于预言机定价,投票轮次有几个步骤,进而确保在接受该汇率作为真实来源之前,定价数据真实且有共识。在每个投票周期中,有两个聚合步骤是预言机必须参与的。
For now, each voting window is 2 blocks long 目前,每个投票窗口有 2 个区块长
The prevote step is a step where a validator provides their oracle pricing submission during voting window X
for the next voting window X+1
. In this prevote step, the validator hashes their proposed exchange rates to prevent other validators from simply copying that validator's votes.
预投票步骤,是验证者在投票窗口 X
期间为下一个投票窗口 X+1
提供预言机定价而提交的步骤。在这个预投票步骤中,验证者对他们提议的汇率进行哈希处理,以防止其他验证者简单地复制该验证者的投票。
In the vote step for window X
, the validator provides their proposed exchange rates for the current window. These are hashed and compared with the prevotes from window X-1
to ensure that the voted values haven't changed across the voting window. At the end of the voting period, all of the exchange rate votes are accumulated and a weighted median is computed (weighted by validator voting power) to determine the true exchange rate for each asset.
在窗口 X
的投票步骤中,验证者为当前窗口提供其建议的汇率。这些被哈希化并与来自窗口 X-1
的预选票进行比较,以确保投票值在整个投票窗口中没有改变。在投票期结束时,累积所有汇率投票并计算加权中位数(由验证者投票权加权),来确定每个资产的真实汇率。
There are penalties for non-participation and participation with bad data. Validators have a miss count that tracks the number of voting windows in which a validator has either not provided data or provided data that deviated too much from the weighted median. In a given number of voting periods, if a validators miss count is too high, they are slashed as a penalty for misbehaving over an extended period of time.
不参与和用不良数据参与都会受到处罚。验证者有一个“丢失”的计数,用于跟踪验证者未提供数据或提供的数据偏离加权中位数太多的投票窗口之数量。在给定数量的投票周期内,如果验证者“丢失”计数太高,他们将被削减(质押的代币),作为对长时间行为不当的惩罚。
Penalties are slashing of 0.01% if <5% of votes are valid in a one week period. Allowed deviation from median is ±1%
如果在一周内有 <5% 的选票有效,则罚款为 0.01%。与中位数的允许偏差为 ±1%
步骤 (Steps)
聚合投票 (Aggregate Prevote)
In this step, validators need to provide proposed exchange rates for the next voting window. Validators should provide exchange rates for denominations in VoteTargets
(More info on VoteTargets located here). Exchange rates are provided as a comma-separated list of denominations and their exchange rates to the base denomination.
在这一步中,验证者需要为下一个投票窗口提供建议的汇率。验证者应在 VoteTargets
中提供面额汇率(有关 VoteTargets 的更多信息位于 此处)。汇率以逗号分隔的面额列表加上对基本面额的汇率提供。
汇率表示示例 (Example Exchange Rates Representation)
CLI示例 Example
聚合投票 (Aggregate Vote)
In this step, validators need to provide the exchange rates for the current voting window. These exchange rates need to match the exchange rates provided in the prevote during the previous voting window. Exchange rates are provided as a comma-separated list of denominations and their exchange rates to the base denomination.
在这一步中,验证者需要提供当前投票窗口的汇率。这些汇率需要与上一个投票窗口期间预投票中提供的汇率相匹配。汇率以逗号分隔的面额列表及其对基本面额的汇率提供。
汇率表示示例 (Example Exchange Rates Representation)
CLI示例 Example
运行预言机脚本 (Running Oracle Scripts)
There is an oracle sidecar that can be configured to run as a systemd service to provide a more robust and configurable solution to providing oracle asset prices. The sidecar can be built with make install-price-feeder
from the sei-chain repo dir, and needs an associated config file that specifies the account from which to send oracle votes along with additional configuration information such as assets to provide and providers to use for pricing information.
有一个预言机边车,可以配置为作为 systemd 服务运行,进而提供更强大和可配置的解决方案来提供预言机资产价格。边车可以使用 sei-chain repo 目录中的make install-price-feeder
构建,并且需要一个关联的配置文件来指定发送预言机投票的帐户,和其它配置信息,例如要提供的资产和提供者用于定价的信息。
An example config file is located here: https://github.com/sei-protocol/sei-chain/blob/master/oracle/price-feeder/config.example.toml
示例配置文件位于此处:[https://github.com/sei-protocol/sei-chain/blob/master/oracle/price-feeder/config.example.toml](https://github.com/ sei-protocol/sei-chain/blob/master/oracle/price-feeder/config.example.toml)
Validators will need to update that with their own addresses and keyring information, and update the currency pairs to include assets that the oracle module what whitelisted.
验证者需要用他们自己的地址和密钥环信息更新它,并更新货币交易对,来纳入预言机模块列入白名单的资产。
Additionally, here is an example of a systemd service file for running the oracle sidecar:
此外,这里还有一个用于运行预言机边车的 systemd 服务文件示例:
联合投票 (Combined Vote)
For simplicity for validators providing oracle pricing and to free up block space, we also provide a combined vote tx to perform a vote for the current window followed by a prevote for the next window. This makes it simpler to ensure that a validator doesn't need to sign multiple transactions in order to provide oracle pricing for a given vote window.
为了简化提供预言机定价的验证者并释放区块空间,我们还提供组合投票 tx 来对当前窗口进行投票,然后对下一个窗口进行预投票。这使得确保验证者不需要签署多个交易来为给定的投票窗口提供预言机定价,变得更加简单。
CLI示例 Example
支线委托 (Feeder Delegation)
If you want to participate as an oracle from a different account, you can set that up by setting a feeder for your validator. This will allow the feeder account to perform oracle votes on the validator behalf as well.
如果你想从不同的帐户作为一个预言机参与,你可以通过为你的验证器设置一个支线来完成。这将允许支线账户也代表验证者执行预言机投票。
示例 (Example)
弃权投票 (Abstaining from Voting)
We also allow validators to abstain for participating in oracle pricing. In order to be counted as abstain and not price miss for a vote window, the validator needs to not provide any oracle related votes in that given vote window. If they do this, then they are counted as abstained instead of missed for the window. The advantage of this is that a validator can avoid participating in oracle pricing if they are not confident in their ability to provide accurate pricing data. The consequence is that the validator would not be eligible for any rewards related to oracle pricing in a given slashing window.
我们还允许验证者放弃参与预言机定价。为了被计为弃权而不是投票窗口的价格"丢失",验证者需要在给定的投票窗口中,不提供任何与预言机相关的投票。如果这样做,那么他们将被视为弃权而不是错过窗口期。这样做的好处是,如果验证者对自己提供准确定价数据的能力没有信心,他们可以避免参与预言机定价。结果是验证者将没有资格在给定的削减窗口中获得与预言机定价相关的任何奖励。
最后更新于