Getting Started with Insight: Query Blockchain Data with Simple API Calls
Blockchain data is essential for every web3 app and game, but accessing it quickly and reliably can be challenging. thirdweb Insight provides developers with a simple way to index, transform, and query onchain data through easy-to-use REST APIs - no complex infrastructure or subgraph framework required.
What is Insight?
Insight is a powerful tool that lets you retrieve blockchain data from any EVM chain, enrich it with metadata, and transform it using custom logic. Whether you're building a gaming inventory system, tracking DeFi metrics, or analyzing NFT collections, Insight makes it easy to get the data you need with simple API calls.
Getting Started
Watch a quick video tutorial or follow the steps below to see how to start using Insight to index onchain data for your web3 application
Creating Your API Key
Before getting started with Insight, you'll need an API key to authenticate your requests. Insight offers a generous free tier and simple pricing structure:
- Free Tier: 300,000 queries per month
- Pay as you go: $25 per 1 million queries
- Growth tier: 10,000,000 queries per month with higher rate limits
- Head to your thirdweb dashboard and connect your wallet
- Next, go to the "Projects" tab. Hover over the "Add New" button and select "Project"
- Fill out the parameter for your project then click "Next"
- You now have a client ID (API key) that you can use
Exploring the API Reference
Visit https://insight-api.thirdweb.com/reference to explore all available endpoints. The API offers comprehensive querying capabilities that give you precise control over your blockchain data queries.
When making requests, you can customize your queries using various parameters. Need to filter specific transactions? The filter
parameter lets you narrow down results based on your criteria. For data analysis, use group_by
to aggregate results and aggregate
to apply computational functions to your data.
Managing large datasets is simplified with pagination controls - use page
to navigate through results and limit
to control how many items you receive per request. You can also organize your data using sort_by
and sort_order
parameters, making it easy to arrange results by block number, timestamp, or other fields.
Each response provides comprehensive blockchain data including detailed block information (hash, number, and timestamp), complete transaction details, chain identification, and specific event data. The response also includes helpful metadata about pagination and total items, making it simple to handle large datasets effectively.
Example: Tracking USDC Transfers
Let's start with a practical example: fetching the latest USDC transfers on Ethereum. Here's how to get the 10 most recent transfers:
https://1.insight.thirdweb.com/v1/${CLIENT_ID}/events/${USDC_CONTRACT}/Transfer(address,address,uint256)?sort_by=block_number&sort_order=desc&limit=10
https://1.insight.thirdweb.com
The base URL where 1
represents Ethereum mainnet's chain ID
/v1/${CLIENT_ID}
Your thirdweb API key for authentication
/events
Specifies that we're querying event data
/${USDC_CONTRACT}
The contract address we're getting data from (in this case, USDC)
/Transfer(address,address,uint256)
The event signature we're filtering for
Query parameters:
sort_by=block_number
: Sort results by block numbersort_order=desc
: Show newest transfers firstlimit=10
: Return only 10 results
This simple query gives you real-time access to USDC transfer data, perfect for building transaction history displays or analyzing token movements.
What Can You Build with Insight?
Gaming Applications
- Track player-owned assets by monitoring NFT transfers
- Display earned tokens and rewards
- Build real-time inventory systems
DeFi Analytics
- Calculate token metrics like 24-hour trading volume
- Analyze protocol gas efficiency
- Track token ownership distribution
NFT Platforms
- Get complete transfer history for collections
- Display wallet-owned NFTs across chains
- Track collection trading activity
Wallet Features
- View cross-chain transaction history
- List all ERC-20 token holdings
- Monitor staking positions
Open Source
Like all thirdweb products, Insight is fully open-source. Check out our GitHub repository at https://github.com/thirdweb-dev/insight if you're interested in deploying your own instance.
Conclusion
Whether you're building a game, DeFi dashboard, or NFT marketplace, Insight provides the blockchain data infrastructure you need with the simplicity of REST APIs. Try it out at https://insight-api.thirdweb.com/reference and join the thousands of developers already building with thirdweb.
If you have any questions or need further assistance, thirdweb’s support team is always available to help. Until next time, happy building!