Monday 2 August 2021

What is a blockchain oracle?




A blockchain oracle is responsible for sending external data to a blockchain. Essentially, they bring data from the real world and give it to the blockchain to utilize. Oracles fulfill this need because blockchains only have access to data that happens on their network. By expanding the amount of data blockchains have access to, it can significantly increase the number of capabilities of the applications that run on it.

Oracles are extremely beneficial for smart contracts because they are the basis for Dapps and have many potential use cases that couldn’t occur without the use of real-world data. An oracle isn’t the source of the data but it instead acts as a messenger, by relaying information from other sources and confirming the information is correct before sending it to its desired destination on the blockchain. It is important this information is correct, otherwise the oracle would be feeding incorrect information, which can be extremely problematic.

Blockchain Oracle example

Let’s say you wanted to bet on the winner of a football match with your friend. You could create a smart contract with the odds and both you and your friend lock your desired bet into the smart contract with a payout for the winning person. But the smart contract won’t know the winner because it isn’t able to access this data. After all, it doesn’t run natively on the blockchain. Here, an oracle would query its trusted source for the information of the winning football team, verify the information is correct, then feed it back to the smart contract. Now that the smart contract has access to the result of the football match, it can payout the winner accordingly.

Let’s look at another example. A farmer depends on the weather for their crops to grow well, and to make money from those crops. Insurance companies can provide protection to farms, however, farmers can be limited with their choices of only local providers which may give them an unfair deal. The farmer could instead enter into a smart contract with an online insurance company where the criteria are based on the amount of rainfall in the region. By using an oracle, the smart contract can receive accurate rainfall data from national weather bodies, and use it to provide coverage based on the amount of rainfall in the region. Below you can see a visual representation of a smart contract, powered by Chainlink, that demonstrates this example.



The different types of oracles

Software oracles

A software oracle is an oracle that pulls data that originates from online sources. This could include information like weather, crypto prices, or even flight schedules. Since software oracles are connected to the internet, they can feed information in real-time. Because this allows them to provide information that constantly updates as necessary, they are the most common type of oracle used by blockchains.

Hardware oracles

A hardware oracle is an oracle that pulls data from a physical device in the real world. This could include devices like a photocopier or a barcode scanner. For example, a supply chain may be responsible for packing and shipping boxes of electronic parts. At the end of the packaging line, someone may scan the box to mark it’s been packaged. A smart contract can be created where the oracle feeds it information about boxes that have been scanned, which the smart contract can make decisions based on.

Inbound and outbound oracles



Inbound and outbound refer to which way the information is being sent. If an oracle is sending information to a smart contract, then it is inbound. If an oracle is sending information from a smart contract to an external source, then it is outbound. An inbound oracle might supply information to a smart contract about the winner of a football match. An outbound oracle might use a method to unlock a smart contract and send the payout of a bet to the winner’s address.

Centralized and decentralized oracles



A centralized and decentralized oracle refers to the control structure of an oracle. If an oracle is centralized, its information is coming from a single entity and can be considered a single point of failure. There is a risk in using a centralized oracle because if that single entity were to fail then the oracle would be unable to function properly. This single point of failure also poses a security risk because only one entity needs to be attacked for the oracle to be rendered useless.

A decentralized oracle has multiple entities that it uses to provide information. In this instance, the oracle has multiple points of failure and can be considered more trustworthy from an information and security standpoint. Moreover, a smart contract could also utilize multiple oracles to achieve consensus for the necessary information, similar to how blockchains need consensus to confirm transactions — this is an example of consensus-based oracles.

The oracle problem

Since oracles act as the middleman between blockchains and external information, there is an underlying problem that faces them from achieving widespread adoption. Blockchains can’t pull data from external sources so they require oracles to fulfill that. If an oracle is compromised, then this also compromises the smart contract. This is the oracle problem. For the oracle to be trustworthy for a blockchain it needs to be secure from attacks, decentralized to reduce the concentration of failure and provide correct data.

If you have questions and requests, leave comments below the article.

 

No comments:

Post a Comment

What Is The Metaverse?

  The Metaverse is the sum of all shared, persistent virtual spaces. It is the totality of all the digital and virtual worlds as well as d...