RedStone Oracles: A Modular Design

CaméSennin
5 min readMay 21, 2024

--

In this article, we’ll take a look at RedStone Oracles’ modular design and why it’s a key factor in setting RedStone apart from its competitors.

Modular What ?

Let’s start with a basic definition of a modular design from wikipedia:

Modular design, or modularity in design, is a design principle that subdivides a system into smaller parts called modules which can be independently created, modified, replaced, or exchanged with other modules or between different systems.

Modular design, by definition, allows for product designs to be customized, reused, improved, or maintained. Furthermore, the independent components of a modular product adhere to a standard interface, facilitating easy integration with each other in the final product. In contrast, non-modular products are difficult to customize or maintain.

How is it applied to RedStone? Let’s hear a word from Marcin Kaźmierczak from X’ Chainsaw

Video from https://x.com/chainsaw_here/status/1751356524742541688

Modularity can be applied to blockchains, dApps, and other digital infrastructures. Nowadays, applications rarely operate in isolation as they require external data beyond their core functionality. This is a significant challenge for blockchains, which are almost isolated from the internet. On-chain data typically includes information about transactions made on the blockchain, but price feeds and off-chain data remain inaccessible.

This is where Oracles come into play: they provide the off-chain data that blockchains desperately need.

RedStone’s modular design takes this a step further by offering multiple flexible integration methods for blockchain while ensuring data integrity. Data is first placed into a Data Distribution Layer (DDL) and then fetched on-chain as needed. This allows for broadcasting a large number of assets at high frequency to a cheaper layer, only moving it on-chain when required by the protocol. This data flow is summarize in the next figure:

https://docs.redstone.finance/docs/smart-contract-devs/how-it-works

Data Flow Stages

From left to right in the figure above:

1 - Data Sources

Price feeds come from a diverse set of platforms, including off-chain CEXs (e.g., Binance, Coinbase, Kraken), on-chain DEXs (e.g., Uniswap, Sushiswap, Balancer), and aggregators (e.g., CoinmarketCap, Coingecko, Kaiko), with more than 50 sources currently integrated. Thus, RedStone has access to independent data sources.

2 - Redstone Oracle Nodes

Data providers run independent nodes to aggregate data using various methodologies e.g., median, TWAP, and LWAP, and implement security controls like outlier detection. The refined data is then signed by node operators, ensuring its integrity and quality.

Here a short description of some aggregate methodologies. They are used to derive representative values from multiple data sources. In financial markets and decentralized trading, these methodologies ensure that aggregated data accurately reflects market conditions while minimizing the impact of anomalies or manipulations.

  1. Median: The median is the value that separates a data set into two equal halves. It is particularly useful for eliminating outliers or anomalies because it is not affected by extreme values as the mean might be. For example, if the prices of 5 transactions are 10, 20, 30, 40, and 50, the median is 30.
  2. TWAP (Time-Weighted Average Price): TWAP calculates the average price over a period, weighted by the duration of each interval. This method is useful for smoothing price fluctuations over a given period to obtain a representative value. For instance, if an asset trades at $10 for 10 minutes and then at $20 for 20 minutes, the TWAP would be (1010 + 2020) / (10 + 20) = $16.67.
  3. LWAP (Liquidity-Weighted Average Price): LWAP calculates the average price weighted by the available liquidity at each price level. This approach considers both prices and the amount of the asset available at those prices, providing a more accurate market picture based on order book depth. For example, if an asset is available at $10 with 100 units and at $20 with 50 units, the LWAP would be (10100 + 2050) / (100 + 50) = $13.33.

3 - Data Distribution Layer (DDL)

Within the DDL, feeds are broadcast via both the decentralized Streamr network and directly through open-source gateways managed by RedStone.

Streamr consists of thousands of independently operating nodes distributed globally. Here’s a short introductory video:

In addition of Streamr, open-source gateways managed by RedStone can be easily deployed as needed. This dual broadcasting approach ensures robustness and accessibility, making it highly unlikely for all nodes to fail simultaneously.

Streamr and other gateways by RedStone archive the data on a permanent data storage: Arweave.

The Arweave network is like Bitcoin, but for data: A permanent and decentralized web inside an open ledger.

Permanent storage has many applications: from the preservation of humanity’s most important data, to the hosting of truly decentralized and provably neutral web apps.

The Arweave protocol is stable, mature and widely adopted. As such, its ecosystem is fully decentralized. This site is just the tip of the iceberg. It acts as a map that points you to places you can learn about, use and build on Arweave.

4 - Data Consumers and Target Blockchains

On-chain data transfer can be initiated by a dedicated relayer under predefined conditions, a bot performing tasks like liquidations, or users interacting with the protocol. Once on-chain, the data is unpacked and cryptographically verified to confirm its authenticity and timeliness by checking both the origin and timestamps.

To summarize, RedStone Oracle’s modular concept offers the following advantages:

  • Flexibility and Control: RedStone allows blockchains to decide when and how to fetch price feeds from the Oracle, providing a less cumbersome process and meeting builders’ needs for flexibility while maintaining clean data.
  • Low-Latency: RedStone broadcasts data at very high speeds, ensuring dApps can retrieve data instantly and accurately, essential for fast transactions.
  • Decentralized: The decentralized Streamr network, with a thousand nodes operating independently across the globe, ensures continuous operation without simultaneous failures.
  • Accessibility: Data is accessible from all dApps, blockchains, and applications that have integrated RedStone, providing seamless access across different platforms.

Key Facts

  • The modular architecture maintains data integrity from source to smart contracts
  • There are 3 different ways to integrate RedStone’s service
  • RedStone provides feeds for more than 1000 assets integrating ~50 data sources
  • RedStone is present on 20+ chains
  • RedStone has been live on mainnets since March 2022 with no downtime. Code was audited by ABDK, Packshield and L2Beat Co-Founder.
  • RedStone was a launch partner for DeltaPrime on Avalanche and delivered data feeds not available anywhere else. Thanks to that DeltaPrime became the top 3 fastest growing dApps according to DefiLlama.

Important Links

RedStone website: https://redstone.finance/

RedStone blog: https://blog.redstone.finance/

Zealy: https://zealy.io/cw/redstoneoracles/questboard

X: https://x.com/redstone_defi

Discord: https://discord.gg/KYTkpPX6

Lens: https://hey.xyz/u/redstone_oracles

--

--