0

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?

  • Maybe it's just a SPV node? – Anderson Nov 27 '17 at 9:45
1

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).

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.