<p>Yes you need to provide the UTXO details when building a transaction in bitcoinjs. One should not have to trust a library to provide blockchain data, the library works like a calculator and processes the data that it is given. It's not unreasonable at all, these details are easy to get from your node or an explorer.</p>

CC BY-SA 4.0
2020-11-02T03:20:14.650Z
2020-11-02T03:20:14.650Z
m1xolyd1an
<p>So, Let's say I want to create a transaction by using <code>bitcoinjs-lib</code>.</p>
<p>As far as I can see, this library doesn't provide the help so that it can automatically figure out/grab unpent transactions for inputs and create a transaction magically.</p>
<p>My question is: Am I the one who has to know unspent transactions that I want to use for the inputs in advance ?</p>
<p>If the answer is <code>no</code>, then can you point me to the <code>bitcoinjs-lib</code> file that does this ?</p>
<p>If the answer is <code>yes</code>, how do I get unspent transactions ? By looking at my transaction list on blockchain and getting each one of them's txid and vouts seem not reasonable. Any idea ?</p>

<bitcoin-core><transactions><blockchain><bitcoind><bitcoin-core-development>
how does bitcoinjs-lib grab utxo
Nika Kurashvili
# how does bitcoinjs-lib grab utxo

(Asked by: username_0 on 2020-11-01)

So, Let's say I want to create a transaction by using `bitcoinjs-lib`.

As far as I can see, this library doesn't provide the help so that it can automatically figure out/grab unpent transactions for inputs and create a transaction magically.

My question is: Am I the one who has to know unspent transactions that I want to use for the inputs in advance ?

If the answer is `no`, then can you point me to the `bitcoinjs-lib` file that does this ?

If the answer is `yes`, how do I get unspent transactions ? By looking at my transaction list on blockchain and getting each one of them's txid and vouts seem not reasonable. Any idea ?

**Tags:** bitcoin-core, transactions, blockchain, bitcoind, bitcoin-core-development


---

## 1 answers

### Answer by username_1 on 2020-11-02. Score: 2 | Accepted answer

Yes you need to provide the UTXO details when building a transaction in bitcoinjs. One should not have to trust a library to provide blockchain data, the library works like a calculator and processes the data that it is given. It's not unreasonable at all, these details are easy to get from your node or an explorer.


---

