Smart contracts can only access data available on the blockchain; we call this on-chain data.
Sometimes, a contract may need data that is not available on the blockchain. For example, a user may want the price data of $SUSHI on all the different centralized exchanges so that he/she can compare it with SushiSwap's pool price.
Smart contracts can only fetch on-chain data. This means a contract that can frequently and accurately update the token's price is needed.
But how do we make sure that the price returned by the contract is accurate? Who will be the one updating it? How can one make sure it is not lying and giving the wrong price?
How Do They Work?
An Oracle like Chainlink is a network of nodes that manage and aggregate different contracts containing off-chain data (token prices, weather, randomness and many, many other things).
The accuracy of the data is achieved by aggregating the data from honest nodes within the network. When an Oracle submits data on-chain, this data is kept forever. The system can check to see if the node is resilient and whether or not it has been a good actor since inception.
With this system in place, it can be used for any DeFi application to ensure data is correct.
Exchange | Furo | Docs | Discord | Twitter | Telegram | Newsletter | YouTube | Github