Lesson 4 of 10
In Progress

4. Blockchain Oracle – what are oracles? 

Blockchain oracles play a crucial role in the entire cryptocurrency ecosystem. They are third-party services that provide smart contracts with outside information.  This will certainly be easier for Marvel fans to understand. Do you remember Heimdall? He guarded the Bifrost and saw and heard everything that was going on in the world and  delivering news to the Asgardians. Heimdall is a kind of blockchain oracle (Oracle) and Asgard is smart contracts.

Blockchain oracle

Blockchains and smart contracts have no access to information outside their network. And this is where oracles appear. It is a link that connects data from outside the blockchain with that in the blockchain. Oracles increase the range of what smart contracts can do. Without them, smart contracts would be limited and would only base their operation on data from the blockchain. Thus, they would not be reliable. Oracles transmit a variety of information: transaction data, payment completion, or even temperature readings.

At this point, let highlight an important thing that you must remember. An oracle is not a data source. It is a kind of filter for the information that flows into the ecosystem. It verifies and authenticates external data. Interestingly, some of them, in addition to sending information to contracts, can also send it back to external sources. 

As it happens in the world of cryptocurrencies – we have many types of oracles. Depending on how they are designed, this is how they will work. Get your notepad ready, stay focused. We invite you to read on. 

Why were oracles created? 

As we mentioned, oracles connect data from the outside world to the blockchain ecosystem. In professional terms, we call this the off-chain and on-chain world. As you know, some blockchains have their native cryptocurrencies, they are used for transactions, protocol operations or to facilitate management. Others, such as Ethereum give us the ability to create a smart contract. Just to make it clear – smart contracts are computer programs that work entirely based on the blockchain protocol. They automatically perform certain actions under certain conditions. Their tasks are performed without the involvement of third parties and can implement virtually any contract.

Imagine you want to buy a car with your crypto. For such a sale, you create a simple smart contract. It works more or less like this: as person A, you send money to person B. Then ownership of the sale is transferred from person B to person A. As you can see for yourself, there are no middlemen involved in this transaction. In this example, data from outside the chain (external) can be proof of a successful payment or receipt. And at this point, like a knight on a white horse, the oracle’s step in. They search, verify and authenticate this external data and then pass it on to the blockchain. Such information is used to validate the smart contract. 

Take a look. We are betting on Iga Świątek’s match. You are convinced that Iga will win; we are convinced that she will lose. We set the amount of the prize and sign the contract. Then we lock our funds in smart contracts. How will he know whether Iga has won or, unfortunately, lost? The oracle will ask for a trusted API, which will pass such real information to the contract. It will then send the funds to the person who bet on the match correctly.

How are oracles integrated into smart contracts?

The addition of oracles is done through MultiSig contracts. These require multiple parties to sign a smart contract. It could be properly defined that people A and B want to process an exchange – but this should only be possible if certain conditions are met, for which data is provided by Oracle. Even if A and B execute a smart contract, it will only be executed if the condition is also met, which can be checked using oracle data.

Types of oracles

As we have already mentioned, oracles have different qualities and characteristics. You will encounter oracles:

  • Hardware-based, where individual contracts will need to interact with the real world. They are designed to obtain information from the real world and make it available according to the needs of smart contracts. Such data is provided by other devices used to read the data (e.g., barcode scanners). In this case, oracles play the role of a translator that translates the obtained information into a language understandable by smart contracts. 
  • Software oracles interact with online information sources. They then send them to the blockchain. The data comes from a variety of databases, servers, or online sites. Their advantage is that they transmit information in real time, thanks to a constant connection to the Internet. They are one of the most popular oracles.
  • Incoming oracles, whose task is to transmit information from the outside to smart contracts. Such an oracle informs the smart contract of what information has been recorded by an external sensor.
  • Outgoing, acting in analogy to the incoming Oracle. They are the ones that send data from contracts to the outside world. 
  • Centralized, which, as the name says, are controlled by a third party. It is the sole provider of data to smart contracts. This is very risky because the effectiveness of the execution of a given smart contract depends entirely on the third party. What’s more – centralized oracles are exposed to hacking attacks or deliberate, erroneous data transmission.
  • Decentralized ones that want to avoid any risk for the contractor at all costs. They don’t just rely on one source of information. In decentralized oracles, a smart contract sends a query to multiple oracles to determine the validity and accuracy of the data sought as precisely as possible.
  • Particular ones that are applicable to one specific contract. They are time-consuming and expensive to maintain because if we want to implement several contracts simultaneously, we must have the same number of oracles. 
  • Human oracles that confirm their identity using cryptographic evidence. Curiously, it is with these oracles that fraud and falsification of information is unlikely.

Credibility of the oracle

To maintain their credibility, oracles use many tips. First – they use many sources of data. This makes it unlikely that they will receive erroneous information. Tip two – they use many oracles to collect data. This eliminates points of failure, but there is a risk of receiving false sources of information. Tip three – incentive systems. To be sure that users involved in information collection are honest, oracles use a stake-slashing mechanism. If the work is done well – the user is rewarded with tokens.

Use of oracles

  1. Market prediction – Augur and Gnosis use crowd knowledge to know the future state of the market. In this case, knowledge is ‘captured’ using multiple oracles. 
  2. Insurance system – using oracles, we can purchase insurance. They also solve a major problem in this sector – fraud. 
  3. Stability of stablecoins – e.g. DAI uses oracles to check and monitor the price of Ethereum. 
  4. DeFi – oracles provide decentralized finance with reliable information, e.g., pricing.
  5. Shipments – oracles could effectively map the location of tracking shipments, replacing GPS systems.

Oracles – the problems 

You can see for yourself that oracles are an important component of the blockchain ecosystem. However, one of the problems with oracles is hacking attacks. Therefore, it is important that in its design, the smart contract based on it is not compromised. Moreover, unfortunately, oracles are not subject to the security mechanisms that public blockchains provide.

Summary

Oracles are essential in the crypto industry. By connecting blockchain to the real world, they will effectively accelerate its global adoption. Users will then have confidence that smart contracts are operating safely and responsibly. They still have a long way to go, but with their help, there are sure to be many projects that will transform current industries.