DeFi Explained: Oracles

Smart contracts have great potential both within and outside of the blockchain. They are heavily used on the Ethereum network to support a variety of platforms. If it wasn’t for smart contracts, DeFi wouldn’t be able to function at all. However, they do have some disadvantages. One of them being they cannot receive data from the outside world. That’s where oracles come in.

Blockchain Oracles

You may have heard of the Oracle problem. This problem is actually a very simple limitation, and that is that blockchains cannot retrieve or send data themselves to an external problem. In any case, this function is not built into the blockchain itself.

As a result, blockchains are isolated networks that look suspiciously like a computer without an Internet connection. And that isolation is precisely what makes the blockchain so secure, because no one can access easily.

The nodes of the blockchain network check whether everything is done according to the rules, based on the consensus algorithm. For example, they check whether the transaction has been properly signed and whether the transaction can be made within a smart contract. This also makes smart contracts very trusted. They work exactly as they are made, and it is impossible to deviate from them.

However, smart contracts must be connected to the outside world, so that they can be used in as many situations as possible. For example, smart contracts in the financial world need market information to pay for settlements, and smart contracts in the insurance world need certain information from the internet to make decisions about policy payments.

Smart trade finance contracts need trade documents and digital signatures to know when to release payments.

It becomes clear that a terrible amount of external information is needed before smart contracts can be used in all sorts of ways. And none of the above information is generated within the blockchain. So there must be a connection between the blockchain and external systems in order to set up a new infrastructure, also known as the ‘Oracle’.

Blockchain Oracles provide the data necessary to be able to execute smart contracts when the set conditions are met. A blockchain Oracle is the only way for the blockchain to communicate with the outside world.

What does a blockchain Oracle do?

Blockchain Oracles are the bridge between the blockchain and external systems that can provide the blockchain with information. It is the man-in-the-middle that takes care of the communication between the two different systems.

An Oracle has several functions to ensure that this communication can be established.

Oracles’ key features are:

  • Listens to the blockchain network to check for requests to fetch data outside the network to make smart contracts work.
  • Retrieve data from different types of systems in order to be able to offer the requested data.
  • Convert data to the correct format in order to allow different systems to communicate with each other. A blockchain cannot just communicate with any other system, because they are different programming languages, have different system requirements, etc. The Oracle takes care of the compatibility.
  • Validate performance with a cryptographic proof that certain transactions, signatures and executions actually took place.
  • Make calculations on data. For example, calculating the median, or even more complex tasks, such as generating insurance quotations based on different types of data.
  • Sending data and evidence to the blockchain and other systems, so they can then perform the necessary actions. Smart contracts can perform actions based on the data that the Oracle sends.

In order to provide the above functions, the Oracle must work on and off the blockchain at the same time. The part that sits on the blockchain is for establishing a blockchain connection (to listen for requests), broadcast data, send evidence, convert blockchain data and perform calculations on the blockchain.

The portion that works outside of the blockchain is for processing requests, retrieving and formatting external data, sending blockchain data to external systems, and performing calculations in more advanced Oracle networks.

Oracle examples

There are many different situations where Oracles can offer a solution. Consider betting on football matches. You could place a bet with a friend about the winner of a match.

You then put this bet into a smart contract. The winner will then automatically receive the reward. But, smart contract will have to know who the winner of the competition is. The fairest way is that they receive the data automatically, and no person has to enter the outcome.

A smart contract is not able to interact directly with the results of the match. An Oracle will therefore have to be made so that the blockchain and the smart contract can read who has become the winner of the match.

By means of a trusted API, the smart contract can read who has won the match. The smart contract then determines who the winner of the bet is, and then sends the money to the winner.

In the absence of Oracles, the bet could not be settled fairly. A person is needed to provide the data about who the winner is. This results in a chance that the person is dishonest about the results, and is able to provide false data.

Chainlink

An example of an oracle platform is Chainlink. Chainlink wants to connect different blockchains as well as external systems. They do this by giving the smart contracts access to resources such as data feeds, web APIs and traditional bank details. These resources are provided by the affiliated agencies that can use the smart contracts in return. As a result, they do not have to switch to a new system themselves and can still use smart contracts. In addition to the fact that they are allowed to use these smart contracts, they also receive a reward in the form of LINK tokens for supplying data and APIs. The affiliated agencies are called Chainlink Node Operators. They are responsible for maintaining the connection between the API and the Chainlink network. The Chainlink network consists of all connected Node Operators.

Band Protocol

Another interesting oracle platform is Band Protocol. The main difference between Chainlink and Band Protocol is that Band Protocol uses its own blockchain called BandChain, based on Tendermint, with a Delegated Proof of Stake (DPoS) consensus algorithm. It works in the Cosmos ecosystem. Chainlink, on the other hand, doesn’t have a blockchain, it’s a network of nodes that only work when oracles are solely focused on delivering data between entities. Chainlink doesn’t have a blockchain because it’s based on Ethereum.

Conclusion

With Oracles, we can have the blockchain communicate with central systems, resulting in more possibilities. Smart contracts can make good use of this. Oracles ensure that we come a little closer to a future in which blockchains can play a major role. It has built a bridge between the world as we know it today and a future world where we would be using the blockchain in our everyday life.

Last updated on June 21, 2021