<p>Yes, after refering to some documentations I'm now sure that,you can consume multiple UTXOs in a single transaction but upto a certain limit.Also transaction fees will increase as the size of input increases using multiple UTXOs. 
I used Transaction Builder of bitcoinjs-lib, for transaction. Hence, using</p>

<p><strong>tx.addInput(txId, vOut)</strong> (txId and Vout of respective UTXO to be used) </p>

<p>multiple times, multiple UTXOs can be used. However to estimate the no. of UTXOs, simple logic such as using a FOR loop, till the sum of all UTXOs is sufficient for the btc to be sent, will work.</p>

CC BY-SA 4.0
2019-11-12T11:23:41.633Z
2019-12-13T07:14:42.410Z
2019-12-13T07:14:42.410Z
AditiB
<p>Of course, you can add as many UTXO's as will fit in a block. In fact, you usually have to because you don't always have a UTXO for the exact amount you are trying to spend. Note that more UTXO will result in a higher transaction fee because the fee is based on the current market fee rate (satoshi/kB) and more UTXO increases the kB.</p>

<p>For example, check out <a href="https://blockstream.info/tx/075d633fd17dccc936fbfd8caf3222fc434bb428aa03e492af827890e2ff8fe4" rel="nofollow noreferrer">this transaction</a>, it uses 7 UTXO as inputs.</p>

<p>See <a href="https://en.bitcoin.it/wiki/Transaction" rel="nofollow noreferrer">Bitcoin Wiki - Transactions</a></p>

CC BY-SA 4.0
2019-10-19T15:35:21.193Z
Nit: you can't "add as many UTXO's as will fit in a block". Bitcoin transactions bigger than 400,000 weight units are non-standard and will not be relayed.
Murch
CC BY-SA 4.0
2019-10-19T19:05:10.023Z
Thanks @Murch didn't realize there was a relay standard!
JBaczuk
CC BY-SA 4.0
2019-10-18T13:53:15.120Z
2019-10-18T13:53:15.120Z
JBaczuk
<p>I want to make use of a single bitcoin address for payment. I'm using bitcoinjs library's transction builder for creating my own transaction. Can anyone help with a proper code to use multiple UTXO's in a single transaction? Is there any function which can automatically select the no. of UTXO's to be consumed depending on the output transaction value to be sent?
Thank you.</p>

<transactions><utxo><bitcoinjs>
How can I consume my whole bitcoin balance in a single transction? Is it possible to use multiples UTXOs in a single transaction?
AditiB
# How can I consume my whole bitcoin balance in a single transction? Is it possible to use multiples UTXOs in a single transaction?

(Asked by: username_0 on 2019-10-18)

I want to make use of a single bitcoin address for payment. I'm using bitcoinjs library's transction builder for creating my own transaction. Can anyone help with a proper code to use multiple UTXO's in a single transaction? Is there any function which can automatically select the no. of UTXO's to be consumed depending on the output transaction value to be sent?
Thank you.

**Tags:** transactions, utxo, bitcoinjs


---

## 2 answers

### Answer by username_0 on 2019-11-12. Score: 1 | Accepted answer

Yes, after refering to some documentations I'm now sure that,you can consume multiple UTXOs in a single transaction but upto a certain limit.Also transaction fees will increase as the size of input increases using multiple UTXOs.
I used Transaction Builder of bitcoinjs-lib, for transaction. Hence, using

**tx.addInput(txId, vOut)** (txId and Vout of respective UTXO to be used)

multiple times, multiple UTXOs can be used. However to estimate the no. of UTXOs, simple logic such as using a FOR loop, till the sum of all UTXOs is sufficient for the btc to be sent, will work.


---

### Answer by username_1 on 2019-10-18. Score: 1

Of course, you can add as many UTXO's as will fit in a block. In fact, you usually have to because you don't always have a UTXO for the exact amount you are trying to spend. Note that more UTXO will result in a higher transaction fee because the fee is based on the current market fee rate (satoshi/kB) and more UTXO increases the kB.

For example, check out [this transaction](https://blockstream.info/tx/075d633fd17dccc936fbfd8caf3222fc434bb428aa03e492af827890e2ff8fe4), it uses 7 UTXO as inputs.

See [Bitcoin Wiki - Transactions](https://en.bitcoin.it/wiki/Transaction)

> **Comments:**
> **username_2**: Nit: you can't "add as many UTXO's as will fit in a block". Bitcoin transactions bigger than 400,000 weight units are non-standard and will not be relayed.  
> **username_1**: Thanks @username_2 didn't realize there was a relay standard!  

---

