I'm playing around with bitcore transactions and multi-sig transactions and was wondering how to send a transaction to more than one address, and keep the change.

Currently when I try to send the transaction it is sent, but the fee is calculated as:

unspent - satoshis

An example of this transaction I've made in the block chain can be seen here:

Example Transaction

Ad you can see it's calculated like this:

Original unspent amount: 0.09000000

Fee: 0.08990000

Traded: 0.00010000

Transaction sum: 0.00010000

Now I understand that one must spend all of the unspent outputs in a transaction, but how can I stop the fee from being as above, the remaining unspent balance?

Basically I want to split the transaction for two addresses, and send the rest to a change address.


var utxo = new bitcore.Transaction.UnspentOutput({
  "txid" : "f42af6ab8b4dc3c636c5bfc6ce819063a55060c5619d31a6fa45a36413cb7953",
  "vout" : 0,
  "address" : "2MzuRYCXSHcBDEsSS4rziShvEzWSfoDe2zL",
  "scriptPubKey" : "OP_HASH160 20 0x54025426880aa847ec86f4d2488bbe260bfe0fcb OP_EQUAL",
  "satoshis" : 10000

var pubs = [

var multiSigTx = new bitcore.Transaction()
    .from(utxo, pubs, 2)
    .to("n1fqBkX6GtUsaV3EPqjpHcTuWhAQQgKXov", 10000)
    .sign(["083b63f9dbaa100c1714e05a04c20ab32f83f7726ba54a682013a13df6a92949" ,"5bef634cdcc7f9c2fd2b429d1ddf6cae56923433b6e8b2c5515cf87d84751e0a"]);

var txSerialized = multiSigTx.serialize(true);

// Broadcast

insight.broadcast(txSerialized, function(err, returnedTxId) {
  if (err) {
  } else {
    console.log("Sent coins, tx id is: ");

1 Answer 1


I figured this out, the new transaction code should look like this with the address generated using fromString() method using bitcore.

var address = bitcore.Address.fromString('2NEvGYDNxcVPZ2ThtmPKYoKBCEa3aJNjPL3');
var multiSigTx = new bitcore.Transaction()
    .from(utxo, pubs, 2)
    .to("mntnnj64W4po96m2ck4GXQJTAiKZQChpWB", 10000)
    .to("msR1bBwUWjTTNYFU5UTVNCXDUnEx1y2MMQ", 10000)
    .sign(["7e925007e09447fa6160597391d7a24f8f47e40222d6c94b06bd9cecee5eddff" ,"6b8adfd22b8dd3186ea5333602b39a59fc1c40c543dc3848ea88c6cd6b738594"]);

var txSerialized = multiSigTx.serialize(true);

This will then show the correct change output for the transaction.


  • with this you send 10000 Satoshis to each of the two different addresses? How could we send an amount (10000 Satoshis) to an Array of addresses?
    – Suisse
    Oct 18, 2017 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.