> ## Documentation Index
> Fetch the complete documentation index at: https://docs.onebalance.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Solana Overview

> Learn how to aggregate both EVM and Solana balances for chain abstraction, enabling unified operations across all supported blockchains.

OneBalance now supports **Solana blockchain**, enabling you to aggregate balances and assets from both Solana and EVM chains into unified operations. Use your SOL, USDC, or other Solana assets alongside EVM tokens for optimized cross-chain transactions.

## What You Can Do

<CardGroup cols={2}>
  <Card title="Abstract Bridging & Funding" icon="arrow-down-up">
    Use EVM balances to buy tokens and pay fees on Solana, and vice versa - no manual bridging required
  </Card>

  <Card title="Optimized Routing" icon="route">
    Automatically find the best liquidity and lowest fees across Solana and EVM ecosystems
  </Card>

  <Card title="EVM Contract Calls" icon="code">
    Execute smart contract functions on EVM chains using combined EVM and Solana balance funding
  </Card>

  <Card title="Solana Contract Calls" icon="cog">
    Execute programs on Solana using combined balances (coming soon)
  </Card>
</CardGroup>

## Key Differences from EVM

### v3 API Endpoints Required

Solana operations require the **v3 API endpoints** which support multiple accounts:

```json theme={null}
// v1 (EVM only) - Single account object
{
  "from": {
    "account": { "sessionAddress": "0x...", ... }
  }
}

// v3 (Cross-chain) - Accounts array
{
  "from": {
    "accounts": [
      { "type": "role-based", "sessionAddress": "0x...", ... },
      { "type": "solana", "accountAddress": "J5CC..." }
    ]
  }
}
```

### Solana Account Structure

Solana accounts are simpler than EVM smart accounts:

```json theme={null}
{
  "type": "solana",
  "accountAddress": "J5CCzBULFax899tcirb6wMbenQUd8whbaetG7EfSick5"
}
```

<Info>
  Solana uses **base58-encoded addresses** and doesn't require session/admin addresses like EVM smart accounts.
</Info>

### Different Signing Process

Solana transactions use a different signing mechanism than EVM:

<CodeGroup>
  ```typescript Browser Wallet theme={null}
  import { MessageV0, VersionedTransaction } from '@solana/web3.js';
  import bs58 from 'bs58';

  async function signSolanaOperation(dataToSign: string, wallet: any) {
    // 1. Convert base64 data to Message
    const message = MessageV0.deserialize(Buffer.from(dataToSign, 'base64'));
    
    // 2. Create versioned transaction
    const transaction = new VersionedTransaction(message);
    
    // 3. Sign with wallet
    const signedTx = await wallet.signTransaction(transaction);
    
    // 4. Extract signature in base58 format
    return bs58.encode(Buffer.from(signedTx.signatures[signedTx.signatures.length - 1]));
  }
  ```

  ```typescript Private Key theme={null}
  import { MessageV0, VersionedTransaction, PublicKey } from '@solana/web3.js';
  import bs58 from 'bs58';

  /**
   * Signs a Solana chain operation with a private key
   *
   * @param accountAddress - The address of the account to sign the chain operation
   * @param privateKey - The private key to sign the chain operation
   * @param chainOp - The chain operation to sign
   * @returns The signed chain operation
   */
  export function signSolanaOperation(
    accountAddress: string,
    privateKey: string,
    chainOp: any,
  ): any {
    const msgBuffer = Buffer.from(chainOp.dataToSign, 'base64');

    const message = MessageV0.deserialize(msgBuffer);

    const transaction = new VersionedTransaction(message);

    const decodedKey = bs58.decode(privateKey);
    transaction.sign([
      {
        publicKey: new PublicKey(accountAddress),
        secretKey: Buffer.from(decodedKey),
      },
    ]);

    const signature = bs58.encode(Buffer.from(transaction.signatures[transaction.signatures.length - 1]));
    return {
      ...chainOp,
      signature,
    };
  }
  ```
</CodeGroup>

## Prerequisites

Before integrating Solana with OneBalance:

<Info>
  **API Key Configuration**: Custom API keys need Solana explicitly enabled. Contact [support@onebalance.io](mailto:support@onebalance.io) or use the public test key `42bb629272001ee1163ca0dbbbc07bcbb0ef57a57baf16c4b1d4672db4562c11` for development.
</Info>

## Integration Steps

<Steps>
  <Step title="Update to v3 endpoints">
    Switch from v1 to v3 endpoints to support Solana accounts:

    * [Get Quote v3](/api-reference/quotes/get-quote-v3) - `POST /api/v3/quote`
    * [Execute Quote v3](/api-reference/quotes/execute-quote-v3) - `POST /api/v3/quote/execute`
    * [Aggregated Balance v3](/api-reference/balances/aggregated-balance-v3) - `GET /api/v3/balances/aggregated-balance`
    * [Prepare Call Quote v3](/api-reference/quotes/prepare-call-quote-v3) - `POST /api/v3/quote/prepare-call-quote`
    * [Get Call Quote v3](/api-reference/quotes/get-call-quote-v3) - `POST /api/v3/quote/call-quote`
  </Step>

  <Step title="Add Solana wallet support">
    Integrate Solana wallet providers like Phantom, Solflare, or others in your frontend.
  </Step>

  <Step title="Handle cross-chain account structure">
    Update your code to use the accounts array format to support both EVM and Solana accounts.
  </Step>

  <Step title="Implement Solana signing">
    Add Solana-specific transaction signing using `@solana/web3.js` and `bs58` libraries.
  </Step>

  <Step title="Test operations">
    Test your integration with the API
  </Step>
</Steps>

## Account Setup Patterns

You can configure accounts in different ways based on your needs:

### Single Account Operations

```typescript theme={null}
// Solana-only operation
const quote = await fetch('/api/v3/quote', {
  method: 'POST',
  body: JSON.stringify({
    from: {
      accounts: [{
        type: "solana",
        accountAddress: "J5CCzBULFax899tcirb6wMbenQUd8whbaetG7EfSick5"
      }],
      asset: { assetId: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501" },
      amount: "10000000" // 0.01 SOL
    },
    to: {
      asset: { assetId: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" }
    }
  })
});
```

### Cross-Chain Operations

```typescript theme={null}
// Cross-chain: Solana → EVM
const quote = await fetch('/api/v3/quote', {
  method: 'POST', 
  body: JSON.stringify({
    from: {
      accounts: [{
        type: "solana",
        accountAddress: "J5CCzBULFax899tcirb6wMbenQUd8whbaetG7EfSick5"
      }],
      asset: { assetId: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501" },
      amount: "10000000"
    },
    to: {
      asset: { assetId: "eip155:42161/erc20:0xaf88d065e77c8C2239327C5EDb3A432268e5831" },
      account: "eip155:42161:0x895Cf62399bF1F8b88195E741b64278b41EB7F09"
    }
  })
});
```

### Unified Balance Operations

```typescript theme={null}
// Use aggregated balances from both EVM and Solana accounts
const quote = await fetch('/api/v3/quote', {
  method: 'POST',
  body: JSON.stringify({
    from: {
      accounts: [
        // Your EVM smart account
        {
          type: "kernel-v3.1-ecdsa",
          accountAddress: "0xd4f5A60c9b500f875ADf757BC3027A4424079E05",
          deploymentType: "ERC4337",
          signerAddress: "0x9b747cC14A5672a7166b4eccdc92d7F4003f8081"
        },
        // Your Solana account
        {
          type: "solana",
          accountAddress: "J5CCzBULFax899tcirb6wMbenQUd8whbaetG7EfSick5"
        }
      ],
      asset: { assetId: "ob:usdc" }, // Aggregated USDC across all chains
      amount: "10000000"
    },
    to: {
      asset: { assetId: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501" }
    }
  })
});
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/guides/solana/getting-started">
    Get your first Solana cross-chain swap working in 5 minutes
  </Card>

  <Card title="Working Examples" icon="code" href="/guides/solana/examples">
    Complete code examples for swaps and cross-chain operations
  </Card>

  <Card title="Solana FAQ" icon="message-question" href="/faq/solana">
    Token discovery, API keys, limitations, and common questions
  </Card>

  <Card title="Contract Calls" icon="terminal" href="/guides/solana/contract-calls">
    Use Solana assets to fund smart contract calls on EVM chains
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/guides/solana/troubleshooting">
    Common issues, solutions, and debugging tips for Solana integration
  </Card>
</CardGroup>

<Note>
  For questions or support with Solana integration, use the **Intercom chat widget** in the bottom right corner for instant help, join our [Discord](https://discord.com/invite/vHkw7rpdT8), or reach out via [support](mailto:support@onebalance.io).
</Note>
