A UTXO, which stands for ‘Unspent Transaction Output’, is that amount of cryptocurrency obtained by the recipient, or held by the sender, following a transaction on certain blockchains (such as Bitcoin’s); the amount of each UTXO can then be ‘spent’ on a new exchange. The balance of a crypto wallet is, therefore, the sum of all UTXOs not yet used.
Let us describe with an example how the UTXO model works: Anna has 1 Bitcoin in her wallet and wants to transfer 0.4 BTC to Beatrice; the transaction will not move the exact amount, but will have as input 1 BTC, which will then be divided into 0.4 Bitcoin to be sent to Beatrice and 0.6 to be returned to Anna. The separate outputs of 0.4 BTC and 0.6 BTC, thus generated, represent two UTXOs, which can be inputs for future transactions.
In this regard, the single BTC in the example consisted of only one UTXO, as it was the ‘whole’ result of past exchanges, so it had to be split; however, if Anna had already obtained a 0.4 BTC UTXO from previous transactions, she could send it directly to Beatrice. Conversely, if Anna wanted to send 1 ‘whole’ Bitcoin, but did not have a UTXO of that amount, she could use a 0.7 BTC UTXO and a 0.3 BTC UTXO, again obtained from previous transactions. The input UTXOs, in fact, can also be ‘summed’ to produce an output with a higher value.
The mechanism is therefore very similar to that of purchases in fiat currency, such as the Euro: UTXOs are equivalent to the change we receive when we pay for an object with an amount of money higher than its actual cost, because we do not have notes or coins of the right denomination. For example, we cannot ‘split’ a 10€ note to pay for an item costing 5€, so we will receive 5€ as change, which can be used for future purchases.
Returning to the crypto world, the sender signs each transaction with their private key, so as to ‘unlock’ the UTXOs they possess, also indicating the recipient’s wallet address or public key. This allows transactions to be traced: the UTXOs represent a ‘chain of ownership’, being the beginning and end of each transaction. The ‘history’ of a UTXO, in fact, allows it to be traced back to the miner who, in the first place, received it as a reward from mining.
In addition, each node in the blockchain network keeps an up-to-date register (set) of all UTXOs existing at a given time and their owners. Altogether, the set of UTXOs collects a number of coins equal to the total supply of that cryptocurrency.
In this way, nodes can check the validity of a transaction: they always check that the input quantity is equal to or greater than the sum of the outputs, thus preventing users from spending the same UTXOs twice, an illegal action called double spending.
The UTXO model, however, is not exploited by all blockchains: Ethereum, for instance, exploits the account model to manage wallet balances and transactions on the network.