# Bitcoin and Solana

Bitcoin and Solana cross-chain swaps are now on Squid!

The cross-chain swap mechanism is powered by [Chainflip](https://chainflip.io/).

Currently, Bitcoin and Solana integrations are in a closed beta. Please reach out if you would like to have the functionality enabled for your integrator ID.

This brief outlines what you need to know in order to enable swaps to and from Bitcoin and Solana. You can also explore the detailed[ **ready-to-run examples in our Github repo**](https://github.com/0xsquid/examples/tree/main/V2/api).

### Creating a Route

Currently swaps are only supported to EVM chains. You can swap from EVM chains to Solana and BTC just as you would in a typical cross-chain swap.

When swapping **from** Solana or BTC, the `/v2/route` endpoint will return one of two transaction types depending on the token pair. You should check the `transactionRequest.type` field in the response to determine which flow to follow.

#### Transaction Type: `ON_CHAIN_EXECUTION` (Direct Swaps)

For certain token pairs, Chainflip provides direct swap access. In this case, the route response returns a `transactionRequest` with `type: "ON_CHAIN_EXECUTION"` containing raw transaction data that can be signed and submitted directly on-chain — similar to a standard EVM swap.

**Direct Swap Pairs (Solana)**

| From Token | To Token | To Chain         |
| ---------- | -------- | ---------------- |
| SOL        | ETH      | Ethereum (1)     |
| SOL        | USDC     | Arbitrum (42161) |
| SOL        | ETH      | Arbitrum (42161) |
| USDC       | ETH      | Ethereum (1)     |
| USDC       | USDC     | Arbitrum (42161) |
| USDC       | ETH      | Arbitrum (42161) |

**Example Request (SOL → ETH on Ethereum)**

```json
{
    "fromAddress": "35tWpkpFr7UawcpuXm6ir1nN1v5tfoJgKj84xv1YukZn",
    "fromAmount": "100000000",
    "fromChain": "solana-mainnet-beta",
    "fromToken": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "toAddress": "0x2d0178a76632443B0A64EFEEBc42AE25E8c4B949",
    "toChain": "1",
    "toToken": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "slippage": 1
}
```

**Example Response**

```json
{
    "transactionRequest": {
        "type": "ON_CHAIN_EXECUTION",
        "target": "",
        "data": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQADBx738cKik3CAiHapY2..."
    }
}
```

For direct swaps, status checking follows the standard pattern using the on-chain transaction hash — no special `bridgeType` parameter is needed.

#### Transaction Type: `CHAINFLIP_DEPOSIT_ADDRESS` (Deposit Address Flow)

All other Solana and BTC routes (i.e., any pair **not** listed in the direct swap pairs table above) will return a `transactionRequest` with `type: "CHAINFLIP_DEPOSIT_ADDRESS"`. This requires an additional step: you must pass the `transactionRequest` body to the deposit address endpoint to get a deposit address, then transfer the assets to that address.

**Example Request (SOL → USDC on Base)**

```json
{
    "fromAddress": "35tWpkpFr7UawcpuXm6ir1nN1v5tfoJgKj84xv1YukZn",
    "fromAmount": "100000000",
    "fromChain": "solana-mainnet-beta",
    "fromToken": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "toAddress": "0x2d0178a76632443B0A64EFEEBc42AE25E8c4B949",
    "toChain": "8453",
    "toToken": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "slippage": 1
}
```

**Example Response**

```json
{
    "transactionRequest": {
        "type": "CHAINFLIP_DEPOSIT_ADDRESS",
        "request": {
            "quote": {
                "intermediateAmount": "17908621",
                "egressAmount": "4083107065211964"
            }
        }
    }
}
```

**Step 2: Get the Deposit Address**

Take the `transactionRequest` body from the route response and submit it to the deposit address endpoint ([https://v2.api.squidrouter.com/v2/deposit-address](https://v2.api.squidrouter.com/v2/)) using the same headers as the route request endpoint.

**Deposit-address Endpoint Body Example**

```json
{
    "type": "CHAINFLIP_DEPOSIT_ADDRESS",
    "request": {
        "amount": "70000",
        "fromChain": "bitcoin",
        "fromAsset": "BTC",
        "toChain": "42161",
        "toAsset": "USDC",
        "fromAddress": "bc1qzea6nfdfmztwjcn8htqn4tk9j3v2uawf4rck0g",
        "toAddress": "0xC601C9100f8420417A94F6D63e5712C21029525e",
        "maxBoostFeeBps": 5,
        "fillOrKillParams": {
            "minPrice": "95922.744760479036194738",
            "refundAddress": "bc1qzea6nfdfmztwjcn8htqn4tk9j3v2uawf4rck0g",
            "retryDurationBlocks": 150
        }
    }
}
```

The deposit address endpoint ([https://v2.api.squidrouter.com/v2/deposit-address](https://v2.api.squidrouter.com/v2/)) will return the deposit address(**`depositAddress`**) which is where the asset should be transferred, the amount(**`amount`**), which is the amount that should be transferred, and the **`chainflipStatusTrackingId`**, which will be used for the status tracking.

```json
{
    "depositAddress": "bc1pdlqe7rw4ep6w6d6q7j3vu300l577wqdn7sw6q3ya3lvlssv5wahq77765y",
    "amount": "70000",
    "chainflipStatusTrackingId": "5994435-Bitcoin-26351"
}
```

#### Bitcoin Parameters

* ChainID: `bitcoin`
* Native Token: `satoshi`
* Minimum Swap Amount: `.0007 BTC`
* The Bitcoin wallet address should be a Native SegWit (Bech32) address

#### Solana Parameters

* ChainID: `solana-mainnet-beta`
* Native Token: `0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee`
* Supported Tokens: SOL, USDC(`EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`)
* Minimum Swap Amount: `$20 USD`

### Key Implementation Differences

#### Status Checking

Status checking depends on the transaction type returned by the route endpoint:

**For Direct Swaps (`ON_CHAIN_EXECUTION`):**

Use the standard status checking flow with the on-chain transaction hash — the same as any EVM-to-EVM swap. No special `bridgeType` parameter is needed.

**For Deposit Address Swaps (`CHAINFLIP_DEPOSIT_ADDRESS`):**

Unlike EVM-to-EVM or EVM-to-Cosmos swaps, deposit address swaps from Bitcoin and Solana require setting a **`bridgeType`** parameter and setting the **`transactionId`** parameter as the `chainflipStatusTrackingId` returned from the deposit-address endpoint.

When calling the status API([https://v2.api.squidrouter.com/v2/status](https://v2.api.squidrouter.com/v2/)), the bridgeType should be set as **`chainflip`** if the bridge destination is Arbitrum(42161) or **`chainflipmultihop`** if the bridge destination is another EVM chain that is not Arbitrum

```typescript
// Status checking params for deposit address swaps:
{
  transactionId: chainflipStatusTrackingId, // Use chainflipStatusTrackingId from the deposit-address endpoint
  fromChainId: fromChainId,
  toChainId: toChainId,
  bridgeType: "chainflip" // Required for SOL or BTC to Arbitrum and chainflipmultihop to any other EVM,
}
```

This chainflipID can be found in the returned object from the [https://v2.api.squidrouter.com/v2/deposit-address](https://v2.api.squidrouter.com/v2/) endpoint.

```json
{
    "depositAddress": "bc1pdlqe7rw4ep6w6d6q7j3vu300l577wqdn7sw6q3ya3lvlssv5wahq77765y",
    "amount": "70000",
    "chainflipStatusTrackingId": "5994435-Bitcoin-26351"
}

```

### Route Parameters Examples

**Bitcoin Example**

```typescript
const params = {
  fromAddress: sourceAddress,
  fromChain: "bitcoin",
  fromToken: "satoshi",
  fromAmount: "70000", // Amount in satoshis
  toChain: "42161",
  toToken: toToken,
  toAddress: destinationAddress,
  quoteOnly: false
};
```

**Solana Example**

```typescript
const params = {
  fromAddress: wallet.publicKey.toString(),
  fromChain: "solana-mainnet-beta",
  fromToken: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
  fromAmount: "100000000", // Amount in lamports
  toChain: "42161",
  toToken: toToken,
  toAddress: destinationAddress,
  quoteOnly: false
};
```

#### Important Notes

1. Check the `transactionRequest.type` field in the route response to determine which flow to use
2. For direct swap pairs (`ON_CHAIN_EXECUTION`), sign and submit the transaction data directly on-chain
3. For all other pairs (`CHAINFLIP_DEPOSIT_ADDRESS`), retrieve the deposit address from the `/deposit-address` endpoint and transfer assets there
4. Deposit address swaps require the `bridgeType` parameter for status checks; direct swaps use the standard transaction hash
5. Status monitoring for deposit address swaps should use the `chainflipStatusTrackingId` from the deposit-address response
6. Transaction confirmation times vary significantly between chains


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.squidrouter.com/api-and-sdk-integration/chain-integration-guides/bitcoin-and-solana.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
