What is UTXO Model? How can blockchain Address them?
UTXO stands for the unspent output from bitcoin transactions. Each bitcoin transaction begins with coins used to balance the ledger. UTXOs are processed continuously and are responsible for beginning and ending each transaction. Confirmation of transaction results in the removal of spent coins from the UTXO database. This model was inspired from the bank’s record keeping of accounts, owner of accounts, and balance in those accounts.
Satoshi Nakamoto proposed to index by coin, so for each coin, the data structure records the owner of this coin. For efficiency, the records are not by whole coins, rather they contain arbitrary amounts and their owners. Thus, the balance of the user is the sum of amounts whose records indicate they belong to that user.
A transaction in the UTXO model comprises two lists — inputs and outputs. The outputs are the new records indicating ownership of amounts. The inputs are references to outputs of previous transactions, i.e., the records to be destroyed. Each transaction is uniquely identified by a cryptographic hash of its contents, called TxHash.
Each transaction signifies the movement of funds from one user to another. Therefore, it contains the information which records to destroy — that of the previous owner, and the new record to add — that of the new owner. The new records formed by the transaction are called its outputs, and the references to old records, which should be destroyed, are called its inputs. Obviously, the sum of coins in records destroyed should equal the sum of coins in the records generated; when a transaction references a previous transaction output to use its coins it is said to spend this output. The system’s state is thus defined by the set of all transaction outputs that were not yet spent or the Unspent Transaction Outputs or the UTXO Set.The total amount of coin a user has is the sum of amounts recorded with her ownership. Each user keeps track of the coins in her possession, which she can use to create new transactions. We proceed to describe the structure of a transaction.
In a banking system, the system is protected through an authentication mechanism and only an authen- ticated user can order a transaction out of her account. In an open system, since any node can add a transaction, the authorization is implemented with cryptographic primitives.
Transaction outputs contain, beyond the transferred amount, a spending condition, phrased as a script called ScriptPubKey. An output spending this input holds a claim- ing condition called ScriptSig.
An input is only valid if the ScriptPubKey in its refer- enced output evaluates to true with the input’s ScriptSig. A transaction is only valid if all of its inputs are valid. A user’s balance is, therefore, the sum of UTXOs for which the user can supply ScriptSig that would evaluate to true.