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

# Sign a Message

> Sign a message with a Bitcoin wallet using the Dynamic Flutter SDK.

`DynamicSDK.instance.bitcoin.signMessage` produces a signature for an arbitrary message using the connected Bitcoin wallet. The default signing protocol is `ecdsa`; pass `protocol: 'bip322-simple'` for BIP-322 sign-in flows.

## Basic usage

```dart theme={"system"}
import 'package:dynamic_sdk/dynamic_sdk.dart';

final sdk = DynamicSDK.instance;
final wallet = sdk.wallets.userWallets.firstWhere(
  (w) => w.chain == 'BTC',
);

final signature = await sdk.bitcoin.signMessage(
  walletId: wallet.id,
  message: 'Hello, Bitcoin!',
);
print('Signature: $signature');
```

## With protocol and address type

Override the defaults when you need a BIP-322 signature or want to sign with the ordinals address rather than the payment address:

```dart theme={"system"}
final signature = await sdk.bitcoin.signMessage(
  walletId: wallet.id,
  message: 'Hello, Bitcoin!',
  protocol: 'bip322-simple', // or 'ecdsa'
  addressType: 'payment',    // or 'ordinals'
);
```

## Parameters

| Parameter     | Type      | Description                                             |
| ------------- | --------- | ------------------------------------------------------- |
| `walletId`    | `String`  | The id of a wallet whose `chain == 'BTC'`.              |
| `message`     | `String`  | The message to sign.                                    |
| `protocol`    | `String?` | Signing protocol: `ecdsa` (default) or `bip322-simple`. |
| `addressType` | `String?` | Address type to sign with: `payment` or `ordinals`.     |

## Returns

`Future<String>` — the signature as a string. The encoding depends on the chosen `protocol`.
