The so-called UTXO model, simply put, is a special accounting model. Its Chinese meaning is "Unspent Transaction Output," and it differs significantly from the traditional bank account model in that it records the transaction itself rather than the result of the transaction.
For example, in the traditional bank account model, the result is recorded directly. If I have 10,000 yuan in my account and transfer 3,000 to you, 3,000 will be deducted from my account, leaving a balance of 7,000, while 3,000 will be added to your account.
However, the UTXO model does not record transactions this way. Instead, it records the entire transaction process. Here’s how it works: Suppose I have 10,000 yuan in my account and want to transfer 3,000 to you. The UTXO model first records the entire 10,000 yuan as being transferred out, then records 3,000 yuan going to your account and 7,000 yuan being transferred back to my own account.
Throughout this process, it records all relevant information, such as the account funds involved, transaction addresses, transferred amounts, and fund sources. This allows the origin of every transaction to be traced. Therefore, the essence of UTXO is a form of ledger accounting that records the process of transactions.
The advantage of this model is that it ensures every transaction is clearly recorded and traceable to its source. It is precisely because of this feature that UTXO, combined with the consensus mechanism, can solve the double-spending problem.
Blockchain solves the first type of double-spending problem by borrowing from traditional banking methods, processing transactions one by one in order. When a node processes a transaction, it first checks whether the transaction funds exist via the UTXO model, then traces the origin of the transaction. If everything is confirmed, the transaction is broadcasted across the network through the consensus mechanism and recorded on the chain.
If someone attempts to spend the same money twice, the blockchain network will only confirm the first transaction it receives. For the subsequent transaction, the node will discover during the UTXO check that the funds have already been spent and are no longer in the account, thus rejecting the transaction. This solves the first type of double-spending problem.
However, the double-spending problem caused within the rules cannot be resolved by UTXO. This type of double-spending involves exploiting the rules of the consensus mechanism itself to alter already recorded transactions, commonly seen in 51% attacks. For example, in a blockchain using the Proof-of-Work (PoW) consensus mechanism, if the network is small and one node controls 51% of the computing power, that node can first conduct a transaction, then use the consensus mechanism to alter the transaction record afterward, invalidating the previous transaction and returning the spent funds to their account for reuse.
This type of double-spending problem can only be solved by increasing the network's total computing power. Therefore, in blockchain, the more users there are, the higher the total computing power, and the more secure the network becomes.
In summary, UTXO not only helps the consensus mechanism solve the first type of double-spending problem in blockchain but also gives blockchain its traceability feature. This ensures the authenticity and reliability of every transaction.