Securing the DeFi derivatives market presents an opportunity to bring a massive amount of value into Web3. In traditional financial markets globally, derivatives represent over $1 quadrillion in value, offering a sea of opportunity for disruption and improvements from DeFi-based alternatives. In this post, we’ll walk through an innovative solution that Chainlink is building—ultra low-latency pull-based price oracles—to enable and secure this immense on-chain market.
Technical Challenges in the DeFi Derivatives Market
DeFi derivatives use a hybrid smart contract infrastructure that combines blockchain-based logic with off-chain oracle computation. The on-chain contract records state changes and redundantly stores the contract across the network, while oracles connect the contract to external inputs for retrieving underlying market data and triggering settlement outputs.
Building DeFi derivatives protocols involves several technical complexities that have historically slowed the maturation of derivatives markets within the Web3 ecosystem. In this section, we’ll walk through the key technical challenges that on-chain derivatives products need to solve to see wider adoption.
Data Latency and Freshness
Latency refers to the time delay that a process takes to complete. In the context of blockchains, latency commonly refers to the time it takes to finalize a transaction since the time of propagation. For oracle networks, latency refers to the time it takes for an oracle report to be confirmed on-chain. Additionally, latency in oracle networks can refer to the staleness (or freshness) of a data point, referring to how much time has elapsed since the previous update.
Because crypto asset prices can fluctuate by fractions in extremely short periods of time and traders seek to secure assets at their most up-to-date price, DeFi derivatives platforms, particularly on-chain perpetual futures, must be able to access market data that is both freshly updated and provided in a low-latency manner. Increased latency or reduced freshness can lead to poor trade execution, opening the window for value to be extracted via techniques such as Maximal Extractable Value (MEV) as traders can reliably predict the direction of an on-chain oracle price update, even just seconds in advance. Such value extraction opportunities can present themselves in the mempool (the location where unconfirmed blockchain transactions reside) or on centralized exchanges that represent a significant share of total trading volume during large price movements.
Lack of Data Privacy Pre-Settlement Increases MEV and Frontrunning Risk
If oracle price data is made publicly available before it is consumed by a DeFi derivatives protocol, such as viewing the data on another blockchain before the data is bridged cross-chain or in the transaction mempool, then malicious actors can extract value from traders by frontrunning the oracle update. Publicly viewable oracle data before trade settlement can result in the same value extraction issues as (and even cause additional issues) as high data latency and reduced freshness. DeFi derivative protocols commonly overcome this dynamic by increasing users’ trading fees at the expense of being a less competitive protocol.
Infrastructure and Maintenance Costs
Data pulled from a single source, or even a collection of exchanges without proper weighting, can introduce significant risks of downtime or manipulation attacks. Trading volume can easily shift from one market to another, exposing contracts to a massive risk of failure as illiquid markets price assets incorrectly. Maintenance of price feed oracles is essential, as oracle networks must be continuously monitored to ensure their proper operation and to assess the ever-changing blockchain landscape to identify new risks and areas of concern.
A New Low-Latency Pull-Based Oracle Solution from Chainlink
Given the immense potential of derivatives within the DeFi space and their expanding adoption, we are proud to introduce a new oracle solution for financial market data under development that features an evolution in architectural design tailored precisely to meet the unique requirements of derivatives dApps. We anticipate that a testable version of this new pull-based Chainlink oracle solution will be ready by the end of the year.
This architecture leverages high-speed data providers combined with Chainlink Decentralized Oracle Networks to deliver high-frequency pricing data to derivative dApps off-chain, while still providing on-chain verification.
In comparison to Chainlink Price Feeds—decentralized oracle networks that update an on-chain reference contract—this new oracle solution features a pull-based approach where oracle reports are attached directly to user transactions off-chain and validated on-chain. This approach introduces these important benefits:
- Ultra-low latency: oracle updates are generated off-chain which can then be directly attached to user transactions, reducing the latency of updates by multiple orders of magnitude.
- Frontrunning mitigation: prices are kept private until transactions are settled, providing a solution that mitigates frontrunning risk by shielding pricing information from being observed by potential arbitrageurs. Without pre-settlement oracle privacy, value can continue to be extracted from traders by malicious actors, reducing the ability for DeFi projects to stay competitive in the derivatives landscape.
- Reduced gas costs: The cost of validating oracle updates from the new pull-based Chainlink oracle solution is significantly more gas-efficient and doesn’t require data to be published to a separate blockchain before being delivered on-chain.
This new oracle solution will be secured by the same collection of world-class oracle nodes that underpin Chainlink Data Feeds and have already secured trillions of dollars in transaction volume in 2022 alone. Furthermore, individual node signatures will also be directly verified on-chain to increase trust-minimization guarantees and feature granular staleness checks based on L2 block numbers (or timestamps).This blended architecture is a deliberate design choice that delivers the low-latency data feeds that DeFi derivatives protocols require, without compromising on essential security and reliability requirements.
Let’s explain the solution in more detail and how it works step-by-step. For this example, we will assume that a DeFi project is using this solution on a layer 2 chain such as Optimism.
In the first phase,
- Let’s say the user commits a trade for 10 ETH to be paid in a USD stablecoin such as USDC.
- This goes to the DeFi derivative project’s client contract, which commits to trade it like a market order.
In the next phase,
- The process to settle the trade is kicked off after initiation with the L2 chain’s block number.
- The blob with price, timestamp, L2 block number, and digital signature is returned by the on-demand oracle.
- It is included in the settlement transaction so that the Chainlink verify contract can verify the digital signatures and unpack the price, timestamp, and L2 block number.
- This is all returned to the client contract to perform a staleness check and settle the trade. If any checks fail, the transaction will revert. If not, the trade is settled.
This new oracle solution is designed to help meet the low-latency, low-cost requirements that DeFi derivatives require while also helping to mitigate risk around arbitrage, frontrunning and MEV, data quality and availability, and other key technical factors for protocol security. We are excited to help enable this key financial primitive through reliable oracle infrastructure and bring DeFi and Web3 to more users with the security assurances they expect.
To learn more about Chainlink, subscribe to the Chainlink newsletter and follow the official Chainlink Twitter to keep up with the latest Chainlink news and announcements.