Data aggregation is fundamental, especially concerning oracles. These oracles serve as crucial links between blockchain networks and the tangible world by furnishing external data to smart contracts. Let's delve deeper into the importance of data aggregation within blockchain oracles: A Trusted Source of Information The process of data aggregation involves the collection of data from multiple outlets to guarantee its precision and trustworthiness. Oracles amalgamate data from a wide array of sources, heightening the credibility of the data they feed into smart contracts. Establishing Consensus Blockchain thrives on consensus, a concept that oracles must uphold. By aggregating data from diverse origins, oracles can validate the accuracy of the information they transmit to smart contracts before finalizing the process.
Minimizing Manipulation Risks By gathering data from different sources, oracles reduce the risk of manipulation. If a single source were used, it could be vulnerable to inaccuracies or even malicious attacks. Data aggregation acts as a safeguard against such risks. Enhancing Security Aggregating data from secure and reputable sources contributes to the overall security of blockchain applications, protecting users and assets from potential vulnerabilities.
Ensuring up-to-date Data Streams In the realm of blockchain technology, punctuality plays a vital role. Merging data empowers oracles to furnish real-time insights to smart contracts, facilitating prompt and precise implementation of predetermined parameters. Supporting Intricate Smart Contracts With the escalating complexity of smart contracts, the necessity for varied datasets arises. Data aggregation equips oracles to dispense thorough information, bolstering the execution of intricate and multi-layered smart contracts. Through the collection, validation, and delivery of precise data from diverse origins, oracles play a pivotal role in harmonizing blockchain technology with real-world information, fostering a more resilient and dependable decentralized framework.
Rationale behind Data Aggregation The caliber of data dispensed through an oracle platform hinges on two key factors:
Data availability — implying that the oracle data should always be accessible to end-users (or smart contracts) and should be consistently updated as pledged.
Data accuracy — this concept can vary and often relies on the nature of the data. For instance, accuracy in objective data (such as the outcomes of a football match) can be easily confirmed, whereas for subjective data (like the ETH token price in USD), defining accuracy might pose more challenges. Data aggregation improves the quality of the oracle data and helps oracles meet the requirements in many ways. First of all, aggregating data from different sources increases the value correctness, because even if some small subset of sources eventually corrupts it should not corrupt the aggregated value. Besides that, the aggregated value usually represents a “more fair” or “more correct” value.
Additionally, aggregation improves data availability, because even if some sources stop working — the oracle service will still be able to function properly. As we mentioned in the previous articles, the main product-market fit for oracles today is the provision of pricing data, which is very useful for creating synthetic and derivative assets, insurance, lending, and many other protocols. That’s why this article is mainly focused on the methods of aggregating price values. Average price value The first aggregation algorithm that comes to mind is calculating the mean value. It is very simple and may look quite “fair”but it actually has a significant disadvantage, because it is not resistant to manipulation by even a small subset of corrupted sources. For example, assume that you want to get the ETH/USD value from 5 different exchanges, where 4 of them claim that the current price is around $2000, but one of them insists that it’s only $1. Then the average value is ~$1600, which is too deviated and can not be considered correct. That’s why usually mean value calculation, as well as other aggregation methods, are combined with an Interquartile Range Filter, which helps to filter out outliers and market manipulations
There is a unique method known as the Median Price Value calculation, which offers advantages over traditional average value calculations. This approach is particularly resistant to manipulation by dishonest sources. However, while it provides a more accurate representation of market value compared to averages, it is not without its limitations. For instance, if we consider the value of ETH/USD from one prominent crypto exchange with a significant daily trading volume of $100m, and four smaller exchanges with daily trading volumes around $10k, and the larger exchange reports a value of $2000 while all the smaller exchanges report values lower than $1900, the aggregated median value would also fall below $1900, but may still not reflect the true market value accurately.
Another effective aggregation method to consider is the Volume-Weighted Average Price (VWAP) calculation, which factors in the varying trading volumes across different sources to determine a weighted average price. The higher the trading volume of a specific source, the greater influence it has on the overall price value. In some cases, VWAP is complemented by the use of the Interquartile Range Filter to eliminate outliers and improve accuracy (see VWAPIR).
Additionally, it is important to note that with the advent of Decentralized Exchanges such as Uniswap, Sushiswap, PancakeSwap, and others, calculating the Liquidity-Weighted Average Price (LWAP) from multiple decentralized sources has become feasible and provides similar benefits to the VWAP method. Time-weighted Average Price (TWAP) Another common method for price aggregation is based on weighted average price, weights of which are defined by the time criterion. This is especially useful for calculating price values based only on decentralized exchanges. Many DEXes even offer their own TWAP-based oracle solutions (example: Uniswap TWAP oracle). But besides DEX-based oracles, this method can be used to make market manipulation harder in case of a limited amount of data sources. We, at RedStone, use TWAPs to make the pricing data of low-liquidity assets more stable and reliable.
At RedStone we are on a mission to build the next generation of Oracles. Our solution has an unrivaled ability to exert significant control over any new data listings. Result? The flexibility to follow any emerging market trends, alongside substantial cost savings, allows us to stay at the frontier of a new wave of Decentralised Finance.
