Oracle的崛起

image
Blockchain oracles resolve the issue of delivering external data to the blockchain – but we still need to know which of them we can trust. 区块链Oracle解决了将外部数据传递到区块链的问题-但我们仍然需要知道我们可以信任的数据。

In our article on the launch of the Waves Oracles directory, we discussed the importance of oracles for the blockchain. Decentralized apps cannot access data outside the blockchain. This problem is resolved by using oracles.

在关于Waves Oracles目录启动的文章中 ,我们讨论了Oracle对区块链的重要性。 分散式应用程序无法访问区块链之外的数据。 通过使用oracles可以解决此问题。

The issue at stake is quite straightforward. If the execution of a dApp requires outside data, it has to be stored on the blockchain. To achieve that, small programs called oracles are created, which access relevant data from the outside world and record it to the blockchain.

所面临的问题非常简单。 如果执行dApp需要外部数据,则必须将其存储在区块链上。 为此,创建了一个称为oracle的小型程序,该程序从外界访问相关数据并将其记录到区块链中。

By the type of outside data source, all oracles could be divided into three categories: software oracles, hardware oracles and human oracles.

根据外部数据源的类型,所有预言可以分为三类:软件预言,硬件预言和人工预言。

软件Oracle (Software oracles)

obtain data from the internet, such as temperature, prices for goods and services or flight and train delays. Information comes from online sources, such as APIs. An oracle extracts relevant data and records it to the blockchain. You can learn how to make a simple software oracle

从互联网获取数据,例如温度,商品和服务的价格或航班和火车的延误。 信息来自在线资源,例如API。 Oracle提取相关数据并将其记录到区块链中。 您可以学习如何制作简单的软件Oracle

here. 在这里

硬件神谕 (Hardware oracles)

trace real-world objects using devices and sensors. For instance, a video camera calibrated for line crossing traces vehicles entering a certain area. An oracle records the fact of entering the area to the blockchain. Based on that oracle's data, a dApp's script can, for instance, issue a ticket and deduct tokens from a vehicle owner's account.

使用设备和传感器跟踪现实世界中的对象。 例如,为交叉线校准的摄像机跟踪进入某个区域的车辆。 Oracle记录了进入区块链区域的事实。 例如,基于该oracle的数据,dApp的脚本可以发出罚单并从车主的账户中扣除代币。

人类的神谕 (Human oracles)

operate with data entered by humans and are considered most advanced because they offer an independent view of an event's outcome.

使用人类输入的数据进行操作,被认为是最先进的,因为它们提供了事件结果的独立视图。

Recently, we introduced a tool that enables writing data to the blockchain under a set specification.

最近,我们引入了一种工具,该工具可以按照设定的规范将数据写入区块链。

The tool is very straightforward. You register an oracle card by filling out the specification and can then record data transactions to the blockchain under that specification. Read more about the tool in our documentation.

该工具非常简单。 您可以通过填写规范来注册Oracle卡 ,然后可以在该规范下将数据交易记录到区块链。 在我们的文档中阅读有关该工具的更多信息。

image

Standardized tools and interfaces of this kind make life easier for developers and users of blockchain-based services alike. This tool is especially useful for human oracles in areas such as recording certificates or an author's rights to some objects.

这种标准化的工具和接口使基于区块链的服务的开发人员和用户的生活更加轻松。 该工具对于人类Oracle在记录证书或作者对某些对象的权利等领域特别有用。

However, data provided by oracles has to be trustworthy. Using just one oracle could cause problems. It's vital to know if you can trust the source and if the data is up-to-date. Otherwise, there is a risk that an oracle can deceive users by deliberately providing false information to gain a profit.

但是,oracle提供的数据必须可信。 仅使用一个Oracle可能会导致问题。 了解您是否可以信任来源以及数据是否最新是至关重要的。 否则,Oracle就有可能通过故意提供虚假信息来获利而欺骗用户。

Let's consider the example of an oracle providing information of a sports event’s outcome to a decentralized prediction market.

让我们考虑一个示例,该示例为向分散的预测市场提供体育赛事结果的信息。

The event in question is a UFC 242 fight between Khabib Nurmagomedov and Dustin Poirier. According to bookmakers, Nurmagomedov was the favorite with odds of 1.24, corresponding to a 76% probability of victory. Poirier was given odds of 4.26 (22%). The odds of a draw were 51.0 (2%).

该事件是Khabib Nurmagomedov和Dustin Poirier之间的UFC 242战斗。 根据庄家的说法,努尔马戈梅多夫是1.24的最爱,胜率为76%。 Poirier的赔率是4.26(22%)。 平局的赔率是51.0(2%)。

image

A script accepts bets on all three outcomes until it receives information on the actual outcome from an oracle. That information is the only trigger for distributing the winnings.

脚本会接受所有三个结果的下注,直到它从预言机接收到有关实际结果的信息。 该信息是分配奖金的唯一触发因素。

We know that Nurmagomedov won the fight. But let's assume a dishonest oracle owner planned a fraud and placed a substantial bet on the most profitable outcome, a draw. Once a large sum of bets has been accumulated, the dishonest oracle owner initiates recording of false information about a draw to the blockchain. The decentralized exchange's script is unable to check the accuracy of the data and can only accept it. Subsequently, the script distributes the winnings between the bettors in accordance with the outcome data it has received.

我们知道努尔马戈梅多夫赢得了这场战斗。 但是,让我们假设一个不诚实的Oracle所有者计划了一次欺诈活动,并将最大的赌注押在了最有利可图的结果上,即平局。 一旦积累了大量赌注,不诚实的Oracle所有者便会开始记录有关抽奖的虚假信息。 去中心化交易所的脚本无法检查数据的准确性,只能接受它。 随后,脚本根据已收到的结果数据在下注者之间分配奖金。

Fraud of this kind could potentially be highly profitable for a dishonest oracle creator. If the anticipated profit is higher than an honest oracle's predicted revenue and the risk of legal consequences is low, the chance of fraud could substantially increase.

对于不诚实的Oracle创建者而言,这种欺诈可能会带来高额利润。 如果预期利润高于诚实的先知的预期收入,并且法律后果的风险较低,那么欺诈的可能性就会大大增加。

One way to address this is by requesting data from several oracles and establishing consensus from the received outcomes.

解决此问题的一种方法是从多个预言数据库请求数据并根据收到的结果建立共识。

There could be several types of consensus:

可能有几种类型的共识:

  • All oracles supplied the same information.

    所有的Oracle都提供了相同的信息。
  • The majority of oracles supplied the same information (2 out of 3, 3 out of 4, etc.).

    大多数Oracle提供相同的信息(3分之2、4分之3等)。
  • The median of the oracles' data is calculated (the maximum and minimum outcomes could be discarded before calculating the median).

    计算出先知的数据的中位数(在计算中位数之前可以舍弃最大和最小结果)。
  • All oracles supplied the same information within a previously agreed deviation. For instance, exchange rates from different sources could differ by 0.00001, and obtaining exactly the same data would be impossible.

    在事先商定的偏差范围内,所有预言家都提供了相同的信息。 例如,来自不同来源的汇率可能相差0.00001,因此不可能获得完全相同的数据。
  • Only unique outcomes are selected.

    仅选择唯一的结果。

Let's apply this to our example. If a ‘3 out of 4’ consensus type is used, false outcome information on the Nurmagomedov vs. Poirier fight from one oracle would not have an impact on script execution. It would be executed based on information about Nurmagomedov's victory, with the winnings distributed based on that data.

让我们将其应用于我们的示例。 如果使用“ 4分之3”的共识类型,则来自一个预言家的Nurmagomedov对Poirier之争的错误结果信息不会影响脚本执行。 它将基于有关努尔马戈梅多夫胜利的信息执行,并根据该数据分配奖金。

However, if a dishonest person owned 3 out of 4 oracles, it would be still possible to rig the outcome data.

但是,如果不诚实的人拥有4个预言中的3个,则仍然有可能获取结果数据。

To maintain oracles’ integrity, various concepts for oracle rankings or fines for providing false information, as well as incentives to provide accurate information, could be introduced. But none of them would be protected from ranking rigging or a dishonest majority.

为了维护Oracle的完整性,可以引入有关Oracle排名或提供虚假信息的罚款的各种概念,以及提供准确信息的激励措施。 但是,他们中的任何一个都不会受到等级排名或不诚实多数的保护。

So, do we really need more complicated concepts, or would it be better simply to have a consensus tool that allows us to take five oracles supplying relevant data – as if off a supermarket shelf – set the consensus type and get a result?

那么,我们真的需要更复杂的概念吗?还是简单地拥有一个共识工具,使我们可以让五个Oracle提供相关数据(就像在超市货架上一样),设置共识类型并得到结果会更好吗?

For instance, a decentralized app needs Celsius temperature data. We will find four oracles supplying that data in the oracle directory, set the consensus type as «median» and make a request.

例如,一个分散的应用程序需要摄氏温度数据。 我们将在oracle目录中找到四个提供该数据的oracle,将共识类型设置为“ median”并发出请求。

The oracles provide values of 18, 17, 19 and 21 degrees. There is an apparent discrepancy in the data, and a three-degree difference could have an impact on script execution. The service processes the received data and comes up with a median of 18.75 degrees, which is sent to the dApp’s script.

oracle提供18、17、19和21度的值。 数据存在明显差异,三度差异可能会对脚本执行产生影响。 该服务处理接收到的数据,并得出18.75度的中间值,该中间值将发送到dApp的脚本中。

image

In any case, the decision of whether to trust data from a single oracle or build a consensus from several oracles is up to the user.

在任何情况下,是由用户来决定是否信任来自单个oracle的数据或建立来自多个oracle的共识。

Overall, data oracles are a new field. This is currently at a stage where users can have an impact on the direction in which it will develop. We would therefore like to hear from you. Tell us if you think a consensus tool described above is needed and share your ideas about the directions in which the oracle field evolve.

总体而言,数据预言是一个新领域。 目前,这个阶段处于用户可以对其发展方向产生影响的阶段。 因此,我们希望收到您的来信。 告诉我们您是否需要上述共识工具,并就oracle领域发展的方向分享您的想法。

Provide your feedback in comments and in our official Telegram group.

在评论和我们的官方Telegram组中提供您的反馈。

翻译自: https://habr.com/en/company/waves/blog/471962/