What are Oracles in Crypto? (Explained + 3 Examples)

whiteboard crypto logo
Published by:
Whiteboard Crypto
on

Have you ever opened up an encyclopedia? It’s been a while since I’ve actually been to a library, but last time I did, the encyclopedia had like 20 different separate books, but when I opened a page I immediately found a ton of information on whatever that page was about.

The internet is kinda like a big encyclopedia, except we would need a library the size of Texas to hold all that information. If you’re here, you probably are wondering how that’s relevant to a blockchain oracle, and we’ll get to that too.

Oracles are services that provide external data (like temperature, stock prices, or sports results) to smart contracts on a blockchain. They act as a bridge between the digital blockchain and the real world, allowing smart contracts to react to and interact with real-world events and information.

What are Oracles?

Oracles

Blockchains are simply technology that store data, usually transactions, into a group called a block. Each block has some data before it, and some data after it, but all they do is store transactions. 

Next up, advanced blockchains can have something called smart contracts. Briefly, smart contracts are agreements on the blockchain that only get executed if the agreements are met.

For example, we could say, “If WhiteboardCrypto doesn’t have 1,000,000 subscribers by 2022, pay Theodore $100.” We could also write a smart contract to allow us to swap coins and tokens. For example, “If John gives us 10 zTokens, then give him 4 yTokens.”

Even more advanced smart contracts will allow us to write insurance contracts, where you pay a monthly premium, and then if something happens like your house burns down, that insurance contract can pay you for it. 

You can see how complex these smart contract agreements can get, but you may be asking one big question: “How does the blockchain know if my house burned down?”

What Do Oracles Do?

An oracle is a trusted third-party that gives you reliable data outside your current information access. Back in medieval times, an oracle was a person who could use their crystal ball to see into the future, essentially giving reliable information to someone who wanted it.

Whether you believe in that stuff or not, when it comes to blockchains, they want the same thing. 

See, a blockchain can’t see outside of it’s own code, it can’t go searching around the internet, and it can’t even ask for information. It’s simply coded to store data and transactions.

However, we can write smart contracts in a way that they rely on third-party information like the price of a stock, the outside temperature, or who won the presidential election. The oracle can act as a middleman between the blockchain and the real world.

Also, oracles aren’t real things, they’re usually just code programmed by someone and trusted by a lot of people. So there is no real physical oracle out there, it’s kinda like the internet, we all can use it, but it’s not really one thing. 

Let’s go through an example of each thing that I mentioned. 

Example: Stock Prices

Stock Screener

You could create a new token that follows the price of a stock. This way, investors outside of the United States could invest in stocks without needing to have a Social Security Number or report their taxes or many of the other hassles that come with investing in stocks. You can use an oracle to create a synthetic token that tracks it’s price to the real world price of a stock.

There are obviously a few other issues you have to solve with this, as it’s very complicated, but the Mirror Protocol has done exactly that.

You can buy mGoogle and hold it just as you would the real Google stock, and the price of the mGoogle token is tracked to the real world Google stock price through Chainlink

Example: Farming Insurance

Secondly, I mentioned farming temperatures. This is kinda a fun one to explain.

Imagine you’re a farmer and you want some crop insurance. This way if something crazy happens like a 10 day drought or it rains for a year, you are protected.

The way insurance works, is you pay a monthly premium that goes into a large pool of money. That money is stored with other people paying their premiums, and using statistics, we can reasonably predict that the amount we require people to pay will cover their issues.

So if one year your crops don’t grow because it’s too hot, you can have a $100,000 payout from the insurance smart contract. An oracle would be needed here, because how does the blockchain know if there’s a drought?

Well, you can feed it the temperature of your location, and if it looks at the temperature and it’s more than 100 degrees Fahrenheit for 10 days, we can say that you should be paid.

Of course, this is just an example and how insurance works is far more complicated than this. I just wanted to show another example of how we can use oracles and smart contracts to basically recreate the traditional way of insurance using a decentralized, trustless, and probably more affordable method using blockchain technology. 

Example: Presidential Election

Have you seen that website where you can practically gamble on who wins certain elections? I definitely have, and it’s an interesting idea, although it could definitely be implemented with blockchain technology and using cryptocurrencies.

Instead of paying with a credit card, then voting, and waiting for the poll to happen and trusting the platform to reward you if you won, we could write all of this with code and host it right on Ethereum.

This way we paid with ETH or USDC, waited to see who won, and then let our trusted decentralized oracle do the work of paying out the winners. Speaking of decentralized oracles, one of the benefits is that we don’t have to trust one data source, right?

When you use decentralized oracles, you’re essentially getting information from multiple, independent sources rather than relying on a single data provider. This setup reduces the risk of receiving inaccurate or manipulated data, since it’s not all coming from one place that could be biased or compromised.

Think of it like getting a news story from several different reporters rather than just one; you’re more likely to get the full, accurate picture.

Chainlink

Chainlink

Blockchains are decentralized, meaning no one person or company can control them. Oracles should be too, meaning you don’t get data from one source, because if you did, you have one point of failure and your data is technically centralized. So, how do we make an oracle decentralized? 

Chainlink seems to be the answer, and I don’t want to go too deep into it with this article, but they have an entire blockchain that is focused around supplying reliable real-world data from temperatures to prices to even the number of views on this article.

There are other types of oracles, but they usually specialize in one of three categories. Hardware oracles read information from real-world sensors, like a temperature, or a weighing scale, or if an NFC tag can be found nearby.

Software oracles find information on the web, like stock market data or how many users are on a website. Human oracles are oracle that consolidate human data, like reviews or important ideas from people with specialized skills or knowledge, but that starts to get very complicated. 

Conclusion

As you can see, there are endless uses for oracles because blockchains are self-contained units. In order to do anything fancy on a blockchain, something needs to provide the blockchain the relevant information, and that something is oracles.

Thanks for reading, we hope you enjoyed this article, we really hope you learned something, and most of all, we hope to see you in our next article!

whiteboard crypto logo

WhiteboardCrypto is the #1 online resource for crypto education that explains topics of the cryptocurrency world using analogies, stories, and examples so that anyone can easily understand them. Growing to over 870,000 Youtube subscribers, the content has been shared around the world, played in public conferences and universities, and even in Congress.