Time-Weighted Average Price (TWAP)

Time-Weighted Average Price (TWAP): Manipulation-Resistant Pricing

TWAP calculates asset prices over extended time periods to resist manipulation and provide more stable price references for protocols. It’s like taking your temperature every hour instead of just once.

Time-Weighted Average Price (TWAP) is a pricing mechanism that calculates the average price of an asset over a specific time period, reducing the impact of short-term price manipulation. TWAP oracles provide more stable price feeds for DeFi protocols.

How TWAP Works

Continuous sampling records asset prices at regular intervals throughout the measurement period rather than relying on single point-in-time prices.

Weighted averaging gives equal weight to each time period, preventing large trades or manipulation attempts from skewing the overall price calculation.

Manipulation resistance makes it expensive and difficult for attackers to influence TWAP prices since they would need to sustain artificial prices over extended periods.

TWAP calculation flow showing price sampling, weighted average, manipulation resistance, and stable price feed

Real-World Examples

  • Uniswap V2/V3 provides TWAP oracles that many protocols use for price feeds
  • MakerDAO uses TWAP prices to prevent flash loan attacks on collateral valuations
  • Compound leverages TWAP pricing to resist oracle manipulation in lending markets

Why Beginners Should Care

Protocol security depends on manipulation-resistant price feeds to prevent flash loan attacks and other exploitation attempts.

Stable liquidations using TWAP prevents users from being liquidated due to temporary price spikes or manipulation.

Lagging prices mean TWAP feeds may not reflect rapid legitimate price movements, potentially affecting trading efficiency.

Related Terms: Oracle, Price Manipulation, Flash Loan Attack, Price Feed

Back to Crypto Glossary

Similar Posts

  • Cross-Chain Messaging

    Cross-Chain Messaging: Inter-Blockchain Communication Cross-chain messaging enables smart contracts on different blockchains to communicate and trigger actions across networks. It’s like having a universal translator for blockchain conversations. Cross-chain messaging allows smart contracts on different blockchain networks to send data, trigger functions, and coordinate actions across multiple chains. This enables true interoperability beyond simple asset…

  • Price Impact

    Price Impact: Trade Size Effect on Market PricesPrice impact refers to how trading activity affects cryptocurrency prices, particularly when large orders move markets significantly. It's like how jumping into a small pool creates bigger waves than jumping into an ocean.Price impact is the effect that trading activity has on cryptocurrency prices, with larger trades typically…

  • Cross-Chain Protocol

    Cross-Chain Protocol: Blockchain Communication StandardsCross-chain protocols establish standardized methods for different blockchain networks to communicate and transfer assets safely. They're like diplomatic translation services that enable countries speaking different languages to negotiate treaties and trade agreements.Cross-chain protocols are standardized communication frameworks that enable different blockchain networks to exchange information, transfer assets, and coordinate operations across…

  • Light Node

    Light Node: Efficient Blockchain ParticipationA light node participates in blockchain networks without storing the complete blockchain history. It's like having a summary of the news instead of keeping every newspaper ever published.A light node is a type of blockchain node that maintains network connectivity and basic verification capabilities without storing the complete blockchain history or…

  • SocialFi

    SocialFi: Social Media Meets Financial Incentives SocialFi combines social networking with decentralized finance, rewarding users for creating content and engaging with communities. It’s like getting paid to post, but with actual economic models behind it. SocialFi refers to social finance applications that integrate social media features with DeFi economics, enabling users to monetize social interactions…

  • LayerZero

    LayerZero: Omnichain Interoperability Protocol LayerZero is an interoperability protocol that enables applications to send messages and transfer assets across different blockchains. It’s like having a universal translator for blockchain networks. LayerZero is a cross-chain communication protocol that enables decentralized applications to operate across multiple blockchains seamlessly. It provides infrastructure for omnichain applications that can access…