Comment on page
Oracles deliver real-world off-chain data to the blockchain via a third-party provider. Oracles have paved the way for market price prediction on DeFi crypto platforms, where users may wager on the outcome of an event, ranging from elections to price movements, for which the payouts are made via a smart contract-governed automated process. These prices are termed "Time Weighted Average Prices", or TWAPS. TWAP orders are a strategy of executing trades evenly over a specified time period. The concept is to calculate the average price over a period of blocks by dividing the cumulative price. It is often used to minimize a large order's impact on the market and result in price improvement. The following illustration summarizes this calculation:
A TWAP is calculated by accumulating prices over a duration of blocks over the timestamp duration.
TWAPs are reliable and reflect the value of a token based on a particular token pair over time. This approach provides protection from flash crashes or wild price movements, which are not uncommon in cryptocurrency trading. In the event of market volatility, providing a time-weighted price represents a more realistic portrayal of the token. Oracles connect smart contracts to the external world. Blockchains are unable to retrieve information from sources outside their own network. DeFi would not be feasible without oracles transmitting this information to the blockchain.
The vast majority of DeFi oracles, such as Chainlink, are pricing oracles. They obtain the current asset price from various reliable sources, such as major exchanges, and transmit that data to the smart contracts that power DeFi systems. Oracles don’t function only as price validators. They can collect almost any information that a smart contract requires, such as sports results, weather forecasts, or flight delays.