<p>BitcoinJS does not link directly to the bitcoin network, it is simply a collection of bitcoin-related functions. </p>

<p>Taking your example above, if we wanted to create a transaction with BitcoinJS' transaction builder function, we would have to find the inputs ourselves via API's (or asking your own full node if you have one) and add then it with tx.addInput(txId, 0). </p>

CC BY-SA 3.0
2017-11-27T13:39:29.153Z
2017-11-27T13:39:29.153Z
timothyylim
<p>I see the reference code in BitcoinJS website about 'Creating a Transaction':</p>

<pre><code>var tx = new bitcoin.TransactionBuilder()

// Add the input (who is paying):
// [previous transaction hash, index of the output to use]
var txId = 'aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31'
tx.addInput(txId, 0)
</code></pre>

<p>My question is how it get the data about tx(like its inputs/outputs)? Does it link to some nodes or API like blockchain.info?</p>

CC BY-SA 3.0
2017-11-27T09:45:12.917Z
Maybe it's just a SPV node?
Anderson
<bitcoinjs>
How BitcoinJS sync bitcoin blockchain/transaction data?
Anderson
# How BitcoinJS sync bitcoin blockchain/transaction data?

(Asked by: username_0 on 2017-11-27)

I see the reference code in BitcoinJS website about 'Creating a Transaction':

```
var tx = new bitcoin.TransactionBuilder()

// Add the input (who is paying):
// [previous transaction hash, index of the output to use]
var txId = 'aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31'
tx.addInput(txId, 0)

```

My question is how it get the data about tx(like its inputs/outputs)? Does it link to some nodes or API like blockchain.info?

**Tags:** bitcoinjs

> **Comments:**
> **username_0**: Maybe it's just a SPV node?  

---

## 1 answers

### Answer by username_1 on 2017-11-27. Score: 1 | Accepted answer

BitcoinJS does not link directly to the bitcoin network, it is simply a collection of bitcoin-related functions.

Taking your example above, if we wanted to create a transaction with BitcoinJS' transaction builder function, we would have to find the inputs ourselves via API's (or asking your own full node if you have one) and add then it with tx.addInput(txId, 0).


---

