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 fromChainId and toChainId are both set to "sol".

How It Works

Quote API Behavior

When lite=true is enabled in the quote request for Solana swaps:

  1. Provider Selection: Only Jupiter and OKX providers are utilized for Solana swaps

  2. Endpoint Optimization:

    • Jupiter switches to /swap-instructions endpoint

    • OKX switches to /swap-instruction endpoint

  3. Account Management:

    • maxAccounts is automatically set to 20 (vs default 64 in normal mode)

    • This reduces transaction complexity and size

  4. Direct Route Optimization:

    • Jupiter: onlyDirectRoutes: true - Forces single-hop swaps only

    • OKX: directRoute: true - Enables direct routing mode

    • Eliminates 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 optimization

  • setupInstructions: Array of setup instructions for creating missing accounts

  • swapInstruction: The main swap instruction

  • cleanupInstruction: 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 optimization

  • instructionLists: Array of Solana transaction instructions to be executed

  • Each instruction contains programId, accounts, and data fields

API Integration

Quote Request Example

Chain Requirement: Both fromChainId and toChainId must be set to "sol" for lite mode to be activated.

Transaction Building Process

  1. Quote Request: Include lite: true parameter

  2. Instruction Retrieval: Use the returned instructions from Next Transaction API

  3. Transaction Construction: Build your Solana transaction using the provided instructions

  4. Address Lookup Tables: Utilize the addressLookupTableAccount data for optimization

  5. Transaction Submission: Send the constructed transaction to Solana network

Account Management

Automatic maxAccounts Setting

  • Lite Mode (lite: true): maxAccounts is automatically set to 20

  • Normal Mode (lite: false): maxAccounts is automatically set to 64

  • Manual Override: You can still specify maxAccounts in 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

  1. Handle Instructions Properly - Parse and validate instruction data

  2. Utilize Address Lookup Tables - They significantly reduce transaction size

  3. 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" and toChainId: "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

Solana Documentation

Last updated