Sub topic 3
Account Model vs UTXO Model
Assume you understand what a blockchain is, what a wallet does, and what a blockchain address looks like. This chapter focuses on how different blockchains represent ownership and update balances.
A blockchain can track value mainly in two ways:
- The account model stores a balance for each account. Ethereum uses this model.
- The UTXO model stores separate spendable outputs. Bitcoin uses this model. UTXO means “unspent transaction output.”
Both models can send and receive value, but they create different transaction shapes and different troubleshooting steps.
The account model
In the account model, the blockchain keeps state for an address. State is the information currently recorded by the network, including the account's balance and transaction nonce.
A transaction changes that state. If Alice sends 0.4 ETH to Bob, the network subtracts 0.4 ETH plus the fee from Alice's account and adds 0.4 ETH to Bob's account. The transaction does not need to name individual coins that Alice received earlier.
An externally owned account, or EOA, is controlled by a private key. A contract account is controlled by code. Both can have balances and addresses, although only an EOA signs ordinary transactions directly.
The nonce is a sequential number for transactions sent by an EOA. It prevents the same signed transaction from being processed twice and helps the network order transactions from that account.
The UTXO model
In the UTXO model, the blockchain does not store one simple spendable balance for an address. Instead, it stores outputs created by earlier transactions. Each output contains an amount and a locking condition that says who may spend it.
A wallet selects one or more UTXOs as transaction inputs. The transaction consumes those inputs completely and creates new outputs. One output may go to the recipient. Another usually goes back to the sender as change.
For example, suppose a wallet owns UTXOs worth 0.3 BTC and 0.8 BTC. To send 0.5 BTC, it may consume both outputs, create a 0.5 BTC recipient output, and create a change output of about 0.6 BTC after subtracting the fee.
Key differences
| Feature | Account model | UTXO model |
|---|---|---|
| Value representation | One balance per account | Separate spendable outputs |
| Transaction ordering | Account nonce | Inputs must be unspent |
| Sender change | Usually no change address | Usually a change output |
| Fee impact | Gas and fee parameters | Fee depends heavily on transaction size |
| Common wallet task | Track nonce and network state | Select and manage UTXOs |
A displayed wallet balance can hide these details. In a UTXO wallet, the balance is the sum of available outputs. Some outputs may be unconfirmed, locked, reserved, or unavailable because another transaction is spending them.
Common errors
Do not assume that every blockchain uses the same model. Sending a token on an account-model chain still changes a smart contract's ledger, and the sender still needs the chain's native coin to pay gas.
Do not treat a UTXO as a partial balance that can be edited. It must be spent in full. The wallet creates change if the selected inputs exceed the payment and fee.
Also, do not assume that a successful balance display proves that a payment is final. In either model, check the transaction status, recipient address, network, and confirmation state.
Exercise
A Bitcoin wallet has one UTXO worth 1.0 BTC. It sends 0.2 BTC and pays a 0.001 BTC fee. What should the transaction create if the wallet uses that UTXO?
Show answer
It should create a 0.2 BTC output for the recipient and a 0.799 BTC change output for the sender.