In most of the blockchain networks, two types of accounting models are popular: UTXO (unspent transaction output model), and account-based model. The UTXO model is used by Bitcoin, Litecoin, Monero, whereas Ethereum uses the account-based model. In this article, we will provide a basic understanding of how these two models work and how they differ, as well as pros and cons.
In Bitcoin, each transaction spends the output of previous transactions and generates new output that may be spent by transactions in the future. All unspent transactions are stored in each fully synchronized node, and therefore this model is called UTXO. The user’s wallet keeps track of the list of unspent transactions associated with all addresses belonging to the user, and the balance of the wallet is calculated as the sum of these unspent transactions. In this regard UTXO blockchains are stateless.
Let’s take a look at a simplified example of how the UTXO model works in Bitcoin transactions:
1. Alice has 10 bitcoins and wants to give Bob 2 bitcoin. Alice’s wallet first unlocks her UTXO of 10 bitcoins and uses this whole 10 bitcoins as input to the transaction. This transaction sends 2 bitcoin to Bob’s address and the remainder of 8 bitcoins is sent back to Alice in the form of a new UTXO to a newly-created address.
2. Let’s imagine prior to the transaction Bob had 3 bitcoins. Bob’s wallet now keeps track of two UTXOs: one from before and another from the transaction made by Alice.
The account-based model, on the other hand, keeps track of the balance of each account as a global state. The balance of an account is checked to make sure it is larger than or equal to the spending transaction amount.
Here is a simplified example of how this model works in Ethereum:
1. Alice has 10 ethers and wants to give Bob 3 ether. The system will first deduct 3 ether from Alice’s account, so Alice now has 7 ethers.
2. The system then increases Bob’s account by 3 ether. The system knows that Bob already has 5 ethers, therefore Bob’s balance is increased to 8 ethers.
Both models achieve the same goal of keeping track of account balances in a consensus system.
Advantages and drawbacks
The benefits of the UTXO model:
- Scalability — Since it is possible to process multiple UTXOs at the same time, it enables parallel transactions and encourages scalability innovation.
- Privacy — Even Bitcoin is not a completely anonymous system, but UTXO provides a higher level of privacy, as long as the users use new addresses for each transaction. If there is a need for enhanced privacy, more complex schemes, such as ring signatures, can be considered.
The benefits of the Account-Based model:
- Simplicity — Ethereum opted for a more intuitive model for the benefit of developers of complex smart contracts, especially those that require state information or involve multiple parties. An example is a smart contract that keeps track of states to perform different tasks based on them. UTXO’s stateless model would force transactions to include state information, and this unnecessarily complicates the design of the contracts.
- Efficiency — In addition to simplicity, the Account-Based model is more efficient, as each transaction only needs to validate that the sending account has enough balance to pay for the transaction.
The disadvantages of the UTXO model:
- UI / UX is pretty complicated here. Users tend to think about accounts when they conceptualize their money. Since Bitcoin does not have an account concept, it is the wallet provider that can manage the potential set of addresses and summarize the corresponding balances. To maintain confidentiality, you may need to run a local node.
- Smart contract options are limited in the UTXO model due to a stateless nature. Each UTXO has expenditure criteria that dictate the terms. This may require a signature from several parties, but there is little opportunity to refer to external states such as oracles.
The disadvantages of the account-based model:
- Since the result of the transaction depends on the input state, care must be taken when executing transactions in parallel. Typically, transactions affecting the same account must be performed one after another.
- Account models encourage reuse of addresses, which is generally detrimental to privacy because the account itself binds transactions with one owner.
In cryptocurrency platforms, there is a diverse set of design concepts and technical mechanisms that are included in the platform and can function as a viable, safe, and easy-to-use system.
The transaction models used by such platforms use cryptography to verify ownership of tokens on the network. The UTXO scheme works great for Bitcoin, while the account-based model used by Ethereum is focused on supporting its more complex applications and contract needs. Drop us a line to get started with Bitcoin and Ethereum nodes within 1 business day.