UTXO and Account-Based Blockchains

UTXO and Account-based Blockchains

There are two types of record-keeping models in today’s blockchain networks, the UTXO (Unspent Transaction Output) Model and the Account-Based Model.

UTXO (Unspent Transaction Output) Chains

This is the original form of a blockchain used by Bitcoin and many Bitcoin derivatives such as Bitcoin Cash, Zcash, Litecoin, Doge, Dash, and more. In a UTXO based ledger, there are no accounts or wallets* at the protocol layer. Instead, coins are stored as a list of unspent transaction outputs or UTXOs. Each UTXO has a quantity and criteria for spending it. Transactions are created by consuming existing UTXOs and producing new UTXOs in their place. UTXO represents the output of a transaction received by a user and the balance of an address is the sum of unspent transactions(UTXOs).

How do UTXOs work?

The short answer is like cash.

Let’s take an example where you have $100 in cash. There are number of different variations you might have:

  • Five $20 bills
  • Two $50 bills
  • Ten $10 bills
  • One $50 bill and five $10 bills
  • and so on…

Despite having different combinations you always have $100 exactly. This is how UTXOs work, when you see a balance of 1 Bitcoin in a crypto address, this can be combination of two UTXOs of 0.5 Bitcoin etc. from previous transactions. When we want to Bitcoin, we use one or more existing UTXOs, enough to cover the cost and maybe receive some change back (new UTXO). The concept of change in UTXOs is explained further.

“Change” in UTXOs

Just like banknotes, UTXOs can not be divided. Take an example where you want to buy a coffee and the coffee costs $3.75. In your wallet, you have a $5 bill and you must overpay for the coffee, but then $1.25 is returned to you as change.
Just like banknotes, you can’t spend part of a UTXO. If you got UTXO of 5 Bitcoin in your address and you need to send someone 3.75 Bitcoin you need again to overpay and 5 Bitcoin is sent as input to the transaction. You will receive 1.25 Bitcoin as a new UTXO or change in an address owned by you.

To understand better UTXO based model you need to know the differences between the banknotes and UTXOs.

In the example with the coffee, you will get back $1.25 as change, which can be five quarters or one $1 bill and one quarter etc., while with UTXO, change can come in any amount.

Transactions on the blockchain require transaction fees, which is used to reward the miners, and transaction fees would be deducted by the change you receive.

Account-Based Blockchains

Blockchains that are using the Account-based model are Ethereum, EOS, Tron, Ethereum classic etc.

How do Account-based Blockchains work?

Under the account-based model, unlike with UTXOs, balances can be partially spent. For example, if you have 100 ETH, you can send someone 37.5 ETH directly from your account, and the result of this transaction is that you now have 62.5 ETH and the other person has 37.5 ETH. You don’t have to send the full 100 ETH and then receive 62.5 ETH in change, as you would on a UTXO chain.

Account-based blockchains sometimes create confusion among Crypto APIs users, because the result of a transaction depends on the input state. Care must be taken when executing transactions in parallel. Generally, transactions affecting the same account will need to be executed one after another

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.

*Wallets can be created on UTXO based blockchains like Bitcoin using Crypto APIs, but those are not on protocol level.