1

Since the output can be spend only once, I am confused by transactions containing multiple recipients. For example, if Alice transfers 5 BTC to Bob and 5 BTC to David in the same transactions. In the future, Bob refers to the Alice's transaction, also David can refer to the same transaction. I understand that outputs are numbered in Alice's transaction to Bob and Eve. Therefore the output number and transaction id Tx id uniquely determines whether there is double spend happening or not.

Am I correct? Is the UTXO associated with output and Tx id?

1

2 Answers 2

1

Each transaction draws on a set of [1..n] Unspent Transaction Outputs to spend. These we call the inputs of a transaction.
The transaction then assigns the total value of the inputs to [0..n] new Unspent Transaction Outputs. Each UTXO is associated with the creating transaction and uniquely numbered among that set. The most common script that makes up a UTXO is "pay-to-pubkeyhash", where an UTXO can only be spent in combination with a valid signature by it's recipient.

The value of the outputs must be smaller or equal to the value of the inputs. The difference of those two totals can be claimed by the miner as transaction fee.

To come back to your example:

Transaction A1:
Alice -> 5BTC -> Bob (Transaction A1, output 0)
Alice -> 5BTC -> David (Transaction A1, output 1)

(Alice needs to put in at least 10BTC for that transaction.)

Bob wants to spend his money:
Bob -> spend(Transaction A1, output 0, signature) -> new recipient.

Since each UTXO is uniquely identifiable, they cannot both try to access the same UTXO.

0

Is the UTXO associated with output and Tx id?

Yes, you're exactly right, each UTXO is basically just a tuple (txid, output_index). Then when that output is going to be spent, you refer to it by listing the tuple as an input.

Essentially, that's why they're called "Unspent Transaction Outputs" (UTXOs), not "Unspent Transactions".

For example, look at this random transaction output I pulled of of the block chain:

txid: 564bb87efc20751dde182b678e848ceaa75ac54fd2eab33808842f40e953f7e6
output: 1
scriptPubKey: 76a9148ab215e3d638357551f5e6e7e3384b56bb355a6c88ac

(Note that 1 is the index, meaning it's actually the second output)

Then when the transaction is spent, the input references this previously unspent transaction output.

ID of spending TX: 57149f629790e61a5fbab9e27041858ada6348aa17323c15b9da9659b90717bb
input:
  "txid" : "564bb87efc20751dde182b678e848ceaa75ac54fd2eab33808842f40e953f7e6",
  "vout" : 1,
  "scriptSig": 48304502205b6d49f0e473e5b6134c9ba55dcfdd9e010a226fb29f89e9f4ff1a2b568a1d4c022100af290372ed889ffff948662d7a5b1f2d6eb29dbdcad260ab53f99aba6b6e46e50121020f4db25f5bd35cb2c541ecdbcdb0e7c0be890cb4e25895612f8a1cbb32216ff0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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