Skip to main content

Overview

Chunk Oracle

The Chunk oracle is optimized for storing and efficiently updating a significant number of on-chain metrics. Metric examples are token prices, stock and commodity prices, currency rates, bond yields, macro indicators, sensor time series, etc. The logarithmic delta encoding is applied to metric updates. Together with batched updates, this yields impressive network fee savings.

The alpha version of the oracle quoted 172 crypto-assets of the Unit Protocol on BSC, Gnosis, Polygon, Fantom, Arbitrum, Aurora, Avalanche, Bittorrent, Boba, CLV Chain, Celo, Cronos, Dogechain, Ethereum Classic, Harmony, Heco, Klaytn, Moonbeam, Moonriver, Oasis, Okex, Optimism, Syscoin blockchains at the same address 0xf315a5cc91338a3886d3c3a11E7b494f3302B3fA.

The gas cost of one update was 73 300 gas, the value update precision is 0.2%. The oldest contract is operational since mid-2021 and processed over 25 000 updates.

It would take $563 a day to update the Ethereum mainnet 2 times an hour if the gas price was 40 gwei, and the Ether price was $4000 - about $3 per asset per day.

Another protocol called ProofFeed allows for literally free price updates for validators as updates are delivered on-demand during a user interaction with a third-party protocol (e.g. a lending dApp).

The solution is designed with decentralization in mind. The metric feeds may be constructed by multiple parties off-chain and delivered with a single verifiable threshold signature on-chain, see below. This results in significant gas savings compared to other oracle protocols, e.g. Chainlink.

The importance of off-chain logic cannot be underestimated, as explained below.

Overall Architecture

Chunk Architecture Diagram

Flow

Adding Metrics

Metrics have to be added to the contract to allow querying and updating. The process is quite straightforward and utilizes the regular quoting mechanics to get the initial value. The access control is the same as for updating quotes, however, any other viable governance strategy may be implemented.

There may be several on-chain oracles with different precision/gas cost trade-offs.

Quoting

Each metric's quoting process is defined by a feed. Typically, a feed is a smart combination of data feeds from the most reliable sources of liquidity for the particular financial asset or trustworthy sources of other real-world data.

Another key idea behind the quoting approach is the elimination of reliance on any single centralized party, data feed, or asset. For example, we never rely on the correctness of Binance data and never assume prices of major stablecoins are close to US $1.

Finally, all the data feeds are implemented with built-in flash loan resistance to eliminate the typical weak spot of oracle solutions.

Multiparty Operation

Multiparty ECDSA is considered a solution to the decentralization goal since at the moment only the ECDSA verification is relatively cheap on the Ethereum mainnet. An additional blockchain network (so-called side network) is used to coordinate protocol validators and provide intermediate data storage. The benefits of using a side network:

  • no central point of communication (and hence failure)
  • participants are DDoS-protected
  • the network can be easily switched
  • protocol does not trust the side network

On-chain Querying

Only one function with an intuitive interface should be called to get a metric value. The value interpretation depends on the value format of the feed. The oracle protocol itself and smart contracts are format-agnostic and flexible.

Metric metadata is available as well: description, currency, tags.

Components

Oracle Contract

The contract is quite minimalistic. For each metric, it keeps metadata, the value at some moment in the past, and the difference (delta) to calculate the last known value on the fly. It is much cheaper to store a batch of differences than to update the values one by one.

Additionally, the contract exposes several view functions to support the updater library operation (see below).

Updater Library

Since the contract exposes quite a low-level data model (as well as some other primitives), the approach to updating the quotes can be quite flexible and can be changed on the fly. It will not require the contract redeployment as quote updating is coded off-chain in a form of a library. The idea is simple: if the difference between the base value and the current value can be represented by a small delta, use the delta. Otherwise, set the base value to the current value.

Because a delta is valid only for a particular base value, we must ensure that the base value is not updated concurrently. Epochs checks prevent such race conditions.

Side Network

A side network is maintained by the protocol validators as a cheap and robust trustless data exchange medium. Robust operation is achieved by fast consensus algorithm and low block times. Additionally, such a network can support real-time feeds.

Quoting Library

A set of metrics is expressed in a configuration file. The quoting library processes the metrics and constructs a tree of objects called feeds. Here we take a modular approach to decompose a quoting task as a tree of ready-made feeds, e.g. UniswapV3Feed.

Daemon

There is the last piece to glue things together - the code that pulls data from quoting library and feeds it into the contract using the updater library. This code can be run as a Unix daemon or as a Docker container.

ChainlinkCompatibility Contract

We provide Chainlink-compatible aggregator IChainlinkAggregatorV2V3Interface for every quoted metric via special contract which is able to generate numerous aggregators in a gas-efficient way.

Core Features

Decentralization & Efficiency

Chunk integrates decentralized techniques such as multi-signatures, threshold signatures, and multiparty ECDSA, enabling multiple parties to construct price feeds off-chain.

On-Chain Data Compression

Advanced data packing methods allow for high-level on-chain compression, consolidating several metric updates into a single contract storage slot, instead of using one slot for each update. This process significantly reduces gas costs.

Robust Specifications

Designed to eliminate single points of failure, our system includes security features that enhance reliability. By coordinating through a side network, we foster a more secure and trustworthy solution.

Interoperability & Innovation

Pioneering the integration of RWAs (Real-World Assets), we deliver reliable, fast, and affordable data feeds. This is further exemplified by our extensive cross-chain interoperability, connecting private blockchains, public chains, and Layer 2 solutions.

Assets Coverage

Adding any asset is swift and simple on Chunk. By the moment the oracle provides data feeds for assets like stablecoins, tokens, Compound tokens (cTokens), Yearn Vaults, Sushiswap LP tokens, Uniswap LP tokens, Uniswap V2 LP tokens, 3Pool LP tokens (3crv), Curve LP as well as real-world assets (RWAs) like stocks, bonds, and commodities. This diversity unlocks new possibilities for DeFi innovation.

Network Coverage

Chunk oracles are designed to integrate with any EVM-compatible network, ensuring seamless functionality and broad compatibility across various blockchain environments.

Detailed Prices feature

Validators typically provide prices without clarifying their components or origins. Chunk changes that.

The concept of Detailed Prices Layer:

Component Insight

  • Reveals the individual elements contributing to the final price, offering a clear understanding of each part.

Source Transparency

  • Details exactly where each price comes from, including the specific exchanges or APIs used.

Unified Understanding

  • Explains the process of combining prices and the total work involved, presenting a comprehensive picture of price formation.
There was an error loading this image

Security Design

Chunk's oracle solution embodies resilience, ensuring uninterrupted functionality.

Network Resilience

Even if one of the networks in the conjunction fails (the network used for cost-effective calculations), the oracle's operation remains unaffected. This redundancy allows for a seamless switch to any supported network, maintaining the integrity and reliability of the data feed.

Example: If the primary network used for calculations experiences downtime, the system will be shifted to another available network, ensuring no interruption in data delivery to the target network, such as Ethereum.

Efficiency in Data Recording

Strategic Utilization of Networks

By employing a bifurcated strategy, we leverage cost-effective networks for complex, gas-intensive transactions, while reserving networks typically associated with higher costs for the final recording. This strategic approach allows for optimal cost management without compromising data integrity.

Batch Processing and Consolidation

Our data recording occurs in batches within a single contract. This contract hosts all the feeds we write, eliminating the need to manage multiple contracts. Whether it's a new asset or feed, we simply include it in the validators' configurations, making the data available within the main contract for user access.

On-Chain Data Compression

While a single slot record costs 20k gas, our method allows for multiple metric updates within a single slot. Instead of dedicating one slot for each metric update, we compactly pack several metric updates into just one slot, leading to significant gas savings.