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

  • Total Value Locked (TVL)

    Total Value Locked (TVL): DeFi’s Scorecard TVL measures how much money is deposited in DeFi protocols. It’s like measuring the size of a bank by its total deposits – bigger usually means more trust and activity. Total Value Locked (TVL) is the aggregate value of all assets deposited in a DeFi protocol or across the…

  • 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…

  • Floor Price

    Floor Price: The Cheapest Entry Point Floor price is the lowest price you can buy into an NFT collection. It’s the most watched metric in NFT trading and often determines a project’s perceived value. Floor price is the lowest listed price for any NFT in a collection on marketplaces. It represents the minimum cost to…

  • zk-STARKs

    zk-STARKs: Advanced Zero-Knowledge Proofszk-STARKs are cryptographic proofs that enable verification of computations without revealing underlying data, offering better scalability than earlier zero-knowledge technologies. They're like magic tricks where you can prove the trick worked perfectly without revealing how it was done, even to expert magicians.zk-STARKs (Zero-Knowledge Scalable Transparent Arguments of Knowledge) are advanced cryptographic proofs…

  • Mixing Service

    Mixing Service: Shuffling Coins for Privacy Mixing services (or tumblers) pool cryptocurrencies from multiple users then redistribute different coins to break transaction links. It’s like exchanging your marked bills for unmarked ones. A mixing service is a privacy tool that pools cryptocurrencies from multiple users and redistributes them to break the link between sending and…

  • Full Node

    Full Node: Complete Blockchain ParticipantA full node maintains a complete copy of the blockchain and validates all transactions independently. It's like having the complete library instead of just borrowing books when you need them.A full node is a computer that downloads, stores, and validates the complete blockchain history while participating in network consensus and transaction…