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

  • Message Relay

    Message Relay: Cross-Chain Communication HubMessage relay systems transport data and instructions between different blockchain networks. They're like postal services for blockchain messages, ensuring information gets delivered across network boundaries.Message relay refers to infrastructure that enables communication between different blockchain networks by transporting data, transaction proofs, and execution instructions across chain boundaries. These systems enable cross-chain applications…

  • Staking

    Staking: Earning Rewards by Holding Crypto Staking turns your crypto into a money-making machine. Hold tokens, earn more tokens – it’s that simple. But the devil’s in the details. Staking is the process of locking up cryptocurrency tokens to support a blockchain network’s operations and earning rewards in return. Think of it as earning interest…

  • Gaming Token

    Gaming Token: In-Game Digital CurrencyGaming tokens are cryptocurrencies designed specifically for use within video games and virtual worlds. They enable player ownership, trading, and monetization of in-game assets and achievements.Gaming tokens are cryptocurrencies created for specific video games or gaming ecosystems, enabling player ownership of in-game assets, rewards, and economic participation. These tokens bridge traditional gaming…

  • Secure Element

    Secure Element: Hardware Security ChipA secure element is a tamper-resistant hardware chip designed to store sensitive information like private keys. It's like having a tiny vault built into your device that's extremely difficult to break into.A secure element is a specialized hardware component designed to provide isolated, tamper-resistant storage and processing for sensitive data such…

  • Transaction Privacy

    Transaction Privacy: Protecting Financial InformationTransaction privacy involves keeping cryptocurrency transaction details confidential while maintaining network security and functionality. It's like having a private bank account in a transparent financial system.Transaction privacy refers to techniques and technologies that protect the confidentiality of cryptocurrency transaction details including amounts, participants, and transaction history. This enables financial privacy while maintaining…

  • Digital Currency

    Digital Currency: Electronic Money SystemsDigital currency refers to money that exists only in electronic form, including both centralized and decentralized varieties. It's like having money that lives entirely in computers and phones instead of physical bills and coins in your wallet.Digital currency encompasses all forms of money that exist exclusively in electronic format, including cryptocurrencies,…