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

# Bitcoin

> Sign messages, send Bitcoin, and work with PSBTs using the Dynamic Flutter SDK.

## Overview

The `BitcoinModule` provides native Bitcoin operations including message signing, PSBT signing, sending Bitcoin, and balance queries. Access it via `DynamicSDK.instance.bitcoin`.

## Prerequisites

* Dynamic SDK initialized (see [Quickstart](/flutter/quickstart))
* User authenticated (see [Authentication](/flutter/authentication))
* Bitcoin enabled in the [Dynamic dashboard](https://app.dynamic.xyz/dashboard/chains-and-networks#bitcoin)

## Get a Bitcoin Wallet

There are two paths to a Bitcoin wallet: filter the user's existing wallets, or create a new one explicitly.

### Filter existing wallets

If Bitcoin is enabled and the user has a Bitcoin wallet (created automatically at signup), find it via `userWallets`:

```dart theme={"system"}
final sdk = DynamicSDK.instance;

final btcWallet = sdk.wallets.userWallets.firstWhere(
  (w) => w.chain == 'BTC',
  orElse: () => throw StateError('No Bitcoin wallet found'),
);

print('Bitcoin address: ${btcWallet.address}');
```

### Create a new Bitcoin wallet

Call `createWallet` with `EmbeddedWalletChain.btc`:

```dart theme={"system"}
final wallet = await sdk.wallets.embedded.createWallet(
  chain: EmbeddedWalletChain.btc,
);

print('Created: ${wallet.address}');
```

<Note>
  Bitcoin wallets are derived as **Native SegWit** (`bc1q…`) by default. Mainnet is the only network supported today.
</Note>

## What is a satoshi?

A satoshi is the smallest unit of Bitcoin — `1 BTC = 100,000,000 satoshis`. All amount fields in the Bitcoin module (`sendBitcoin`, `buildPsbt`, `getBalance`) are expressed in satoshis, not BTC.

## What is a PSBT?

A Partially Signed Bitcoin Transaction (PSBT) is a standard for transactions that have not yet been fully signed. It allows different participants with different keys to sign a transaction without sharing private keys, enabling safer multi-step or multi-sig flows.

## Get Balance

Query the Bitcoin balance (in satoshis) for a wallet:

```dart theme={"system"}
final sdk = DynamicSDK.instance;
final wallet = sdk.wallets.userWallets.firstWhere(
  (w) => w.chain == 'BTC',
);

final balance = await sdk.bitcoin.getBalance(
  walletId: wallet.id,
);
print('Balance: $balance satoshis');
```

`getBalance` returns a `Future<String>` — satoshis as a string to preserve precision.

## Operations

Detailed guides for each Bitcoin operation:

* [Sign a Message](/flutter/wallets/bitcoin/message-signing) — sign arbitrary messages (ECDSA or BIP-322)
* [Send Bitcoin](/flutter/wallets/bitcoin/send-bitcoin) — one-call transfer
* [Build a PSBT](/flutter/wallets/bitcoin/build-psbt) — construct an unsigned PSBT
* [Sign a PSBT](/flutter/wallets/bitcoin/sign-psbt) — sign one or many PSBTs
* [Send Raw Transaction](/flutter/wallets/bitcoin/send-raw-transaction) — broadcast a pre-signed transaction

## API Reference

| Method               | Returns                | Description                      |
| -------------------- | ---------------------- | -------------------------------- |
| `getBalance`         | `Future<String>`       | Get wallet balance in satoshis   |
| `signMessage`        | `Future<String>`       | Sign a message                   |
| `sendBitcoin`        | `Future<String>`       | Send BTC, returns transaction ID |
| `buildPsbt`          | `Future<String>`       | Build unsigned PSBT (base64)     |
| `signPsbt`           | `Future<String>`       | Sign a single PSBT               |
| `signPsbts`          | `Future<List<String>>` | Sign multiple PSBTs              |
| `sendRawTransaction` | `Future<String>`       | Broadcast raw transaction hex    |

## Next Steps

* [TON Operations](/flutter/wallets/ton/overview) — TON blockchain operations
* [SUI Operations](/flutter/wallets/sui/overview) — SUI blockchain operations
* [Token Balances](/flutter/wallets/general/token-balances) — Multi-chain balance queries
