Ormer: A Manipulation-resistant and Gas-efficient Blockchain Pricing Oracle for DeFi
<|reference_start|>Ormer: A Manipulation-resistant and Gas-efficient Blockchain Pricing Oracle for DeFi: Blockchain oracle is a critical third-party web service for Decentralized Finance (DeFi) protocols. Oracles retrieve external information such as token prices from exchanges and feed them as trusted data sources into smart contracts, enabling core DeFi applications such as loaning protocols. Currently, arithmetic mean based time-weighted average price (TWAP) oracles are widely used in DeFi by averaging external price data with fixed time frame, which is considered reliable and gas-efficient for protocol execution. However, recent research shows that TWAP price feeds are vulnerable to price manipulation attack even with long time frame setting, which would further introduce long time delays and price errors hindering the service quality of DeFi applications. To address this issue, we propose a novel on-chain gas-efficient pricing algorithm (Ormer) that heuristically estimates the median of the current streaming asset price feed based on a piecewise-parabolic formula, while the time delay is suppressed by fusing estimations with different observation window size. Our evaluation based on Ethereum WETH/USDT swapping pair price feed shows that Ormer reduces the mean absolute price error by 15.3% and the time delay by 49.3% compared to TWAP. For gas efficiency, an optimized smart contract design and constant storage requirement regardless of the number of price observations is developed for Ormer.<|reference_end|>
@article{bai2024ormer:,
    title={Ormer: A Manipulation-resistant and Gas-efficient Blockchain Pricing
  Oracle for DeFi},
    author={Dongbin Bai, Jiannong Cao, Yinfeng Cao, Long Wen},
    journal={arXiv preprint arXiv:2410.07893},
    year={2024},
    archivePrefix={arXiv},
    eprint={2410.07893},
    primaryClass={cs.CR}
}