Bitcoin, Stellar and Solana
Buy and sell Bitcoin, send dollars to Stellar, and buy assets on Solana through the same API call.
Your users can buy and sell Bitcoin, send digital dollars (USDC) to a Stellar account, and buy assets on Solana, all through the same Create Swap call. Money lives on a network, like a bank system, and each of these three networks is selected by its id:
| Network | Id | What works |
|---|---|---|
| Bitcoin | 0 | Sell Bitcoin (BTC) for assets in the user's account, or buy Bitcoin with them. |
| Stellar | -1 | Send dollars from Ethereum, Polygon, Base or Arbitrum to a Stellar account. |
| Solana | -501 | Buy assets on Solana using assets in the user's account. |
Three chains that are not EVM work through the same Create Swap call, selected by chain id:
| Chain | Id | What works |
|---|---|---|
| Bitcoin | 0 | BTC into any EVM token, and any EVM token out to BTC. |
| Stellar | -1 | USDC from Ethereum, Polygon, Base or Arbitrum to a Stellar account. |
| Solana | -501 | Any EVM token into any Solana token. |
Sell Bitcoin
The user's Bitcoin address pays, and the converted funds arrive in their account. Pass chainIdIn: 0 for Bitcoin, NATIVE as tokenIn, and amountIn as text ('0.001' is 0.001 BTC). Setting gasFeePaymentMethod to 'DEDUCT_FROM_AMOUNT' takes the network fee out of the amount being converted. Because Bitcoin works differently from the user's main account, the quote (the price and fees, valid for a short time) returns a Bitcoin transaction to approve instead of a standard operation approval.
The user's Bitcoin address pays, and the result arrives in their EVM wallet. Bitcoin has no smart wallet, so this quote returns a Bitcoin transaction (a PSBT) to sign instead of a userOperationHash.
const NATIVE = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
const { quotes } = await notus.swaps.createSwapOperation({
walletAddress: 'bc1q<user-bitcoin-address>',
toAddress: evmWalletAddress,
chainIdIn: 0,
chainIdOut: 137,
tokenIn: NATIVE,
tokenOut: USDC_POLYGON,
amountIn: '0.001',
payGasFeeToken: NATIVE,
gasFeePaymentMethod: 'DEDUCT_FROM_AMOUNT',
})
const [quote] = quotesHave the user approve the Bitcoin transaction returned in the quote with their Bitcoin key, then submit it through notus.bitcoin.broadcastTransaction within a minute:
Sign quote.psbt with the user's Bitcoin key, finalize it, and broadcast it through Notus within a minute:
if (!quote.quoteId) throw new Error(JSON.stringify(quote.revertReason))
const { transactionHash } = await notus.bitcoin.broadcastTransaction({
quoteId: quote.quoteId,
signedTransactionHex: '<finalized-transaction-hex>',
})Notus checks that the approved transaction matches the quote, submits it to the Bitcoin network, and records it in the user's activity history. Once the Bitcoin payment confirms, the converted funds arrive in the user's account.
Notus checks that the signed transaction is the one it quoted, publishes it, and records it in the wallet's history. The bridge delivers the EVM token once the Bitcoin transaction confirms.
Sending Bitcoin from one Bitcoin address to another uses a transfer with chainId: 0, submitted the same way.
Buy Bitcoin
Buying Bitcoin from the user's account works like any other conversion: set chainIdOut: 0, set tokenOut to the NATIVE placeholder shown above, and set toAddress to the Bitcoin address that receives the funds. Have the user approve the operation and submit it as described in Convert currencies.
The other direction is an ordinary swap from the smart wallet: chainIdOut: 0, tokenOut the native marker, and toAddress the Bitcoin address that receives. Sign the userOperationHash and execute as in Swap tokens.
Send dollars to Stellar
Send dollars from the user's account to any Stellar account. In the example below, amountIn: '20' sends 20 dollars from Polygon (chainIdIn: 137) to Stellar (chainIdOut: -1), with the network fee deducted from the amount.
Send USDC from an EVM chain to any Stellar account, through Circle's CCTP: the USDC is burned on the origin chain and minted on Stellar, with no bridge in between.
const { quotes } = await notus.swaps.createSwapOperation({
walletAddress,
toAddress: 'G<stellar-account>',
chainIdIn: 137,
chainIdOut: -1,
tokenIn: USDC_POLYGON,
tokenOut: 'CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75',
amountIn: '20',
payGasFeeToken: USDC_POLYGON,
gasFeePaymentMethod: 'DEDUCT_FROM_AMOUNT',
})tokenInmust be standard USDC (notUSDC.e) on Ethereum, Polygon, Base or Arbitrum.tokenOutis the Stellar dollar asset id shown above.- The receiving Stellar account must be active and enabled to receive dollars, or the quote fails with
STELLAR_ACCOUNT_NOT_ACTIVE,STELLAR_TRUSTLINE_NOT_FOUNDorSTELLAR_TRUSTLINE_NOT_AUTHORIZED.
Have the user approve and submit the operation like any other conversion.
tokenInmust be Circle's native USDC on Ethereum, Polygon, Base or Arbitrum (not bridged USDC.e).tokenOutis the USDC contract on Stellar shown above.- The Stellar account must be active and hold an authorized USDC trustline, or the quote fails with
STELLAR_ACCOUNT_NOT_ACTIVE,STELLAR_TRUSTLINE_NOT_FOUNDorSTELLAR_TRUSTLINE_NOT_AUTHORIZED.
Sign and execute like any swap.
Buy assets on Solana
Your users can buy any asset Notus lists on Solana using funds in their account, delivered to a Solana address. If the receiving address is not yet set up to hold that asset, Notus sets it up during delivery.
Any token Notus lists on Solana can be bought from an EVM chain and delivered to a Solana address. Notus opens the token account on the way if it doesn't exist.
const USDC_BASE = '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
const USDC_SOLANA = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
const { quotes } = await notus.swaps.createSwapOperation({
walletAddress,
toAddress: '<solana-address>',
chainIdIn: 8453,
chainIdOut: -501,
tokenIn: USDC_BASE,
tokenOut: USDC_SOLANA,
amountIn: '25',
payGasFeeToken: USDC_BASE,
gasFeePaymentMethod: 'DEDUCT_FROM_AMOUNT',
})tokenOut is the asset's Solana id, written exactly as listed (case-sensitive). To buy SOL itself, use 0xeeee…eeee (the NATIVE placeholder from above). toAddress must be the recipient's Solana account address, not an asset id. Have the user approve and submit the operation like any other conversion.
tokenOut is the token's mint address, written exactly as Solana writes it; for SOL itself, use the native marker 0xeeee…eeee. toAddress must be a wallet address, not a mint or a token account. Sign and execute like any swap.
Providers, limits and what is not public
- Bitcoin. From Bitcoin: LI.FI and Relay, which consolidate the user's UTXOs. To Bitcoin: LI.FI, Rango and Relay. Bitcoin addresses can be legacy (
1…,3…), SegWit (bc1q…) or Taproot (bc1p…). Bitcoin wallets are not registered in the project. Bitcoin to Bitcoin swaps (BITCOIN_TO_BITCOIN_SWAP_NOT_ALLOWED), Bitcoin limit orders and Bitcoin to Solana are not supported. Broadcast errors:EXPIRED_BITCOIN_QUOTE,SIGNED_TRANSACTION_MISMATCH,INVALID_SIGNED_TRANSACTION,BITCOIN_QUOTE_NOT_FOUND. The project's Bitcoin fees go to the treasury Bitcoin address set in the dashboard. - Stellar. CCTP is the only provider and only moves USDC to USDC. Stellar to EVM is not available through the public API.
- Solana. Relay is the only provider; its solver swaps on the Solana side when needed. Swaps out of Solana are not available through the public API.