Skip to content

broadcastTransaction

broadcastTransaction(config, txHex): Promise<string>

Broadcasts a transaction to the bitcoin network. If the transaction is successfully broadcasted, the transaction hash is returned.

Import

ts
import { broadcastTransaction } from "@midl-xyz/midl-js-core";

Example

ts
import { broadcastTransaction } from "@midl-xyz/midl-js-core";

const txHex = "02000000000101...";
const txHash = await broadcastTransaction(config, txHex);
console.log(txHash);

Parameters

NameTypeDescription
configConfigThe configuration object
txHexstringThe transaction hex

Returns

Promise<string> - The transaction hash