Overview
When building crypto applications, you often need to identify which blockchain a token contract belongs to. Traditional approaches require expensive RPC calls to multiple chains, which is slow and resource-intensive.
Mobula’s Universal Search (/api/2/fast-search) automatically detects the chain for any contract address in under 30ms - no RPC calls, no chain guessing.
Quick Start
Simply pass the contract address to the search endpoint:
The response includes the chainId field that tells you exactly which chain the token is on:
How It Works
When you provide a contract address to the search endpoint:
- Cross-chain lookup: Mobula searches across all supported blockchains simultaneously
- Instant matching: Uses indexed data instead of live RPC calls
- Returns chain info: The response includes
chainId identifying the exact blockchain
This is significantly faster than the traditional approach of making sequential RPC calls to each chain.
Code Examples
TypeScript / JavaScript
Python
Get Full Token Data
Once you have the chain ID, you can fetch complete token details:
The search endpoint already returns comprehensive token data including price, volume, liquidity, and trading metrics. In most cases, you won’t need to make a second API call.
Multi-Chain Tokens
Some tokens exist on multiple chains (like USDT or USDC). The search returns all instances sorted by trading activity:
Mobula uses standardized chain identifiers:
| Chain | Chain ID |
|---|
| Ethereum | evm:1 |
| BSC | evm:56 |
| Base | evm:8453 |
| Arbitrum | evm:42161 |
| Polygon | evm:137 |
| Optimism | evm:10 |
| Solana | solana:solana |
| Sui | sui:sui |
| Method | Latency | RPC Calls |
|---|
| Sequential RPC checks (10 chains) | 2-5 seconds | 10+ |
| Parallel RPC checks (10 chains) | 500ms-1s | 10+ |
| Mobula Universal Search | <30ms | 0 |
Best Practices
1. Handle Multiple Results
When a token exists on multiple chains, the API returns all matches. Always check if your expected chain is in the results:
2. Cache Results
Chain IDs for contracts don’t change. Cache the results to avoid repeated lookups:
3. Filter by Specific Chains
If you only support certain chains, filter the results:
Response Fields
Each token in the response includes:
| Field | Type | Description |
|---|
address | string | Token contract address |
chainId | string | Blockchain identifier |
symbol | string | Token symbol |
name | string | Token name |
priceUSD | number | Current price in USD |
volume24hUSD | number | 24h trading volume |
liquidityUSD | number | Total liquidity |
marketCapUSD | number | Market capitalization |
Use Cases
- Trading bots: Quickly identify token chains for cross-chain arbitrage
- Portfolio trackers: Auto-detect chains for user-provided addresses
- Token analytics: Build chain-agnostic token dashboards
- Wallet integrations: Display correct chain info without RPC overhead
Next Steps
Support
Need help? Join our community: