user30613: I want to create a Tx with bitcoincashjs:
create-a-transaction
But how do I specify multi inputs: from(utxo) and multi outputs: to ?

user38618: const bch = require('bitcoincashjs');

const privateKey = new bch.PrivateKey('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
const utxos = [{
  'txId' : '115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986',
  'outputIndex' : 0,
  'address' : '17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV',
  'script' : '76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac',
  'satoshis' : 50000
}, {
  'txId' : '115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986',
  'outputIndex' : 0,
  'address' : '17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV',
  'script' : '76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac',
  'satoshis' : 50000
}];
const transaction = new bch.Transaction()
  .from(utxos)
  .to('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000)
  .sign(privateKey);

console.log(transaction.toString())


from: A high level interface to add an input from a UTXO. It has a series of variants:
from(utxo): add an input from an Unspent Transaction Output. Currently, only P2PKH outputs are supported.
from(utxos): same as above, but passing in an array of Unspent Outputs.
from(utxo, publicKeys, threshold): add an input that spends a UTXO with a P2SH output for a Multisig script. The publicKeys argument is an array of public keys, and threshold is the number of required signatures in the Multisig script.

Details: https://bitcore.io/api/lib/transaction#adding-inputs

30613: <p>I want to create a Tx with bitcoincashjs:
<a href="https://github.com/bitcoincashjs/bitcoincashjs/blob/master/docs/examples.md#create-a-transaction" rel="nofollow noreferrer">create-a-transaction</a>
But how do I specify multi inputs: from(utxo) and multi outputs: to ?</p>
 38618: <pre><code>const bch = require('bitcoincashjs');

const privateKey = new bch.PrivateKey('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
const utxos = [{
  'txId' : '115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986',
  'outputIndex' : 0,
  'address' : '17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV',
  'script' : '76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac',
  'satoshis' : 50000
}, {
  'txId' : '115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986',
  'outputIndex' : 0,
  'address' : '17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV',
  'script' : '76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac',
  'satoshis' : 50000
}];
const transaction = new bch.Transaction()
  .from(utxos)
  .to('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000)
  .sign(privateKey);

console.log(transaction.toString())
</code></pre>

<blockquote>
  <p><code>from</code>: A high level interface to add an input from a UTXO. It has a series of variants:</p>
  
  <p><code>from(utxo)</code>: add an input from an Unspent Transaction Output. Currently, only P2PKH outputs are supported.</p>
  
  <p><code>from(utxos)</code>: same as above, but passing in an array of Unspent Outputs.</p>
  
  <p><code>from(utxo, publicKeys, threshold)</code>: add an input that spends a UTXO with a P2SH output for a Multisig script. The publicKeys argument is an array of public keys, and threshold is the number of required signatures in the Multisig script.</p>
</blockquote>

<p>Details: <a href="https://bitcore.io/api/lib/transaction#adding-inputs" rel="nofollow noreferrer">https://bitcore.io/api/lib/transaction#adding-inputs</a></p>
