user103257: 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.

user101498: 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.

103257: <p>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.</p>
 101498: <p>If not a coinbase transaction, you <em>have</em> to spend from an existing output. Thus the input <em>must</em> reference an existing transaction.</p>

<blockquote>
  <p>cannot retrieve the previous tx_hash</p>
</blockquote>

<p>Maybe the library you are using is the following common semantic:</p>

<ul>
<li><code>txid</code> for the transaction id (hash <em>without</em> the witness data)</li>
<li><code>tx_hash</code> for the transaction hash (hash <em>with</em> the witness data)</li>
</ul>

<p>You want the <code>txid</code> to reference a previous transaction in an input.</p>
