# Data agregation and it`s role in blockchain oracles

By [fwf](https://paragraph.com/@fwf) · 2024-03-26

---

👋🏻 **Welcome! This article was written by RedStone's community ambassador, fwf. Enjoy reading it!**

Security, minimizing the risks of manipulation, real-time data updates and much more is provided by data aggregation, which is why it is considered an integral part of any Blockchain Oracle. And already Oracle acts as a bridge between networks in blockchain and the real world, providing smart contracts with external information.

![](https://storage.googleapis.com/papyrus_images/1f86eadac2a6c34f31159c16f8388b007606484983a152a57588b55c45fe62ef.png)

🤔**What is data aggregation?**

![](https://storage.googleapis.com/papyrus_images/a9f0cf2a67fc1078b7547994295954d23c5b3d06c372e64b682e73af1d9faa77.jpg)

**Data aggregation** **is** the process of collecting data (often from multiple sources) to produce high-level summary information that can be used for statistical analysis. An example of simple data aggregation is determining the amount of sales in a particular product category for each region in which you operate. Such a statistical summary makes it easier to analyze large amounts of data. Common data aggregations include sum, average, maximum, minimum, and quantity.

**Data aggregation works like "synthesis", its main goal is to create a whole from multiple values.**

**Data aggregation is very commonly used in databases with data.**

📝 In database management, there is a very useful tool called median. **An example of using the median:**

Suppose you have a huge database with personal data of more than one billion people. A person's gender, age, place of birth, it all gets confusing with so much information, so you need structure here. Let's do the same "synthesis" (i.e. create something whole from a set of values), count one category (e.g. salaries) in the database and **create a median value of all salaries using the aggregate function.** If necessary, you can use this function to select other categories as well: industry type, person's gender, and more.

♻️**How is RedStone processing the data?**

![](https://storage.googleapis.com/papyrus_images/8c9352d3e06b1cad748bca629ad76a8245d0ac56f88d51d5e2ab972176bf6920.jpg)

RedStone uses different methodologies to aggregate the data, which are called "median, TWAP (Time-weighted Average Price), LWAP (Liquidity-Weighted Average Price) and VWAP (Volume-weighted average price)".

📈**Median price value**

There is another approach, which uses a median value calculation. It’s way better than the average value and definitely more resistant to manipulations by corrupted sources. However, even this method cannot be considered a perfect way to calculate price value. As an example, assume that you take the same ETH/USD value from one large crypto exchange ($100m daily trading volume on ETH/USD market) and 4 small ones (~$10k daily trading volume on ETH/USD market), and the large exchange provides value $2000, but all the small ones — less than $1900. Then the aggregated median value, in this case, will be less than $1900, but, as you can guess, it’s not close enough to the “real” market value.

(From blog of RedStone).

**🔑 What opportunities Oracles have with the use of data aggregation:**

*   🔐 **Improved security** - Collecting data from trusted authorized sources contributes to the overall security of blockchain-apps and protects assets and users from potential vulnerabilities;
    
*   ✅ **Reliable information source and consensus assurance** - Gathering information from multiple sources ensures accuracy and reliability. RedStone does the same, it increases the reliability of information for smart contracts;
    
*   🛠 **Support for Complex Smart Contracts** - As smart contracts become increasingly complex, they require diverse data sets. Aggregated data collection allows Oracles to provide information to execute complex smart contracts;
    
*   ⚡️**Real-time data feeds** - Aggregated data allows Oracle to provide smart contracts with real-time information so they execute quickly and accurately;
    
*   💎**Minimize the risk of manipulation** - By collecting data from multiple sources, RedStone minimizes the risk of manipulation. If a single source is used, it may be susceptible to malicious attacks. Data aggregation protects against such risks.
    

![](https://storage.googleapis.com/papyrus_images/85c76f33e8e96225322e448947260f9cf7163c00a44a347df7ecdf582f3da7ad.png)

By collecting, verifying and providing accurate information from a variety of sources, Oracle facilitates the integration of blockchain technology with real-world data and contributes to a more robust and decentralized ecosystem.

![](https://storage.googleapis.com/papyrus_images/ac7c8e8884a3badaf29333011cdd5887ae8ac45df243953d5038af5b19f33f87.jpg)

🤝**Join us! We are already over 100K!**

![](https://storage.googleapis.com/papyrus_images/6445f1e49d9a26ec13b6b3d1276bb32d54edc61536aeb0c357049668b66b5237.png)

🔗**Our official links:**

Docs:

[https://docs.redstone.finance/docs/introduction](https://docs.redstone.finance/docs/introduction)

Discord:

[https://discord.gg/redstonedefi](https://discord.gg/redstonedefi)

Twitter:

[https://twitter.com/redstone\_defi](https://twitter.com/redstone_defi)

---

*Originally published on [fwf](https://paragraph.com/@fwf/data-agregation-and-it-s-role-in-blockchain-oracles-2)*
