Oracles Oracles Orcales!!!

Crypto Warrior
5 min readSep 27, 2021

What Is an Oracle?

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

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.

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.

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.

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.

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.

In the 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.

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?

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.

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

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.

The oracle problem definition

The oracle problem is these two pieces combined:

  1. Blockchains alone can’t access outside data.
  2. Using centralized oracles nullifies the advantage of smart contracts — and is a major security risk.

The solution

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

What is a decentralized oracle?

A decentralized oracle or decentralized oracle network is a group of independent blockchain oracles that provide data to a blockchain. Every independent node or oracle in the decentralized oracle network independently retrieves data from an off-chain source and brings it on-chain. The data is then aggregated so the system can come to a deterministic value of truth for that data point. Decentralized oracles solve the oracle problem.

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.

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.

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.

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.

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.

(Disclaimer!!!)

The information contained herein is for informational purposes only. Nothing herein shall be construed to be financial, legal, or tax advice. The content of this article is solely the opinions of the writer who is not a licensed financial advisor or registered investment advisor. Trading cryptocurrencies/commodities/foreign exchange/equity markets pose a considerable risk of loss. The speaker does not guarantee any particular outcome.

--

--