Manipulating DeFi data is too easy – and current Oracle solutions don’t help much

It seems like every week we hear news from a different DeFi project that is being hacked or exploited. The most recent casualty includes projects like Harvest Finance, Akropolis, Value DeFi, Origin and of course Compound.

When exploits occur, they usually have to manipulate the reference price like ETH / DAI in a data source like Curve, Kyber or Coinbase Pro. Sometimes it’s a mistake, as in the SNX case where the Korean won was given with the wrong decimal place.

Connected: Finance redefined: they get hacked, they get hacked, everyone gets hacked

As decentralized funding increases, the potential for exploits will certainly increase. DeFi becomes more complex as more assets are accepted as collateral. Complexity will also increase as indices become more widespread and options that are settled at fair market value will reach their potential. The success of these results depends on accurate, secure data that is free from tampering.

What chance do these less fluid reference values ​​have of warding off attacks if something like ETH / DAI is manipulated in this way? Some of them are hardly traded in a few places and almost exclusively on decentralized exchanges. Others are calculated values ​​that depend on third parties.

Mitigating the risk of hacks and exploits for DeFi

Several oracles. Each oracle is structured differently in its preferred data sources. how to reach consensus on the data; and how they calculate these prices. One possible option when dealing with fewer fluid pairs is to use multiple oracles. While this brings with it additional costs, emerging oracles have made great strides in reducing costs compared to ancient oracles.

Set limits All around prices would serve as a sanity check. We can set minimum and maximum values ​​for stablecoins in order to reduce the potential exploit. For example, one could price Dai between $ 0.97 and $ 1.03.

Circuit breaker. We can define trading areas for cryptocurrency pairs other than area-linked stablecoins. And should these areas be violated, we can introduce a cooling off period. This would work similarly to the breakers used by Nasdaq and other traditional financial markets. You should only restart after the cooling off period.

Averages. Depending on the application of the DeFi project, the time-weighted average price and / or the volume-weighted average price for different time periods can also weaken attacks on less liquid prices. By using time and volume averages, a sudden and temporary price shock has less of an impact on the reference price. Andre Cronje brings this to the extreme in his Keep3r oracle, where he uses the daily average price.

Market fixtures. When attacks occur, they often only take advantage of one side of the market internals, e.g. B. only bids. Large and sudden fluctuations in bid / ask spreads should be a sign that something is wrong. As an industry, we should pay attention to these events and program warnings when they occur.

Volatility index. Implied volatility (IV) plays a crucial role in finance. It is the basis on which options are valued. Even in mature and liquid markets like the CBOE Volatility Index, a volatility index that spans the $ 30 trillion S&P 500, there are still attempts at tampering. Current DeFi implied volatility calculations are based on the IV in Deribit’s European option prices. The implied volatility based on the option price, the remaining term, the exercise price, the spot rate and the applicable interest rates are hedged using different methods. The implied volatility should be checked for abnormal shocks, e.g. E.g. a sudden increase or decrease in IV values ​​relative to the underlying or the market as a whole. While IV is an indication of future expectations for volatility, there are usually correlations with underlying asset and / or market volatility in general. In addition, the time-weighted or volume-weighted IV should also be taken into account for options with cash settlement, especially shortly before the due date.

Better oracles for a better DeFi ecosystem

In an ideal world, we can collect data from multiple sources that are difficult and / or costly to manipulate.

For one thing, existing oracles only support the largest cryptocurrency pair and often don’t update the price often enough. For example, Compound decided to use Coinbase Pro over Chainlink, which may have been a confusing choice for many.

Even Chainlink only updates the Dai contract once every 24 hours or when the price moves 2%. The connection was therefore forced to choose between fresh / vivid data or data without tampering. Had they chosen Chainlink over Coinbase Pro, it would still be possible that they would have suffered losses while Dai’s price was rigged to swing in the 2% range. But it would have been a death from a thousand cuts rather than the catastrophic wound they suffered.

Many cryptocurrencies are only traded on one or two exchanges, sometimes only on decentralized exchanges, have very little liquidity and suffer from high volatility. In such and other situations, DeFi projects need to work with oracles that provide the breadth of data needed, as well as the liveliness of the data that are essential to them.

Every DeFi project is faced with a unique and different set of variables. Therefore, not all proposed solutions are suitable for every project. A project should consider its unique data requirements and the tradeoffs appropriate to its needs.

The views, thoughts, and opinions expressed here are the sole rights of the author and do not necessarily reflect or represent the views and opinions of Cointelegraph.

Samuel Kim is a founding partner of Umbrella Network, a layer two oracle that supports the next generation of DeFi applications. Previously he was the founder and CEO of Lucidity, a blockchain-based transparency solution for digital advertising, and co-founder of Gimbal, a mobile advertising platform. He is a graduate of Columbia University and received his MBA from the Chicago Booth School of Business, where he focused on analytical finance.