One of the importance of money is transferability. In Blockchain, transactions occur to change the state of nodes on the network. For instance, if Alice owns 10 BTC and Bob owns 4 BTC, Alice can sign a transaction to send 5 BTC to Bob. The resulting transaction would update the state of BTC accrued to Alice to 5 BTC while Bob’s to 9 BTC.
There are two major types of recording keeping available in today’s Blockchain network. Blockchain at its core is simply a giant shared ledger. These models define how the state of nodes on the network is being kept.
There’s more to the concept when you start to consider how the general state of the network is managed. This article tries to explain these concepts as simply as possible.
What is the UTXO Model
UTXO stands for Unspent Transaction Output. It is a model used by Bitcoin. In this model, you need an input which references every unspent transaction and an output which references the address you are sending to.
It can be compared to cash, if Alice has a $100 note, it can be said that Alice has a UTXO of $100. If she has a couple of smaller notes making up the balance of $100, those smaller notes are individual UTXOs making up the total balance. The UTXO keeps track of the notes rather than the balance available to the user.
If Alice wants to send $70 to Bob, the smaller note she has that makes up the $100 would act as the input and new notes (UTXO) making up $70 and $30 is paid to Alice and Bob respectively.
Let’s consider the diagram below as an example:
Alice owns two unspent transaction outputs of $50 each, if Alice wants to send $70 to Bob, both inputs are combined into the transaction and then new outputs are generated.
This model does not keep the balance of users. Wallets have a way to find transactions linked to your address and compute the amount of unspent transaction output as the user balance.
What is the Account Model
The Account Model keeps track of balances within accounts. Ethereum uses this model.
Transactions in this model trigger an operation to reduce the balance of the sender while increasing the balance of the receiver.
This model compares closely with the traditional banking system. The bank keeps a state of your balance. If you want to withdraw some cash at an ATM, it won’t matter the kind of notes you deposited with them. You will be able to withdraw any combination of notes available to the ATM provided that your available balance is greater than the amount to be withdrawn.
Let’s consider the diagram below as an example:
Alice has a balance of $100 making up her account irrespective of the notes deposited by her. She sent $70 to Bob which reduced her balance by $70 and increase Bob’s balance in turn.
Conclusion
We have seen the basic difference between UTXO and the Account-based model. Account-based model is a simple concept compared to the UTXO model but each model offers its pros and cons which can be considered when designing a blockchain network.
To learn more, I recommend going through this resource and trying to create a mock of this concept using any programming language you are comfortable with.