Skip to main content
Track Uniswap V3 swap events to extract real-time price data, calculate trading volumes, and analyze on-chain liquidity dynamics. Unlike centralized exchanges, DEX data is verifiable and tamper-proof, ideal for building trustless price oracles and analytics.

Use Case

DEX swap indexing unlocks powerful analytics:
  • Price Discovery: Extract real-time token prices from swap amounts without relying on third-party APIs
  • Volume Analysis: Calculate 24h trading volumes, identify trending pairs, and detect unusual activity
  • Liquidity Tracking: Monitor pool depth changes and identify liquidity migration patterns
  • MEV Detection: Analyze sandwich attacks, arbitrage opportunities, and front-running patterns by correlating swaps within blocks

Code Example

Try it yourself with the interactive query interface below:

Key Parameters

The Swap event signature varies by DEX. Uniswap V3 uses a different signature than Uniswap V2 or other DEXs.

Expected Output

Track Specific Pool

Monitor swaps for a specific trading pair:

Uniswap V2 Swaps

For Uniswap V2, use the V2 Swap event signature:
Different DEX protocols use different event signatures. Check the contract ABI to find the correct signature for your target DEX.

Decode Swap Amounts and Calculate Prices

The real value in DEX data comes from decoding swap amounts to calculate prices. Here’s how to extract and interpret Uniswap V3 swap data:

Advanced Analysis: Detecting MEV Sandwich Attacks

Sandwich attacks are a common MEV strategy where an attacker places trades before and after a victim’s transaction to profit from price impact. By analyzing swap sequences within blocks, you can detect these patterns:
MEV detection requires analyzing transaction ordering within blocks. Make sure to request transaction fields and transactionIndex to properly sequence trades.

Advanced Analysis: Multi-Hop Swaps and Arbitrage

Many swaps route through multiple pools via aggregators like 1inch or Uniswap’s Universal Router. By combining swap events with traces, you can reconstruct complete arbitrage paths and calculate profitability:
Combine swap events with traces to capture the full execution path, including intermediate token approvals and transfers that don’t emit swap events.

Performance Tips

  1. Filter by pool address: Query specific high-volume pools (USDC/WETH, WETH/USDT) instead of all swaps
  2. Use block ranges: Process 10k-50k block batches for optimal throughput
  3. Batch decode: Decode multiple events in parallel rather than sequentially
  4. Cache pool metadata: Store token decimals and symbols to avoid repeated lookups
  5. Combine with traces: Track multi-hop swaps and MEV activity by analyzing call traces alongside events

Query Event Logs

General event log querying

Query Traces

Track multi-hop swaps with traces

Track NFT Transfers

Monitor NFT marketplace activity

API Reference

View complete API docs