UTXO

From CryptoWiki

Basics

  • Primarily used in bitcoin and its forks. Cardano also uses this model.
  • An Unspent Transaction Output (UTXO) that can be spent as an input in a new transaction.
  • Because each output of a particular transaction can only be spent once, the outputs of all transactions included in the block chain can be categorized as either Unspent Transaction Outputs (UTXOs) or spent transaction outputs. For a payment to be valid, it must only use UTXOs as inputs.
  • Ignoring coinbase transactions, if the value of a transaction’s outputs exceed its inputs, the transaction will be rejected—but if the inputs exceed the value of the outputs, any difference in value may be claimed as a transaction fee by the Bitcoin miner who creates the block containing that transaction.
  • From a paper (Summer 2019) by Andrew Poelstra (Blockstream) and David Vorick (Sia):

"Let me give a quick summary of how bitcoin handles coins and transactions. This is the UTXO model-- unsigned transaction outputs. All bitcoins are assigned to objects called UTXOs. These are individual indivisible objects that have a spending policy, and if you know the secret key you can spend the coins. They also have an amount. To spend coins, you have to take a bunch of UTXOs that you own, you spend all of the UTXOs, and then you create new UTXOs belonging to your recipient(s). Since these are indivisible, you usually have to create an extra output for change to send it back to yourself. Other blockchains have accounts instead of UTXOs, like ethereum.

There are a number of reasons that bitcoin chose the design that it did. When you see a new transaction, you know the only way it will effect the validity of other transactions is if they both try to spend the other UTXOs because UTXOs are atomic. So you check each transaction to see if it conflicts with existing transactions. If it conflicts, then throw it away. If not, bring it into the mempool and check its validity. You never need to validate it again if you see it like in a confirmed block or whatever. But in an account based model, you don't have this simplicity. You can have multiple transactions spending from the same account. If in aggregate some of them spend from the account, then only some will be valid and some will be invalid and you can't tell in advance which ones will be the ones that get into the block.

There's also things about proving properties of existence of UTXOs. In bitcoin, UTXOs get created and destroyed. Those are the only two events in the UTXO's lifecycle. If you want to prove that a UTXO existed at some point, you provide the transaction that created it and a merkle path for the inclusion of the transaction in a blockheader. For things like blockexplorers and other historical analysis auditing applications, this is very convenient. It's very difficult to do this in an account-based model because you have to maintain the balance of every single account at every single point of time and there's no nice compact way to tie that back to individual events in the blockchain which makes proving things about the ethereum chain historically quite difficult."

UTXO Age Analysis 

"Unspent transaction output (UTXO) age analysis is an area of the literature that studies the supply side of a cryptoasset by examining the behavior of holders. UTXO refers to the output of a transaction that a user holds and is able to spend by serving as inputs into future transactions. This accounting model is used by Bitcoin (BTC) and several other UTXO-based chains. Although the naming of this area of the literature makes specific reference to UTXOs, several of the concepts developed here have been successfully adapted to account-based chains, such as Ethereum. 

The earliest known contribution to this field was in ByteCoin (2011) where the term “Bitcoin days destroyed” was first defined as an alternative measure to transaction value. Bitcoin days destroyed is calculated as the number of BTC transacted over a period of time multiplied by the number of days since those BTC were last transacted. This gives a higher weight to coins that have not been spent in a long time, and less weight to coins spent more recently. For example, a coin that had not been transacted in 100 days is weighted 100x more than a coin that had been transacted 1 day ago. This fundamental insight, that inferences can be made by analyzing the age of last use for each coin, set the foundation for subsequent research."