The full name of the "UTXO" model is the "Unspent Transaction Output" model, which is used to record, store, and execute transactions, and was first used in Bitcoin.
How the UTXO Model Works#
"UTXO" accounts for transactions using the remaining cryptocurrency amount after the transaction is executed (i.e., unspent cryptocurrency). Therefore, in the UTXO model, there are no "accounts" and "balances," which is the biggest difference from the "account model." In other words, "in the UTXO model, the balance that a user can transfer is the amount that has not been spent in their previous transactions."
In the UTXO model, each transaction consists of inputs and outputs represented as UTXOs. An input consumes an existing UTXO, while an output creates a new UTXO. After the transaction is completed, any unused outputs are recorded as inputs in the database and can be used for future transactions.
Example of the UTXO Model#
Wallet A has 5 bitcoins (UTXO_0). Wallet B has an empty wallet. Now, A wants to send 3.15 BTC to B's wallet. A's 5 BTC will be recorded as an input, then consumed, while creating 3.15 BTC and 1.85 BTC (UTXO_1 and UTXO_2) as outputs of the transaction. UTXO_2 goes to A's wallet, and UTXO_1 goes to B's wallet. After the transaction, A's wallet has an unused balance of 1.85 BTC, and B's wallet has an unused balance of 3.15 BTC.
Characteristics of UTXO#
The core design principle of UTXO is statelessness. It records transaction events rather than the final state, and users need to calculate balances based on the transaction history.