What is the Oracle Problem?
In this BlockBits summary, we build on our understanding of blockchain and smart contracts by going over the Oracle problem. This is a somewhat lesser-known topic, however, its resolution is important for the widespread adoption of blockchain technology.
If you find this subject interesting, I suggest you watch this video by Chainlink, a pioneer in solving this problem.
What is the Oracle Problem?
Imagine you send $5 worth of bitcoin to friend named Bob.
When a transaction takes place on the blockchain it must be validated by every node on the system so that they can all agree (also known as reaching consensus).
However, before doing that, a node must interact with an API (think of this as a library of information) to get the current price of bitcoin prior to sending the $5 worth of it to Bob. Following this, every node on the network will then have to fetch the value of bitcoin via the API to validate the transaction.
So what happens if the API the nodes are pulling from or the data it's providing is changed, hacked, or compromised? The nodes running the blockchain will all have conflicting information and not be able to reach consensus to validate the transaction. This is where a blockchain oracle comes in!
What is a Blockchain Oracle?
Chainlink defines an oracle as, "...any device or entity that connects a deterministic blockchain with off-chain data."
More simply, you can think of an oracle as a middleman between the off-chain data (think, a hospital's patient database) supporting the transaction and the blockchain that the transaction will be recorded on.
Why you need Oracles?
Think of any type of transaction supported by additional information.
For example, weather predictions, historical commodity prices, and many other data points are needed for making a crop insurance policy. Very few transactions are A = B., they're more like A + 2 + f + b*1 = B.
Oracles are needed for just about any application of smart contracts as they rely on cursory information for their logic to be met on the blockchain.
What is the Oracle Problem?
Remember, a huge benefit of blockchain technology is decentralization.
If we take data onto a blockchain through a centralized oracle (such as an API or a single node) the system is no longer decentralized and we are creating a point of failure in the execution of the smart contract transaction.
The oracle problem has 2 parts: (1) blockchains cannot access off-chain data (2) centralized oracles nullify the advantages of decentralization and are a security risk.
In my next article, I'll cover how the Chainlink protocol, built on Ethereum, is solving the oracle problem.
If you find my blockchain summaries interesting, please subscribe :)