Blockchains can only read data which is already in the Blockchain. But most of the interesting data is outside of Blockchain. If we want to unlock the full potential of Blockchain, we need to access off-chain data. And that’s when Oracles come into play. In this article I will explain:
- what are oracles
- how they work
- and which one to use for your application.
There is 3 kind of oracle data:
- data coming from hardware, like a sensor that reports temperatures
- data coming from software, like stock market data
- and data coming from humans, like a college which delivers a certification
In an oracle, there is a smart contract that wants to consume some off-chain data, and a server that provides this data. First, the server sends a request to an API, to get the data. Then, the server forwards the data to the smart contract, by sending a transaction. The smart contract can verify the authenticity of the data by checking that the sending address is the address of the server. There are 2 issues:
- it costs money to use an oracle, since we need to run a server and send transactions
- and this is a centralized solution, since we need to trust that the oracle server is honest.
If you want to use an oracle in your project, you have 2 choices:
- You can either build your own oracle
- Or you can use an oracle protocol.
Oracle protocols reduce the cost of oracles by spreading the cost of fetching a piece of data among all users. They also solve the problem of centralization by using a decentralized network for providing data, with incentives to make sure the participants are honest.
Chainlink is by far the oracle with the most adoption:
- The easiest way to use Chainlink is to read market prices from their data feeds. Most of the data feeds of Chainlink are available on Ethereum, but they start to expand to other Blockchains.
- Chainlink also allows you to get randomness securely on the Blockchain. * And last thing, Chainlink also allows you to do any arbitrary API call and get the value back in your smart contract.
I hope I gave you a clear picture of what are oracles and how you can use them in your Blockchain project. If you enjoyed this video don’t forget to smash the like button. Have a nice day!
Leave a Reply