DynamicSDK.instance.bitcoin.sendBitcoin builds, signs, and broadcasts a Bitcoin transfer in a single call. Use it when you don’t need to inspect or modify the PSBT before broadcast — see Build a PSBT and Sign a PSBT for the manual flow.
Example
import 'package:dynamic_sdk/dynamic_sdk.dart';
final sdk = DynamicSDK.instance;
final wallet = sdk.wallets.userWallets.firstWhere(
(w) => w.chain == 'BTC',
);
final txId = await sdk.bitcoin.sendBitcoin(
walletId: wallet.id,
recipientAddress: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
amount: '50000', // 50_000 sats = 0.0005 BTC
feePriority: 'medium', // optional: 'high', 'medium', or 'low'
);
print('Broadcasted: $txId');
Parameters
| Parameter | Type | Description |
|---|
walletId | String | The id of a wallet whose chain == 'BTC'. |
recipientAddress | String | Destination address. |
amount | String | Amount in satoshis, encoded as a string to preserve precision. |
feePriority | String? | Fee tier: 'high', 'medium', or 'low'. Defaults are connector-specific. |
Returns
Future<String> — the broadcasted transaction id (txid).
Converting BTC to satoshis
amount is always a satoshi string. 1 BTC = 100,000,000 satoshis. Convert from a user-supplied BTC value before calling:
String btcToSats(double btc) =>
BigInt.from((btc * 100000000).round()).toString();
final txId = await sdk.bitcoin.sendBitcoin(
walletId: wallet.id,
recipientAddress: 'bc1q...',
amount: btcToSats(0.001), // '100000'
);
Last modified on May 12, 2026