# Bitcoin, Stellar and Solana
URL: /docs/guides/bitcoin-stellar-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](/docs/api-reference/swaps/CreateSwapOperationController_createSwapOperation_v1) 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](/docs/api-reference/swaps/CreateSwapOperationController_createSwapOperation_v1) 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 [#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`.
```ts
const NATIVE = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
const { quotes } = await notus.swaps.createSwapOperation({
walletAddress: 'bc1q',
toAddress: evmWalletAddress,
chainIdIn: 0,
chainIdOut: 137,
tokenIn: NATIVE,
tokenOut: USDC_POLYGON,
amountIn: '0.001',
payGasFeeToken: NATIVE,
gasFeePaymentMethod: 'DEDUCT_FROM_AMOUNT',
})
const [quote] = quotes
```
Have 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:
```ts
if (!quote.quoteId) throw new Error(JSON.stringify(quote.revertReason))
const { transactionHash } = await notus.bitcoin.broadcastTransaction({
quoteId: quote.quoteId,
signedTransactionHex: '',
})
```
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](/docs/api-reference/transfers/CreateTransferOperationController_createTransferOperation_v1) with `chainId: 0`, submitted the same way.
## Buy Bitcoin [#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](/docs/guides/defi-swap).
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](/docs/guides/defi-swap).
## Send dollars to Stellar [#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.
```ts
const { quotes } = await notus.swaps.createSwapOperation({
walletAddress,
toAddress: 'G',
chainIdIn: 137,
chainIdOut: -1,
tokenIn: USDC_POLYGON,
tokenOut: 'CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75',
amountIn: '20',
payGasFeeToken: USDC_POLYGON,
gasFeePaymentMethod: 'DEDUCT_FROM_AMOUNT',
})
```
- `tokenIn` must be standard USDC (not `USDC.e`) on Ethereum, Polygon, Base or Arbitrum.
- `tokenOut` is 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_FOUND` or `STELLAR_TRUSTLINE_NOT_AUTHORIZED`.
Have the user approve and submit the operation like any other conversion.
- `tokenIn` must be Circle's native USDC on Ethereum, Polygon, Base or Arbitrum (not bridged USDC.e).
- `tokenOut` is 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_FOUND` or `STELLAR_TRUSTLINE_NOT_AUTHORIZED`.
Sign and execute like any swap.
## Buy assets on Solana [#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.
```ts
const USDC_BASE = '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
const USDC_SOLANA = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
const { quotes } = await notus.swaps.createSwapOperation({
walletAddress,
toAddress: '',
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.
- **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.