Broadcast Raw Tx

From time-to-time you may need to broadcast a raw transaction. Panda Wallet makes this simple.

You will need to pass an object that contains the rawtx:

{
    rawtx: string
    fund?: boolean;
}

Passing the optional fund param will add and sign inputs from the user's Panda Wallet along with calculating and applying the appropriate change for the tx.

const wallet = initProvider(); // see "Detecting the Provider"

const param = {
  rawtx:
    "0100000001f95217821c6d4cc4ca11c4231e23792df07eb4a221dd6dc21b69098f03b22890010000006a473044022061c5fa065d467a46be2fab22dd789aef3c87fd7c315d08d46aee4c9709f3864702207c700a453c8bb09d2b9e5d71e0acd9f27829ee8c5edb521fbc51d203ab651e304121028a82915b163f1341cebbdcae5f1c8396e08db3cd95d00f7873ba9b33d8faaa9cffffffff02f4010000000000001976a9143da10df305df0db0f1f5621c4026a7ce5867bfaf88acbd750000000000001976a914e21750ff1e380e0d3e84eedeaa09b47531997ba988ac00000000",
};

try {
    const txid = await wallet.broadcast(param);
    console.log(txid);
    // f2fc518036d96c956c30b995b4b0a70d6008b4b7ef666f7c913b2a79ab57d679
} catch (err) {
    console.log(err);
}

Last updated