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
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:
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.Last modified on May 12, 2026