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

> [!NOTE]
>
> Both options are ignored for embedded wallets, which have one address type and sign with BIP-322 only. The call still returns a valid signature. Use [signMessage](https://docs.dynamic.xyz/docs/javascript/reference/wallets/sign-message.md) instead, or see [Embedded Wallet Differences](https://docs.dynamic.xyz/docs/javascript/reference/bitcoin/embedded-wallet-differences.md).

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

If the wallet provider does not support specifying an address type or protocol, it uses the default values. Embedded wallets ignore both, as described above.

## 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](https://docs.dynamic.xyz/docs/javascript/reference/bitcoin/sign-psbt.md) - Sign a PSBT
* [sendBitcoin](https://docs.dynamic.xyz/docs/javascript/reference/bitcoin/send-bitcoin.md) - Send a Bitcoin transaction
* [Embedded Wallet Differences](https://docs.dynamic.xyz/docs/javascript/reference/bitcoin/embedded-wallet-differences.md) - How these options behave with embedded wallets


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.