Skip to main content

Solana Network API

The SQD Network provides high-performance access to Solana blockchain data through optimized portals. This eliminates the need for running your own Solana node while providing faster sync times than direct RPC access.
Portal support requires the @portal-api version of the Solana processor package:
npm i @subsquid/solana-stream@portal-api

Mainnet

processor.setPortal('https://portal.sqd.dev/datasets/solana-mainnet')

Devnet

processor.setPortal('https://portal.sqd.dev/datasets/solana-devnet')
Portal endpoints offer improved performance and are the recommended way to access SQD Network data.

V2 Archive Endpoints (Legacy)

V2 archives are being phased out. Please migrate to Portal endpoints.

Mainnet

processor.setGateway('https://v2.archive.subsquid.io/network/solana-mainnet')

Devnet

processor.setGateway('https://v2.archive.subsquid.io/network/solana-devnet')

Data Coverage

The SQD Network for Solana provides:
  • Complete transaction history from genesis
  • All instruction data including inner instructions
  • Account state changes and balance updates
  • Program logs and error information
  • Real-time updates with minimal latency

Performance Benefits

Fast Sync

10-100x faster than RPC-only indexing

Pre-filtered Data

Only receive data matching your filters

Batch Processing

Optimized batch sizes for maximum throughput

Reliable Access

High availability with automatic failover

Data Filtering

Program-based Filtering

processor.addInstruction({
  programId: [
    'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', // SPL Token
    'So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo'  // Solend
  ]
})

Account-based Filtering

processor.addTransaction({
  accounts: [
    'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC Mint
    'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'  // USDT Mint
  ]
})

Slot Range Filtering

processor.setBlockRange({
  from: 150_000_000,
  to: 160_000_000
})

Hybrid Data Sources

Combine SQD Network with RPC for optimal performance:
const processor = new SolanaBatchProcessor()
  // Fast historical sync via Portal
  .setPortal('https://portal.sqd.dev/datasets/solana-mainnet')
  // Real-time data via RPC
  .setRpcEndpoint('https://api.mainnet-beta.solana.com')
  .setFinalityConfirmation(32) // ~13 seconds on Solana

Rate Limits and Quotas

Free Tier

  • 100 requests per second
  • 1M data points per month
  • Community support

Pro Tier

  • 1000 requests per second
  • Unlimited data points
  • Priority support
  • Custom rate limits available

Error Handling

processor.run(db, async (ctx) => {
  try {
    // Process data
  \} catch (error) \{
    if (error.code === 'RATE_LIMIT_EXCEEDED') {
      // Handle rate limiting
      await new Promise(resolve => setTimeout(resolve, 1000))
    \} else if (error.code === 'GATEWAY_TIMEOUT') \{
      // Handle portal issues
      ctx.log.warn('Portal timeout, retrying...')
    }
    throw error
  }
})

Monitoring and Observability

Built-in Metrics

  • Processing speed (slots/second)
  • Data throughput (MB/second)
  • Error rates and types
  • Portal response times

Custom Logging

processor.run(db, async (ctx) => {
  ctx.log.info(`Processing block $\{ctx.blocks[0]?.header.slot\}`)
  
  for (let block of ctx.blocks) {
ctx.log.debug(`Block $\{block.header.slot\}: "$\{block.instructions.length\} instructions`)"
  }
})

Best Practices

Optimize Filters

  • Use specific program IDs when possible
  • Filter by accounts for targeted indexing
  • Set appropriate slot ranges for historical data

Handle Finality

  • Configure appropriate finality confirmation
  • Handle potential reorganizations
  • Implement idempotent processing logic

Monitor Performance

  • Track processing speed and latency
  • Set up alerts for error rates
  • Monitor portal health status

Migration from RPC

Migrating from direct RPC to SQD Network:
1

Update Portal Configuration

Replace RPC-only configuration with Portal
2

Adjust Data Selection

Use SQD Network’s filtering capabilities instead of client-side filtering
3

Optimize Batch Processing

Take advantage of optimized batch sizes
4

Monitor Performance

Measure the performance improvement

Support

Need help with Solana Network API?