Overview
Sim by Dune is a real-time, multichain developer platform that provides scalable APIs and indexing infrastructure for building onchain applications. It offers the fastest way to access live blockchain data across 60+ chains, including Sei, with zero DevOps overhead. In this tutorial, you’ll learn how to set up Sim, build your first data pipeline, and create powerful onchain applications on Sei. To understand more and deep dive into how it works under the hood, please refer to the Sim by Dune DocumentationWhat this guide teaches you:
This tutorial guides you through:- Setup: Get your Sim API key, install dependencies, and connect to Sei
- Core APIs: Learn to use all 6 Sim APIs with practical examples
- End-to-End Examples: You’ll run practical code to:
- Fetch Sei token balances with USD values
- Monitor wallet transactions and activity
- Get token metadata and holder information
- Track NFT collections and metadata
- Production Ready: Error handling, rate limiting, and monitoring
Some Use Cases:
- DeFi Analytics Platforms: Real-time tracking of liquidity, volumes, and yields across Sei protocols
- Portfolio Trackers: Multi-chain portfolio management with Sei integration
- Trading Bots: Automated trading based on real-time onchain signals
- Risk Management: Monitor positions and liquidation risks across protocols
- Governance Tools: Track voting power and proposal activity
- MEV Analysis: Detect and analyze MEV opportunities on Sei
Supported APIs
Sim by Dune provides access to comprehensive EVM blockchain data through these core APIs:Balances API
- Features: All EVM token balances for a wallet or address, ordered by USD value
- Use cases: Portfolio trackers, wallet applications, asset management dashboards
Transactions API
- Features: Quick and accurate lookup of EVM transactions associated with any address
- Use cases: Transaction monitoring, compliance tools, activity tracking
Token Info API
- Features: Metadata including symbol, name, decimals, supply information, logo URLs, and realtime prices
- Use cases: Token discovery, price tracking, market analysis
Token Holders API
- Features: Holders of an ERC20 token, sorted by balance
- Use cases: Governance analysis, token distribution studies, whale tracking
Activity API
- Features: Derived activities including swaps, transfers, and approvals within transactions for any address
- Use cases: DeFi analytics, trading analysis, user behavior tracking
Collectibles API
- Features: All NFT (ERC721 and ERC1155) balances, including IDs and metadata
- Use cases: NFT marketplaces, collection analytics, digital asset management
Quick Start
1. Getting Your API Key
To use Sim APIs, you’ll need an API key from the Sim dashboard:- Visit Sim Dashboard: Go to sim.dune.com
- Sign Up/Login: Create an account or login with your existing Dune account
- Navigate to Keys: In the left sidebar, click on “Keys”
- Create New Key: Click the “New” button to generate a new API key
- Select API Type: Choose “Sim API” as the key’s purpose
- Copy Your Key: Save the generated API key securely
2. Project Setup
.env file:
3. Your First API Call
Createindex.js:
API Examples
Balances API - Get Token Balances
Transactions API - Monitor Wallet Transactions
Token Info API - Get Token Metadata
Token Holders API - Find Top Holders
Activity API - Track Swaps and Transfers
Collectibles API - Get NFT Collections
Advanced Use Cases
Portfolio Analytics Dashboard
Token Analysis Tool
Error Handling & Best Practices
Comprehensive Error Handling
Rate Limiting
Troubleshooting
| Error | Cause | Solution |
|---|---|---|
Invalid API key | Wrong or expired key | Check API key in dashboard |
Rate limit exceeded | Too many requests | Implement exponential backoff |
Chain not supported | Using unsupported chain | Check supported chains list |
Invalid address format | Malformed wallet address | Validate address format |
Request timeout | Network issues | Increase timeout, add retries |
Insufficient data | New address/contract | Wait for indexing to complete |
Resources
Official Documentation
- Sim Documentation: https://docs.sim.dune.com
- Sim Dashboard: https://sim.dune.com
- Sei Explorer: https://seiscan.io
Community Resources
- Dune Discord: https://discord.gg/dune
- Sei Discord: https://discord.gg/sei
Next Steps
- Scale Your Application: Implement caching, database storage, and horizontal scaling
- Build a Frontend: Create React/Vue.js dashboards to visualize your data
- Advanced Analytics: Implement machine learning for predictive analytics
- Custom Indexers: Build specialized data pipelines for specific protocols
- API Integration: Connect with other services like price feeds, news APIs