Iam using the bitcoinjs-lib library and trying to do a transaction. Iam doing the tx.addInput method before building but running into a build issue. I assume an error is thrown if blockchainScripthash_listunspent cannot retrieve the previous tx_hash.


If not a coinbase transaction, you have to spend from an existing output. Thus the input must reference an existing transaction.

cannot retrieve the previous tx_hash

Maybe the library you are using is the following common semantic:

  • txid for the transaction id (hash without the witness data)
  • tx_hash for the transaction hash (hash with the witness data)

You want the txid to reference a previous transaction in an input.

| improve this answer | |

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.