NEW: Bitcoin and Solana

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

The cross-chain swap mechanism is powered by Chainflip.

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.

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. instead of submitting a cross-chain swap, you will be submitting a deposit via a simple asset transfer to a deposit address( depositAddress).

A depositAddress is generated by submitting a typical route request to the route endpoint(https://apiplus.squidrouter.com/v2/route). From there you will take the transactionRequest body and submit it to the deposit address endpoint(https://apiplus.squidrouter.com/v2/deposit-address) using the same headers as the route request endpoint.

Deposit-address Endpoint Body Example

{
"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://apiplus.squidrouter.com/v2/deposit-address) 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.

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

IMPORTANT NOTE: The deposit transfer must be initiated within 20 seconds of receiving the depositAddress from the deposit-address endpoint when submitting a the transfer to the deposit address. Otherwise, you will have to call the endpoint again for a new depositAddress and chainflipStatusTrackingID.

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

Unlike EVM-to-EVM, EVM-to-Cosmos swaps, or EVM-to-SOL/BTC, swaps from Bitcoin and Solana require setting abridgeType parameter and setting the transactionId parameter as the chainflipStatusTrackingId returned from the deposit-address endpoint .

When calling the status API(https://apiplus.squidrouter.com/v2/status), 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

// Status checking params should include:
{
  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://apiplus.squidrouter.com/v2/deposit-address endpoint.

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

Route Parameters Examples

Bitcoin Example

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

Solana Example

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,
  enableBoost: true
};

Important Notes

  1. You have to retrieve the deposit address from the /deposit-address endpoint

  2. The transfer must be initiated within 20 seconds of receiving the deposit address

  3. Both chains use the Chainflip bridge and require the bridgeType parameter for status checks

  4. Status monitoring should use the chainflipId from the deposit-address response

  5. Transaction confirmation times vary significantly between chains

Last updated