Getting Started
Read Token Data
Fetch fungible token information directly from the Solana blockchain or through the DAS API for optimized queries.
What You'll Learn
This guide covers two approaches to reading token data:
- Direct blockchain queries - Fetch token data using RPC calls
- DAS API queries - Use indexed data for faster, more flexible searches
Fetching Token Data Directly
Get Token Metadata by Mint Address
To fetch a token's metadata directly from the blockchain, you need the mint address. This approach reads data directly from on-chain accounts.
Get Token Balance for a Wallet
Fetch the token balance a specific wallet holds for a given token mint.
Get All Token Accounts for a Wallet
Retrieve all token accounts owned by a specific wallet to see all their token holdings.
Fetching Token Data with DAS API
The Digital Asset Standard (DAS) API provides indexed access to token data, enabling faster queries and advanced filtering capabilities. This is the recommended approach for applications that need to query multiple tokens or search by various criteria.
Get Token by Mint Address
Get All Fungible Tokens by Owner
Retrieve all fungible tokens owned by a wallet address. Use the FungibleToken interface filter for efficient querying.
Search Tokens by Creator
Find all fungible tokens created by a specific address.
Comparing Approaches
| Feature | Direct RPC | DAS API |
|---|---|---|
| Speed | Slower for bulk queries | Optimized for bulk queries |
| Data freshness | Real-time | Near real-time (indexed) |
| Search capabilities | Limited | Advanced filtering |
| Rate limits | Standard RPC limits | Provider-dependent |
| Use case | Single token lookups | Portfolio views, searches |
Tips and Best Practices
Use DAS for portfolio views - When displaying all tokens a user owns, DAS API is significantly faster than multiple RPC calls.
Enable showFungible - Always set
showFungible: truein display options to get complete token information including balances and decimals.Handle decimals correctly - Token amounts are returned as raw integers. Divide by
10^decimalsto get the human-readable amount.Cache metadata - Token metadata rarely changes. Cache it to reduce API calls and improve performance.
Paginate large results - When fetching many tokens, use pagination to handle large result sets efficiently. See the DAS pagination guide for details.
