oracle段区块_什么是区块链Oracle

oracle段区块

1.什么是Oracle? (1. What Is an Oracle?)

A blockchain oracle is any device or entity that connects a deterministic blockchain with off-chain data.

区块链Oracle是将确定性区块链与链下数据连接的任何设备或实体。

There is a lot to unpack in that one sentence.

这句话有很多东西要解开。

To understand what blockchain oracles are and why we need them, let’s go back to one of the core features of a blockchain — decentrality.

要了解什么是区块链预言家以及为什么需要它们,让我们回到区块链的核心功能之一-去中心化。

区块链的问题 (The problem with blockchains)

Since the blockchain has its distributed ledger nature, each node in the network has to be able to find the same end result given the same input. Otherwise, when a node looks to validate a transaction another node makes, it would end up with a different result. This architecture is intentional, and it’s designed to be deterministic intentionally.

由于区块链具有其分布式分类帐性质,因此网络中的每个节点必须能够在给定相同输入的情况下找到相同的最终结果。 否则,当一个节点希望验证另一个节点进行的交易时,它将最终得到不同的结果。 该体系结构是有意的,它被设计为有确定性。

Determinism in blockchain is easy to validate by other nodes.
New balance is easy to get (Image source: Author)
新的平衡很容易获得(图片来源:作者)

We can see when we send $5 from Bob to Alice, we can easily add $5 to Alice’s balance and subtract $5 from Bob’s. Every node on the network could easily reproduce this, get the same results, and end up in the same state.

我们可以看到,当我们从鲍勃发送5美元给爱丽丝时,我们可以轻松地将5美元添加到爱丽丝的余额中,并从鲍勃的余额中减去5美元。 网络上的每个节点都可以轻松地重现此结果,获得相同的结果,并最终处于相同的状态。

But what if this wasn’t the case? Let’s imagine an imaginary blockchain where they use APIs to validate each other's transactions. Let’s say we want to send a variable amount based on the price of ETH to Alice from Bob’s account. We would have our contract call an API to get the price of ETH and then send that amount to Bob. When every other node goes to verify this, they also have to call this API.

但是,如果不是这种情况怎么办? 让我们想象一个假想的区块链,其中他们使用API​​来验证彼此的交易。 假设我们要根据Bob账户的ETH价格向Alice发送可变金额。 我们将让我们的合同调用一个API以获取ETH的价格,然后将该金额发送给Bob。 当其他所有节点都进行验证时,它们也必须调用此API。

Blockchain Oracles are needed, as validating variables breaks determanism and consensus.
It’s much harder to validate variables. (Image source: Author)
验证变量要困难得多。 (图片来源:作者)

But what happens now? If they call the API even an instant later, the API could have changed — been depreciated, hacked, or for a number of other reasons — and all the nodes would get a different result. This means none of the nodes would be able to agree upon what the actual state of the blockchain is.

但是现在发生了什么? 如果他们甚至在稍后调用该API,则该API可能已更改(已被折旧,被黑或出于许多其他原因),并且所有节点将获得不同的结果。 这意味着没有节点能够就区块链的实际状态达成一致。

It’s for this reason the Ethereum blockchain and most blockchains are designed to be entirely deterministic. That means if we were to replay every transaction, we would end up in the correct state. If you include API calls or other non-deterministic sources into the infrastructure of blockchain, there is a good chance that the source will be depreciated, hacked, or even just broken, and we would not be able to validate transactions.

因此,以太坊区块链和大多数区块链都是完全确定性的。 这意味着,如果我们要重播每笔交易,我们将最终处于正确的状态。 如果您将API调用或其他非确定性来源包括在区块链的基础架构中,则很有可能该来源将被折旧,被黑甚至被破坏,我们将无法验证交易。

Blockchain Consensus is not possible if the blockchain oracles allow for variable transactions.
Consensus is not possible if blockchain is non-deterministic (Image source: Chainlink)
如果 区块链不是确定性的,则无法 达成共识(图片来源: Chainlink )

In blockchain, the mechanism for agreeing upon a data value is called consensus, and determinism is important so that nodes can come to a consensus. You might have heard of some of them, like Proof of Work (PoW) with Nakamoto Consensus or Proof of Stake (PoS) with Byzantine Consensus. Consensus is one of the key ingredients that make blockchain work in the first place.

在区块链中,达成数据值共识的机制称为共识 ,确定性很重要,这样节点才能达成共识。 您可能听说过其中的一些,例如中本聪共识的工作量证明 (PoW)或拜占庭共识的权益证明 (PoS)。 共识是使区块链首先发挥作用的关键因素之一。

But we need the blockchain world to connect with the real world. We need to get the price of ETH and other cryptocurrencies into a contract so we can have DeFi. We need to get the weather data so we can have decentralized trustless insurance. We need data to use blockchain for one of its most important purposes, smart contracts. So how do we bridge the worlds with this constraint?

但是我们需要区块链世界与现实世界连接。 我们需要将ETH和其他加密货币的价格纳入合同,以便我们拥有DeFi。 我们需要获取天气数据,以便可以进行分散式无信任保险。 我们需要数据以将区块链用于其最重要的目的之一,即智能合约。 那么我们如何在这个约束条件下架起桥梁呢?

Oracle如何解决这个问题 (How oracles solve this)

A blockchain oracle is any device or entity that connects a deterministic blockchain with off-chain data. These oracles enter every data input through an external transaction. This way, we can be sure that the blockchain itself contains all of the information required to verify itself. This is why oracles are known as blockchain middleware: They are the bridge between the two worlds.

区块链Oracle是将确定性区块链与链下数据连接的任何设备或实体。 这些预言机通过外部事务输入每个数据输入。 这样,我们可以确保区块链本身包含验证自身所需的所有信息。 这就是为什么Oracle被称为区块链中间件的原因:它们是两个世界之间的桥梁。

So that’s it, this is great! But what’s this I keep hearing about an “oracle problem”?

就是这样,太好了! 但是,我不断听到关于“ oracle问题”的信息是什么?

2.什么是Oracle问题? (2. What Is the Oracle Problem?)

Let’s take a step back and remember why we are building on-chain in the first place. A huge reason we do anything on-chain is for decentrality. However, data has to come from somewhere.

让我们退后一步,记住为什么我们首先要在链上进行构建。 我们在链上做任何事情的一个重要原因是去中心化。 但是,数据必须来自某个地方。

If we import data from a single API, node, or source, we have now essentially removed the entire purpose of using blockchain in the first place. A centralized oracle means that one entity has the power over your smart contract, and your smart contract is now no better than a regular contract. And even if the centralized oracle has the best intentions, we’ve seen attacks already where a centralized oracle is hacked, attacked, outdated, or not maintained, and catastrophe ensues.

如果我们从单个API,节点或源导入数据,那么现在我们实际上已经删除了使用区块链的全部目的。 集中式预言意味着一个实体可以控制您的智能合约,并且您的智能合约现在不比常规合约更好。 即使集中式Oracle的意图是最好的,我们也已经看到集中式Oracle被黑客攻击,攻击,过时或未维护的攻击,并且随之而来的是灾难。

Centralized Blockchain Oracles are huge points of failure.
Centralized oracles are massive points of failure (Image source: Chainlink)
集中式Oracle是重大的失败点(图片来源:Chainlink)

oracle问题定义 (The oracle problem definition)

The oracle problem is these two pieces combined:

Oracle的问题是这两部分结合在一起:

  1. Blockchains alone can’t access outside data.

    单独的区块链无法访问外部数据。
  2. Using centralized oracles nullifies the advantage of smart contracts — and are major security risks.

    使用集中式预言片使智能合约的优势无效—这是主要的安全风险。

解决方案 (The solution)

Chainlink solves both of these and is the standard for decentralized oracles.

Chainlink解决了这两个问题,是分散式Oracle的标准。

Chainlink is a framework for choosing your independent network of nodes to connect the real world’s data to the blockchain to enable smart contracts to reach their true potential. With this, we are leveraging the same reliable decentralized infrastructure concept the blockchain has, but for blockchain oracles. If nodes/sources are hacked, depreciated, or deleted, the network of Chainlink will leverage the decentralized network and carry on.

Chainlink是一个框架,用于选择您的独立节点网络以将现实世界的数据连接到区块链,以使智能合约发挥其真正潜力。 通过这种方式,我们利用了区块链具有的同样可靠的去中心化基础设施概念,但对于区块链预言家而言。 如果节点/源被黑客攻击,折旧或删除,Chainlink的网络将利用分散的网络并继续运行。

Decentralized Oracles are the solution to the Oracle Problem.
Decentralized oracles are the solution. (Image source: Chainlink)
分散的预言是解决方案。 (图片来源:Chainlink)

There are massive marketplaces leveraging the Chainlink technology to help you pick your network of independent nodes to pull your data from. This way, your smart contracts can easily never have a single point of failure.

有大量的市场利用Chainlink技术来帮助您选择独立节点的网络来提取数据。 这样,您的智能合约就不会轻易出现单点故障。

The technology is blockchain agnostic and is constantly working to integrate with more blockchains so all blockchains can have access to reliable secure off-chain data. And best of all, the documentation is great for beginner engineers and experienced alike.

该技术与区块链无关,并且一直致力于与更多区块链集成,因此所有区块链都可以访问可靠的安全链外数据。 最重要的是,该文档非常适合初学者和经验丰富的工程师。

For a video explanation, you can watch this video:

有关视频说明,您可以观看以下视频:

Ethereum Oracle — Chainlink 以太坊Oracle — Chainlink

Using one blockchain oracle is a huge risk and chainlink offers a fantastic new ecosystem around data. Blockchain oracles are the key to unlocking the future that smart contracts have for us. Oracles also provide a way for blockchains to see into each other. This is known as interoperability, and is an important next step as well.

使用一个区块链Oracle是一个巨大的风险,链链接提供了一个围绕数据的奇妙的新生态系统。 区块链Oracle是释放智能合约为我们带来的未来的关键。 Oracle还为区块链相互了解提供了一种方法。 这被称为互操作性 ,也是下一步的重要步骤。

At the end of the day, in order for smart contracts to be the superior form of agreement, we need access to diverse and reliable data.

归根结底,为了使智能合约成为高级的协议形式,我们需要访问各种可靠的数据。

This is why we need oracles.

这就是为什么我们需要神谕。

翻译自: https://medium.com/better-programming/what-is-a-blockchain-oracle-f5ccab8dbd72

oracle段区块

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值