Skip to main content

What Are the Computational Costs of Implementing a TWAP versus a VWAP Oracle on a Blockchain?

The computational costs of implementing a TWAP oracle on a blockchain are generally lower than those of a VWAP oracle. A TWAP oracle only needs to store and update a cumulative price value and a timestamp at regular intervals.

A VWAP oracle, on the other hand, needs to store and update both a cumulative price-volume value and a cumulative volume value. This requires more storage and more complex calculations, resulting in higher gas costs.

The difference in cost can be significant, especially on blockchains with high transaction fees.

What Is the Computational Advantage of Using a Merkle Tree over Simply Hashing the Entire Block Data?
In Which Market Conditions Would a TWAP Oracle Be More Reliable than a VWAP Oracle?
What Are the Primary Vulnerabilities of Using a TWAP Oracle in a DeFi Protocol?
How Does a TWAP Oracle Differ from a Volume-Weighted Average Price (VWAP) Oracle?