What is UTXO Model?
Last updated
Last updated
UTXO model stands for the “Unspent Transaction Output Model”. It is one of the primary bookkeeping models for shared ledgers (blockchains), which is used for recording, storing, and executing transactions. UTXO model is mostly discussed with Bitcoin. But in fact, it also was deployed in many other blockchain networks, such as NEO, Litecoin, Zcash, Cardano (Extended UTXO Model), etc.
The name of the UTXO model contains its fundamental concept, which is the model uses the unspent portion of the cryptocurrency in a transaction as an accounting measure.
In the UTXO model, "accounts" and "balances" do not exist. It only uses UTXO as a unit of measurement for transaction execution. A UTXO refers to the amount of cryptocurrency remaining (namely the unspent cryptocurrency) after a transaction is executed. In other words, the balance a user can transfer is the amount he has not spent yet from previous transactions.
In the UTXO model, every transaction is composed of inputs and outputs which are expressed as UTXOs. Inputs consume an existing UTXO, while outputs create a new UTXO. When a transaction is completed, any unspent outputs will be recorded in the database as inputs that can be used later for a new transaction.
A has 5 BTC (UTXO_0) in his wallet. B has an empty wallet. Now, A wants to send 3.15 BTC to B's wallet. The 5 BTC of A will be recorded as input, then consumed (can be seen as destroyed). Meanwhile, 3.15 BTC and 1.85 BTC (UTXO_1 and UTXO_2) will be created as outputs for transfer. UTXO_2 will transfer to A's wallet, and UTXO_1 goes to B's wallet. After this transaction, A's wallet will have a total unspent balance of 1.85 BTC. B's wallet will have an unspent balance of 3.15 BTC.
Note: In real blockchain transactions, transaction fees will be deducted. For instance, the balance of UTXO_2 will be slightly lower than 1.85 BTC after deducting the transaction fee.
UXTO model is applied as a blockchain bookkeeping model, mainly because it can trace the origins of transactions and verify them.
From the above example, we can see that the origin of every single asset can be traced back to its creation. Because every transaction output must have a corresponding input. In the Bitcoin system, every Bitcoin can be traced back to the block in which it was mined. By using the UTXO model, once a mistaken transaction happens, the system can precisely locate its origin.
The UXTO model can also be seen as a verification system. It only allows transactions to be executed when the inputs are Unspent Inputs. The system will verify the status of inputs before executing transactions. If the inputs are unspent, then transactions proceed. This can help prevent malicious behaviors (such as the Double Spending Problem) happens.