Spend multiple UTXO on a single transaction #TESTNET

How to build a proper transaction with multiple UTXO ?

I’m currently playing with Transaction Playground (very cool btw) and I’m against something I don’t understand.

I want to spend the only utxo related to these address

  • mwYyUSbseegdJb6kkeA73QwRTVjkwLL8PL
  • mrwa2VsbmkbeqTiLP9GCkqpdL6QxufLJLN
  • mwhzFewFiPCqf1YUAAcNXNmPMKVuVpnaDF

I use the fetch utxo feature, select them, then add an appropriate output.
After that, I sign with three different private key.

At this point, I can compare two things that should be similar :

  • The result of Transaction under the hood when serialized
  • Serialized transaction

But both raw transaction are not the same (I use decode_tx to do so).

I broadcast the Serialized transaction and It works as expected (transaction), great, but to achieve the same result I expected to “copy past” what it is show on under the hood.

Then I tried things but I didn’t achieve something working.

Under the hood

var transaction = new bitcore.Transaction()
.to('mfYy1JhqrUCKuBNVFcFLURzG5L7uqocTkZ', 77459100)

Where are the other input ? :confused:

My last try

var utxos = [];
utxos.push(new bitcore.Transaction.UnspentOutput({
utxos.push(new bitcore.Transaction.UnspentOutput({
utxos.push(new bitcore.Transaction.UnspentOutput({

var transaction = new bitcore.Transaction()
.to('mfYy1JhqrUCKuBNVFcFLURzG5L7uqocTkZ', 77459100)

Well, obviously It can’t work now given that I already consume these inputs but still, I tried to broadcast the result raw transaction before and it didn’t work :confused:

Well, instead of pushing all the UnspentOutput object into an array and give it to .from(array) method, just use as many .from as you inputs you have and it works but still, I don’t get it why it didn’t work as I did :confused: