> ## 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.

# signMessageWithCustomOptions

# signMessageWithCustomOptions

Signs a message with custom options, allowing you to specify the address type and signing protocol. This is useful when you need more control over the signing process than the standard `signMessage` function provides.

## Usage

```javascript theme={"system"}
import { signMessageWithCustomOptions, isBitcoinWalletAccount } from "@dynamic-labs-sdk/bitcoin";
import { getPrimaryWalletAccount } from "@dynamic-labs-sdk/client";

const walletAccount = getPrimaryWalletAccount();

if (walletAccount && isBitcoinWalletAccount(walletAccount)) {
  const { signature } = await signMessageWithCustomOptions({
    walletAccount,
    message: "Hello, Bitcoin!",
    addressType: "payment", // or 'ordinals'
    protocol: "ecdsa", // or 'bip322-simple'
  });

  console.log("Signature:", signature);
}
```

## Parameters

| Parameter       | Type                                    | Description                                                             |
| --------------- | --------------------------------------- | ----------------------------------------------------------------------- |
| `message`       | `string`                                | The message to sign                                                     |
| `walletAccount` | `BitcoinWalletAccount`                  | The wallet account to sign with                                         |
| `addressType`   | `'ordinals' \| 'payment'` (optional)    | The address type to use for signing                                     |
| `protocol`      | `'ecdsa' \| 'bip322-simple'` (optional) | The signing protocol to use                                             |
| `client`        | `DynamicClient` (optional)              | The Dynamic client instance. Only required when using multiple clients. |

## Address Types

* `payment` - Use the standard payment address
* `ordinals` - Use the ordinals (inscriptions) address

## Protocols

* `ecdsa` - Standard ECDSA signature
* `bip322-simple` - BIP-322 simple signature format

Note: If the wallet provider does not support specifying an address type or protocol, it will use the default values.

## Returns

`Promise<{ signature: string }>` - A promise that resolves to an object containing the signature.

## Errors

| Error                       | Description                                                             |
| --------------------------- | ----------------------------------------------------------------------- |
| `NotBitcoinProviderError`   | Thrown if the wallet account's provider is not a Bitcoin provider       |
| `MethodNotImplementedError` | Thrown if the wallet provider does not implement the signMessage method |

## Related functions

* [signPsbt](/javascript/reference/bitcoin/sign-psbt) - Sign a PSBT
* [sendBitcoin](/javascript/reference/bitcoin/send-bitcoin) - Send a Bitcoin transaction
