Lite Mode
Overview
Lite Mode is an advanced feature exclusively available for Solana that optimizes transactions by significantly reducing transaction size and providing developers with granular control over transaction construction. When enabled, the API returns raw transaction instructions instead of pre-serialized base64-encoded transaction data, allowing for more flexible transaction building and better success rates.
Note: This feature is currently only supported for Solana blockchain swaps. Other chains will use the standard transaction mode.
Key Features
Reduced Transaction Size: Minimizes the number of accounts included in transactions
Instruction-Based: Returns raw Solana instructions for custom transaction building
Provider Optimization: Uses only the most efficient providers for Solana swaps
Automatic Account Management: Intelligently manages account limits based on mode
Direct Route Optimization: Forces single-hop swaps for faster execution and lower complexity
Enhanced Success Rate: Reduces transaction failures due to size constraints
Supported Providers
Jupiter (JUPAG) - Primary DEX aggregator with advanced routing (Solana only)
OKX - Multi-chain DEX aggregator with Solana support (Solana only)
Chain Limitation: These providers are configured for lite mode only when
fromChainIdandtoChainIdare both set to"sol".
How It Works
Quote API Behavior
When lite=true is enabled in the quote request for Solana swaps:
Provider Selection: Only Jupiter and OKX providers are utilized for Solana swaps
Endpoint Optimization:
Jupiter switches to
/swap-instructionsendpointOKX switches to
/swap-instructionendpoint
Account Management:
maxAccountsis automatically set to 20 (vs default 64 in normal mode)This reduces transaction complexity and size
Direct Route Optimization:
Jupiter:
onlyDirectRoutes: true- Forces single-hop swaps onlyOKX:
directRoute: true- Enables direct routing modeEliminates multi-hop routing for faster execution and lower complexity
Important: Lite mode is automatically disabled for non-Solana chains, and the request will fall back to standard transaction mode.
Next Transaction API Response
Instead of returning serialized transaction data, the API provides raw transaction instructions. The response format varies by provider:
Jupiter Response Format
Jupiter Instruction Structure:
OKX Response Format
OKX Instruction Structure:
Response Components:
Jupiter Components:
tokenLedgerInstruction: Token ledger instruction (if using token ledger)computeBudgetInstructions: Array of compute budget instructions for gas optimizationsetupInstructions: Array of setup instructions for creating missing accountsswapInstruction: The main swap instructioncleanupInstruction: Cleanup instruction for unwrapping SOL (if needed)addressLookupTableAddresses: Array of address lookup table addresses
OKX Components:
addressLookupTableAccount: Array of address lookup table accounts for transaction optimizationinstructionLists: Array of Solana transaction instructions to be executedEach instruction contains
programId,accounts, anddatafields
API Integration
Quote Request Example
Chain Requirement: Both
fromChainIdandtoChainIdmust be set to"sol"for lite mode to be activated.
Transaction Building Process
Quote Request: Include
lite: trueparameterInstruction Retrieval: Use the returned instructions from Next Transaction API
Transaction Construction: Build your Solana transaction using the provided instructions
Address Lookup Tables: Utilize the
addressLookupTableAccountdata for optimizationTransaction Submission: Send the constructed transaction to Solana network
Account Management
Automatic maxAccounts Setting
Lite Mode (
lite: true):maxAccountsis automatically set to 20Normal Mode (
lite: false):maxAccountsis automatically set to 64Manual Override: You can still specify
maxAccountsin the request to override the automatic setting
Why Account Limits Matter
Transaction Size: Solana transactions have size limits (1232 bytes)
Account Limits: Each account reference consumes space
Success Rate: Fewer accounts = higher transaction success rate
Gas Efficiency: Smaller transactions are more cost-effective
Benefits
Performance Improvements
Faster Execution: Direct routes eliminate multi-hop complexity
Higher Success Rate: Smaller transactions are less likely to fail
Reduced Gas Costs: Optimized transaction size leads to lower fees
Simplified Routing: Single-hop swaps reduce MEV exposure and slippage
Developer Experience
Flexible Integration: Raw instructions allow custom transaction building
Better Control: Fine-grained control over transaction construction
Simplified Debugging: Easier to troubleshoot instruction-level issues
Network Efficiency
Reduced Congestion: Smaller transactions contribute to network efficiency
Better Batching: Instructions can be batched with other operations
Optimized Routing: Direct paths reduce unnecessary hops
Use Cases
High-Frequency Trading
Minimal transaction size for rapid execution
Reduced slippage due to faster processing and direct routes
Better price discovery through single-hop swaps
Lower MEV exposure with simplified routing
DeFi Applications
Integration with complex DeFi protocols
Custom transaction building for specific needs
Batch operations with other Solana instructions
Mobile Applications
Reduced data usage for mobile users
Faster transaction confirmation
Better user experience on slower connections
Implementation Guide
Step 1: Enable Lite Mode
Step 2: Process Quote Response
Step 3: Get Transaction Instructions
Step 4: Build and Submit Transaction
For Jupiter Instructions
For OKX Instructions
Best Practices
Handle Instructions Properly - Parse and validate instruction data
Utilize Address Lookup Tables - They significantly reduce transaction size
Monitor Success Rates - Lite mode should improve transaction success
Troubleshooting
Common Issues
Instruction Parsing Errors: Ensure proper JSON parsing of instruction data
Provider Availability: Only Jupiter and OKX support lite mode
Chain Compatibility: Lite mode only works with Solana (
fromChainId: "sol"andtoChainId: "sol")
Debug Tips
Check instruction structure before building transactions
Verify address lookup table accounts are properly included
Monitor transaction size to ensure it stays within limits
References
Provider Documentation
Jupiter Swap Instructions API - Complete guide for building transactions with Jupiter instructions
Jupiter Swap Instructions Example - Code examples for instruction handling
OKX Swap Instruction API - OKX's swap instruction documentation
OKX Solana Integration Guide - Complete implementation examples
Solana Documentation
Solana Transaction Format - Understanding Solana transactions
Address Lookup Tables - Optimizing transaction size with ALTs
Transaction Instructions - Working with Solana instructions
Last updated