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.sendRawTransaction broadcasts a raw transaction hex (or a finalized PSBT) to the Bitcoin network. Use it as the final step after building and signing a PSBT yourself, or to relay a transaction that was signed elsewhere.

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.sendRawTransaction(
  walletId: wallet.id,
  rawTransaction: '0200000001...', // raw tx hex (or finalized PSBT)
);
print('Broadcasted: $txId');

Parameters

ParameterTypeDescription
walletIdStringThe id of a wallet whose chain == 'BTC'.
rawTransactionStringRaw transaction hex (or a fully signed PSBT base64).

Returns

Future<String> — the broadcasted transaction id (txid).
If you just want to send BTC without managing the PSBT, sendBitcoin builds, signs, and broadcasts in a single call.