Comparisons of UTXO and Account Model
Blockchain

UTXO and Account Model

There are two main methods that the blockchain uses in order to store ledger information. There is the UTXO model which was the original model and used in Bitcoin. Then there is the account model which is used in Ethereum. In this talk, we will be comparing the two models.

The UTXO model is referred to as the cash model. In our model we can see Jane receives $100 from Bob and $50 from Tom, because UTXO specify the resulting state exactly all inputs must become outputs. And the resulting coin locations are embedded in the transaction itself. So Jane then sends 25 dollars to Johns Wallet address and then sends herself $25 to her hardware wallet. This is similar to cash because just like when you hand over a $50 and $20 note for a $60 purchase you receive a new $10 as change from the purchase. Each input and output have their own address this is one way in which UTXO attempts to handle privacy.

In the Account model this is referred to as the bank model, just like a bank the account model holds a balance for each user. Because account models have a balance it is the same as when you purchase goods with your bank account your balance is updated. Jane has a balance of $150 when she sends $25 to John her account is reduced by $25 and Johns account is increased by $25. In this model there is one address used for Janes account and one used for johns account similar to having a bank account number the addresses remain the same. So unlike in the UTXO model where a new address is used each time in the account model this does not happen the account address remains the same.

Looking at the UTXO and how it handles state, the state is stored as a list of the unspent transaction output. we can see that two rows are added, and two rows are deleted. Either you are able to remove the rows and the transaction happens or they have already been removed and the transaction fails. The order on the ledger does not change and it is simply added. A big advantage of this model is that once the consensus on the blockchain is performed the UTXO ordering is deterministic and therefore transactions can be processed in parallel making it faster and more scalable.

If we now look at the state change for the account model, instead of adding and removing the rows it is updating them. It then updates those rows in an agreed upon order making it harder to process transactions in parallel. The account model is not deterministic, and you may or may not be able to update the state depending on the order the transactions are processed.

As mentioned in the beginning UTXO was the original model introduced by Bitcoin, so where does the account model come into play. Well the answer is the use of Smart Contracts.

In the UTXO model storing a Smart Contract script becomes difficult and near impossible as we remember from before that we can not update UTXO states they are stored in a list so we can only add and delete. So when we are storing a Smart Contract Script with the UTXO it gets removed as UTXO’s can only be spent once. This would mean that if you were using the UTXO model for Smart contracts every time you interact with the Smart Contract Script you would need to repost it otherwise no one else could use it. This means that only one person can interact with the smart contract per time which in many ways defeats the purpose of a smart contract if we think of applications such as DeFi where many people are interacting.

In the account model we can see that it is easier for smart contracts to work with due to the way the state is stored by account address and updated. This means that you can send a smart contract to a specific address and it can remain there for other people to interact with as the state is simply updated. Unlike in UTXO the smart contract can be used by multiple people at the same address, suiting the purpose of a smart contract.

If we take a look at both model’s side by side we can see that the key difference between them is how they perform transactions. In UTXO each transaction is a unique address and is only performed once then destroyed. In the account model, each transaction is given a nonce transaction number per account and therefore they are unique only to that account. Due to them not being unique though we have also reduced the privacy that is provided by the UTXO model using unique addresses in each transaction no matter who is sending it. This comes down to the fact that UTXO model transactions specify the resulting state exactly as transactions are stored as a list of unspent transaction outputs with a quantity and criteria for spending. Whereas transactions in the account model rely on existing state and are therefore known as stateful. As with everything in life there are advantages and disadvantages to each model. UTXO can be more private and less susceptible to pruning and could be considered more scalable due to the parallel processing. However, Account models are simpler to work with and allow for the use of smart contracts and also considered by some to be more user-friendly (UX) as in the UTXO model wallets or the concept of accounts are not provided at the layer one level.