Skip to main content

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.

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

ParameterTypeDescription
walletIdStringThe id of a wallet whose chain == 'BTC'.
messageStringThe message to sign.
protocolString?Signing protocol: ecdsa (default) or bip322-simple.
addressTypeString?Address type to sign with: payment or ordinals.

Returns

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