Bitcoin

Should input UTXO references be unique across transactions or across blocks?

Should the input UTXO reference (txid + vout) be unique across transactions or across blocks?

UTXOs must be unique. That said, there has been at least one case where two different transactions (in this case Coinbase transactions) had the same txid. This issue is fixed in BIP34.

In other words, is the rule that UTXOs can be spent piecemeal across transactions and blocks if the total amount spent is less than the UTXO amount?

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

If a transaction is configured where different inputs reference the same UTXO, is that transaction canonical or valid?

This is not valid. A UTXO can only be used once. If a transaction uses a UTXO twice with different inputs, it will consume the UTXO twice, which is not acceptable.

If different inputs from different transactions form a block using the same UTXO, is that block valid?

No, the block is invalid. This is because in this case the same UTXO is used twice for different transactions. Remember that a UTXO can only be used once.

Let’s assume that in both cases the total amount consumed is less than the UTXO total.

When a UTXO is consumed, the full amount is consumed. It is not possible to use part of a UTXO. If the amount you want to spend is less than UTXOs, your changes generate new UTXOs.

Imagine I have 2 UTXOs, one with 5,000 sats and the other with 6,000 sats and you pay me 7,000 sats. In this case, the transaction includes:

  • 2 inputs (2 UTXOs) with a total of 11,000 sats
  • Two outputs:
    • One is locked to my public key (my payment) of 7,000 sats.
    • One is locked to the public key (changes) of 4,000 sats.

Now that the two initial UTXOs are used, you can forget about them. There are now two new UTXOs.

  • Mining 7,000 sats of UTXO
  • UTXO 4,000 sats

Related Articles

Back to top button