<p>A transaction ID is just the hash of the transaction, it doesn't matter if the transaction is incomplete (invalid), or unconfirmed, or confirmed. The wTXID is similar in operation, but only hashes a portion of the transaction.</p>

CC BY-SA 4.0
2021-09-14T03:57:03.407Z
I think OP is confused by thinking the UTXO's txid is that of the spending transaction perhaps.
Pieter Wuille
CC BY-SA 4.0
2021-09-14T05:43:22.543Z
@PieterWuille You are correct Pieter, I just did an overview of transactions and spending and I didn't fully understand it (still don't but I now understand utxo (unspent outputs). Thank ya'll so much for being patient and not bashing my noob questions. Really do appreciate it.
Trevor
CC BY-SA 4.0
2021-09-14T02:54:45.733Z
2021-09-14T03:43:57.000Z
2021-09-14T03:43:57.000Z
Claris
<p>I'm using bitcore atm and am trying to set up transactions. but I can't find much information on the <code>txId</code> &amp; the <code>script</code>. I know it says the txId is generated from the transaction, but how can you generate a txId for a transaction which has yet to take place?</p>
<p>Maybe I'm not fully understanding this process fully, is there somebody who understands who could explain it a bit better?</p>
<pre><code>var utxo = {
  &quot;txId&quot; : &quot;115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986&quot;,
  &quot;outputIndex&quot; : 0,
  &quot;address&quot; : &quot;17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV&quot;,
  &quot;script&quot; : &quot;76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac&quot;,
  &quot;satoshis&quot; : 50000
};

var transaction = new bitcore.Transaction()
  .from(utxo)
  .to('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000)
  .sign(privateKey);
</code></pre>
<p>Edit: I posted this with the misunderstanding of how value is counted on the blockchain. I see now that the txid and/or utxos are not of the current transaction but of the previous unspent transactions that the spending address received.</p>

<transactions><bitcore>
How to generate utxo information for a bitcoin transaction?
Trevor
# How to generate utxo information for a bitcoin transaction?

(Asked by: username_0 on 2021-09-14)

I'm using bitcore atm and am trying to set up transactions. but I can't find much information on the txId & the script. I know it says the txId is generated from the transaction, but how can you generate a txId for a transaction which has yet to take place?
Maybe I'm not fully understanding this process fully, is there somebody who understands who could explain it a bit better?
var utxo = {
  "txId" : "115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986",
  "outputIndex" : 0,
  "address" : "17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV",
  "script" : "76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac",
  "satoshis" : 50000
};

var transaction = new bitcore.Transaction()
  .from(utxo)
  .to('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000)
  .sign(privateKey);

Edit: I posted this with the misunderstanding of how value is counted on the blockchain. I see now that the txid and/or utxos are not of the current transaction but of the previous unspent transactions that the spending address received.

**Tags:** transactions, bitcore


---

## 1 answers

### Answer by username_1 on 2021-09-14. Score: 1 | Accepted answer

A transaction ID is just the hash of the transaction, it doesn't matter if the transaction is incomplete (invalid), or unconfirmed, or confirmed. The wTXID is similar in operation, but only hashes a portion of the transaction.

> **Comments:**
> **username_2**: I think OP is confused by thinking the UTXO's txid is that of the spending transaction perhaps.  
> **username_0**: @PieterWuille You are correct Pieter, I just did an overview of transactions and spending and I didn't fully understand it (still don't but I now understand utxo (unspent outputs). Thank ya'll so much for being patient and not bashing my noob questions. Really do appreciate it.  

---

