Insight FAQs

Aggregation Queries

How do I use aggregations in my queries?

You can include aggregation functions directly in your API requests. Here's an example:

// Get total transaction value and average gas used
const response = await fetch(
"https://10.insight.thirdweb.com/v1/transactions?aggregate=count() AS transaction_count&aggregate=sum(value) AS total_value_wei&aggregate=avg(gas_used) AS avg_gas_used",
);

Where can I find examples of using aggregations?

You can find working examples and experiment with different aggregation presets in the Insight Playground. The Playground provides a user-friendly interface to build and test your aggregation queries.

What are some common use cases for aggregations?

  • Calculating total trading volume
  • Finding average transaction values
  • Counting unique users/wallets
  • Analyzing gas usage patterns
  • Tracking NFT collection statistics

Can I create custom aggregations?

Yes, you can create custom aggregations using standard SQL aggregation functions like count(), sum(), avg(), min(), max(), and countDistinct(). The presets are just convenient shortcuts for common operations.

Where can I learn more about available presets?

You can find the complete list of available aggregation presets in the Insight Playground, where you can also test them with real blockchain data.

More information coming soon.