What is an Oracle Blockchain?
And what is the problem with the oracle? Why can’t blockchains themselves make API calls?
1. What is an oracle?
A blockchain oracle is any device or entity that connects a deterministic blockchain with off-chain data.
There’s a lot to unpack in that sentence.
To understand what blockchain oracles are and why we need them, let’s go back to one of the main features of a blockchain: decentrality.
The problem of blockchains
Since the Blockchain development services have its distributed ledger nature, each node in the network must be able to find the same end result with the same input. Otherwise, when a node seeks to validate a transaction that another node makes, it would end up with a different result. This architecture is intentional and is designed to be deterministic intentionally.
We can see that when we send $5 from Bob to Alice, we can easily add $5 to Alice’s balance and subtract $5 from Bob’s. All nodes in 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? Imagine an imaginary blockchain development services in which 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 ETH price and then send that amount to Bob. When all other nodes are going to verify this, they must also call this API.
But what happens now? If they call the API even an instant later, the API could have changed (depreciated, hacked, or for various other reasons) and all nodes would get a different result. This means that none of the nodes could agree on what the actual state of the blockchain is.
It is for this reason that the Ethereum blockchain and most blockchains are designed to be completely deterministic. That means that if we had to reproduce every transaction, we would end up in the right state. If you include API calls or other non-deterministic sources in the blockchain infrastructure, there’s a good chance the source will depreciate, hack, or even break, and we can’t validate the transactions.
In blockchain, the mechanism for agreeing on a data value is called consensus, and determinism is important for nodes to reach consensus. You may have heard of some of them, such as 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 include the price of ETH and other cryptocurrencies in a contract in order to have DeFi. We need to get the weather data so we can have decentralized insurance without trust. We need data to use blockchain for one of its most important purposes, smart contracts. So how do we connect the worlds with this restriction?
How do oracles solve this?
A blockchain oracle is any device or entity that connects a deterministic blockchain with off-chain data. These oracles enter each data entry through an external transaction. In this way, we can be sure that the blockchain development services itself contains all the information needed to be verified. 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 is it that I keep hearing about an “oracle problem”?
2. What is Oracle’s problem?
Let’s take a step back and remember why we’re building in chains in the first place. A big reason we do something in chains is decentralization. However, the data has to come from somewhere.
If we import data from a single API, node, or source, we’ve now essentially eliminated the whole purpose of using blockchain in the first place. A centralized oracle means that an entity has power over its smart contract, and its smart contract is now no better than a regular contract. And even if the centralized oracle has the best intentions, we’ve already seen attacks in which a centralized oracle is hacked, attacked, outdated, or unmaintained, and catastrophe strikes.
Defining the Oracle Problem
The oracle problem is these two pieces combined:
Blockchains alone cannot access external data.
The use of centralized oracles negates the advantage of smart contracts and are significant security risks.
Chainlink solves both and is the standard for decentralized oracles.
Chainlink is a framework for choosing your independent network of nodes to connect real-world data to the blockchain to enable smart contracts to reach their true potential. With this, we are taking advantage of the same concept of reliable decentralized infrastructure that blockchain has, but for blockchain oracles. If nodes/sources are hacked, depreciated, or deleted, the Chainlink network will take advantage of the decentralized network and continue.
There are massive markets that leverage Chainlink technology to help you choose your network of independent nodes from which to extract your data. This way, your smart contracts can never have a single point of failure.
The technology is blockchain-agnostic and is constantly working to integrate with more blockchains so that all blockchains can have access to secure and reliable off-chain data. And best of all, the documentation is great for beginner and experienced engineers alike.