My current understanding of a transaction is as follows:
- a transaction (Tx) can have multiple inputs (which are previous unspent transactions = UTXOs), let's call them the TxIn
- a Tx can have multiple outputs (which thus become UTXOs before they will themselves become spent by being used as TxIn), let's call them the TxOut
- the TxOut have a specific order N in the transaction: TxOut[0], TxOut[1], etc.
- each TxIn references the number N which corresponds to the index of the TxOut referred to in point 3 above, so this makes the link between a specific TxIn and a specific TxOut
- each TxOut specifies a specific bitcoin amount (which represents the UTXO amount that can be later spent)
- each TxOut references one or multiple (in the case of MultiSig) bitcoin addresses (public keys) that can spend the amount
- however, and this is what I don't understand, the TxIn does NOT specify the amount of bitcoins that are used
If the TxIn does not specify the amount that is used, how do we determine the spent amount for each TxIn, and thus the UTXO of the part of the TxIn that remains unspent?
Example, a transaction with 2 inputs and one output (assuming no fees):
- TxIn[0] whose UTXO before spending is 1 BTC
- TxIn[1] whose UTXO before spending is 1 BTC
- TxOut[0] whose value is 1.5 BTC
How do we know which TxIn, and how much of which, was spent?
- was it TxIn[0] for 0.75 and TxIn[1] for 0.75?
- was it TxIn[0] for 0.5 and TxIn[1] for 1?
What am I missing? Because given the above, it is not possible to determine the spent proportion of each input.