Wednesday, November 6, 2024

Should enter UTXO references be distinctive in a transaction, and/or distinctive in a block?

Should enter UTXO references (txid + vout) be distinctive in a transaction, and/or be distinctive in a block?

UTXO needs to be distinctive, interval.
Having mentioned that, there was no less than one case the place two totally different transactions (coinbase transactions on this case) had the identical txid. This was mounted by BIP34

Put one other means, is it a rule that UTXOs may be consumed piecemeal in transactions and blocks, as long as the whole quantity spent is <= to the UTXO’s quantity?

UTXOs are consumed (or spent) in transactions.
Blocks register transactions.

If a transaction was constructed during which totally different inputs referenced the identical UTXO, would the transaction be customary or legitimate?

It will be invalid: a UTXO can solely be spent as soon as.
If a transaction would use a UTXO twice as totally different inputs, that may imply it could be spending the UTXO twice, which it isn’t allowed.

If a block was constructed during which totally different inputs in numerous transactions use the identical UTXO, would the block be legitimate?

No, the block could be invalid, as a result of on this case the identical UTXO could be spent twice on totally different transactions. Bear in mind, a UTXO can solely be spent as soon as.

In each instances, let’s assume that the whole quantity consumed is lower than the UTXO complete.

When a UTXO is spent, it is spent in its entirety. It is not doable to spend a part of a UTXO. If the quantity you need to spend is lower than the UTXO, you generate a brand new UTXO with the change.

Think about you’ve got 2 UTXOs, one among 5.000 sats and the opposite of 6.000 sats, and also you and to pay me 7.000 sats. On this case, the transaction would have:

  • two inputs (the two UTXOs) with a complete of 11.000 sats
  • two outputs:
    • one locked to my public key (my fee), of seven.000 sats
    • one locked to your public key (your change) of 4.000 sats

The 2 preliminary UTXOs at the moment are spent and you may overlook about them.
Now there are 2 new UTXOs:

  • mine UTXO of seven.000 sats
  • your UTXO of 4.000 sats

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles