The first step in an oracle system is to acquire the required data from the real world or the internet. This data may come from exchange prices, financial market indices, weather information, sports results, or even data from IoT devices.
In practice, oracles usually collect data from multiple sources rather than relying on a single source. This is because a single data source may be erroneous, delayed, or even manipulated. By collecting data from multiple sources, the system can improve data reliability and reduce risk.
Common data sources include:
Data collection is typically performed by oracle nodes. These nodes run specific software, continuously monitor external data sources, and send the latest information to the oracle network for further processing.
If an oracle simply uploads data to the blockchain, the system would still be vulnerable to errors or manipulation. Therefore, most oracle systems perform validation and aggregation before data is uploaded on-chain.
This process is usually carried out through multi-node collaboration. Different nodes submit the data they have collected, which is then aggregated using algorithms such as averaging or calculating the median. In this way, even if some nodes submit incorrect data, it will not have a significant impact on the final result.
Some oracle networks also introduce additional security mechanisms such as:
Through these mechanisms, oracle systems can prevent malicious data manipulation to some extent and improve overall data quality.
After validation and aggregation, oracle nodes submit the final result to the blockchain and write it into specific smart contracts. This process is commonly known as “price feed.”
From the perspective of smart contracts, oracle data does not come directly from the external world but is stored in an on-chain data contract. Other DeFi protocols only need to call this contract interface to read the latest data.
For example, when a lending protocol determines whether an account needs to be liquidated, it might execute the following logic:
In this way, oracles become a key data entry point for on-chain applications, enabling smart contracts to execute automated logic based on real-world information.
In financial applications, the timeliness of data is also very important. If price updates are too slow, it may cause liquidation delays, increase arbitrage opportunities, or even trigger systemic risk. Therefore, oracle systems usually implement specific data update mechanisms.
Different application scenarios have different requirements for update frequency. Some protocols require near real-time price updates, while others prioritize data stability. To balance efficiency and cost, oracles typically adopt multiple update strategies.
Common mechanisms include:
The design of these mechanisms needs to consider network costs, data accuracy, and market volatility. If updates are too frequent, on-chain transaction costs will increase significantly; if updates are too slow, prices may lag severely.
Therefore, finding a balance between efficiency, cost, and security is a key challenge in oracle system design.