Original English article: https://www.nervos.org/knowledge-base/utxo_model_explained

The UTXO (Unspent Transaction Output) model plays a vital role in Bitcoin and other UTXO-based cryptocurrencies. It accurately tracks changes in token ownership and supports the security and integrity of the blockchain network.

How do transactions in the UTXO model work?

In a UTXO-based blockchain, the state of the ledger is represented by a set of UTXOs, which are indivisible units of cryptocurrency that can be spent in future transactions. Each UTXO is associated with a specific owner's public key, and these UTXOs can only be spent by providing a valid signature corresponding to that public key.

The blockchain based on the UTXO model consists of two parts: input and output. Input refers to the UTXO being spent, while output refers to the "token" that has not been spent. A transaction consumes one or more existing UTXOs as input and generates new UTXOs as output. The new UTXOs will be added to the collection of other UTXOs. This process maintains the conservation of value within the system.

The UTXO model is critical to maintaining the security and integrity of the blockchain network. This model effectively prevents double-spending attacks by ensuring that each UTXO can only be spent once. Nodes in the network maintain a collection of UTXOs and verify transactions by checking whether the referenced UTXO exists and has not been spent before. If the transaction is valid, the node adds it to their memory pool. The memory pool is a pool of unconfirmed transactions waiting to be packaged into a block.

When new blocks are mined and added to the blockchain, nodes update the UTXO collection they maintain by removing the spent inputs and adding the newly created UTXOs. In the event of a blockchain reorganization, nodes must also update their UTXO collection to reflect the changes brought about by the new chain.

Comparison with other models

Although the UTXO model is widely used in cryptocurrencies such as Bitcoin and Litecoin, there are other transaction models on the market. For example, Ethereum uses an account model, which operates more like a traditional bank account. In the account model, the state of the ledger is represented by account balances rather than UTXOs. After a transaction occurs, the sender and receiver's account balances are directly updated, and no new outputs are created.

The UTXO and account models each have their own advantages and disadvantages. The UTXO model provides greater privacy and scalability, while the account model is simpler and easier to use. The choice of transaction model depends on the individual needs and goals of the blockchain project.

Advantages and Disadvantages of the UTXO Model

As mentioned earlier, the advantages of the UTXO model include greater scalability and better privacy compared to the account model.

Specifically, UTXO-based blockchains are more scalable because they can process transactions in parallel, i.e. miners can independently verify each transaction and process different transactions at the same time. This is in contrast to account-based blockchains, which can only process transactions in a linear manner, sequentially or one after another, which often causes network congestion when there is a large amount of user demand.

In terms of privacy, the UTXO model is superior to the account model because it abstracts the concept of on-chain identity. Specifically, in a UTXO-based blockchain, users are encouraged to create new addresses for each transaction they transfer or receive, making it more difficult for third parties to link transactions to users' identities. In an account-based blockchain, users typically use a public address or account to handle all their transactions, which makes it easier to link their on-chain accounts to their real-life identities.

The most obvious disadvantage of the UTXO model is the lack of programmability or support for smart contracts. That is, the standard UTXO model used by Bitcoin only supports simple cryptocurrency transactions and cannot be used to build decentralized applications. However, there are some blockchain projects, such as Nervos CKB and Cardano, which have implemented their own generalized UTXO models - the Cell model and the EUTXO (Extended UTXO) model, which are the same as the account-based blockchain, or even more flexible and programmable. #CKB #Nervos