Sub topic 3
Account Model vs UTXO Model
This chapter assumes you know what a private key and an address are, and that a blockchain is a shared ledger. It also assumes you have seen a wallet show a balance. Here you learn how two designs record "who owns what," and why that changes how sending works.
Two ways to record ownership
A blockchain must answer one question for every payment: how does the network know the sender has the funds? There are two common answers.
- The account model keeps a balance for each address, like a bank ledger. Ethereum and other EVM chains use it, as do Solana and many others.
- The UTXO model keeps a set of unspent outputs. Bitcoin, Litecoin and Dogecoin use it. UTXO stands for unspent transaction output.
Both designs let you send value and prove ownership with a key. They differ in what the network stores and what a transaction contains.
The account model
In the account model, the network state is a table that maps each address to its data. For an Ethereum-style chain, that data includes a balance and a nonce (a counter of transactions the account has sent).
A transfer says: "Take 0.5 from account A and add it to account B." The network checks that A's balance covers the amount plus the fee. It then subtracts from A and adds to B.
{
"0xAAA...": { "balance": "1.50", "nonce": 7 },
"0xBBB...": { "balance": "0.20", "nonce": 0 }
}After A sends 0.5 to B (ignoring fees), the state becomes:
{
"0xAAA...": { "balance": "1.00", "nonce": 8 },
"0xBBB...": { "balance": "0.70", "nonce": 0 }
}Properties of this design:
- Your balance is a single number you can read directly. The first code example in this tutorial calls
provider.getBalance(address)and gets that number. - Transactions are simple. One sender, one recipient, one amount.
- Order matters. Because every transaction changes a shared balance, the network needs the nonce to sequence them and to stop a signed transaction from being replayed. The nonces chapter covers this.
- Smart contracts fit naturally, because a contract can hold its own balance and storage under its own address.
The UTXO model
In the UTXO model there are no balances in the ledger. The ledger holds many discrete outputs. Each output has an amount and a locking condition, usually "only the owner of this key can spend me."
A transaction consumes one or more existing outputs, called inputs, and creates new outputs. An output can be spent only once, entirely. Your wallet's balance is the sum of all unspent outputs it can unlock. The wallet computes that sum. The ledger does not store it.
Think of cash. If you hold a 5 note and a 2 note, you do not have "7" written anywhere. You have two objects that add up to 7.
Worked example: paying with change
Alice controls two outputs: one worth 0.6 and one worth 0.3. She wants to pay Bob 0.5 and the fee is 0.001.
- The wallet selects the 0.6 output as the input. This is called coin selection.
- The transaction creates an output of 0.5 locked to Bob.
- It creates a second output of 0.099 locked back to Alice. This is the change output, sent to an address Alice controls.
- The remaining 0.001 is the fee: inputs (0.6) minus outputs (0.5 + 0.099).
The 0.6 output is now spent and can never be used again. Alice's 0.3 output is untouched.
{
"inputs": [
{ "spends": "txid_1:output_0", "amount": 0.6 }
],
"outputs": [
{ "to": "Bob", "amount": 0.5 },
{ "to": "Alice (change)", "amount": 0.099 }
],
"fee": 0.001
}The fee is not a field you set directly. It is whatever is left after the outputs are subtracted from the inputs. This leads to a classic UTXO mistake: if you forget the change output, the whole difference becomes fee. Reputable wallets add the change output for you.
Side-by-side comparison
| Aspect | Account model | UTXO model |
|---|---|---|
| What the ledger stores | A balance and nonce per address | A set of unspent outputs |
| Where "balance" comes from | Read directly from state | Sum of outputs your keys can spend |
| A transaction | Debit one account, credit another | Consume whole outputs, create new ones |
| Change | None. The balance just decreases | A change output is usually required |
| Replay protection | Nonce, plus chain ID | Each output can be spent only once |
| Ordering of your payments | Strict, by nonce | Independent if they use different outputs |
| Smart contracts | Native, with contract accounts | Limited and more explicit in most chains |
| Privacy habits | One address is easy to reuse and trace | Wallets often use a fresh address per output |
What this means in practice
Addresses behave differently
On an account chain you normally use one address for years. Every incoming payment adds to the same balance.
On a UTXO chain, wallets typically derive a new address for each receive and each change output from one seed. Your wallet shows one balance, but your funds are spread across many addresses. Reusing an address works but links your payments together and is discouraged for privacy.
Fees work differently
- Account chains charge per unit of computation, as you will see in the gas chapter. The fee depends on what the transaction does.
- UTXO chains charge by transaction size in bytes, because the fee must pay for space in the block. A transaction that spends ten small outputs is larger, and so more expensive, than one that spends a single large output.
Parallel sends and stuck sends
With the account model, your second transaction waits for the first, because nonce 8 cannot run before nonce 7. One stuck transaction can block everything behind it.
With UTXOs, two transactions that spend different outputs do not depend on each other. If a transaction spends an output that another pending transaction already spends, the network treats them as conflicting and accepts only one. Chains like Bitcoin let you replace a pending transaction with a higher-fee version (replace-by-fee), or spend its change output with a child transaction that pays enough to pull both along (child pays for parent).
Dust and consolidation
Small outputs can cost more in fees to spend than they are worth. These are called dust. A wallet that receives many tiny payments may later need to combine them into one larger output, which is a consolidation transaction. Account chains have no equivalent problem.
Common errors and gotchas
- Assuming a UTXO wallet balance lives at one address. Checking a single address on an explorer shows only part of your funds. Wallets use an extended public key to track all derived addresses.
- Expecting the sent amount plus fee to equal the visible output. On a UTXO chain, the transaction you broadcast may show a large "input" and a change output back to you. That is normal.
- Sending to a change address by hand and losing track of it. Let the wallet manage change.
- Treating "UTXO" and "account" as chain-wide labels for everything you touch. Some chains blend ideas. Cardano uses an extended UTXO model, and Ethereum rollups still use accounts. Check the chain's documentation.
- Mixing mental models in code. With ethers,
getBalanceanswers instantly. For Bitcoin you must list unspent outputs through a node or indexer and sum them yourself.
Why this matters for the rest of the tutorial
The remaining chapters mostly use account-style examples, because the code examples use an EVM chain. The concepts that carry over to both models are the same: a key authorizes spending, fees pay for block space, a transaction is final only after enough confirmations, and a mistaken transfer cannot be undone.
The parts that change are the ones you just saw: how you read a balance, how change appears, and what blocks your next transaction.
Exercise
A wallet holds three unspent outputs on a UTXO chain: 0.4, 0.4 and 0.1. You send 0.5 to a friend with a 0.002 fee. Describe one valid transaction, including its inputs, outputs and change. Then say how the same payment would change the sender's state on an account chain.
Show answer
One valid choice: spend the two 0.4 outputs (total 0.8) as inputs. Create an output of 0.5 to the friend and a change output of 0.298 back to yourself (0.8 - 0.5 - 0.002). The 0.002 left over is the fee. The 0.1 output stays unspent. A choice such as 0.4 + 0.1 would be too small (0.5 total cannot also cover the fee), so it is invalid. On an account chain, the sender's balance simply drops by 0.502 (amount plus fee) and the nonce rises by one. The recipient's balance rises by 0.5. No change output exists.
Exercise
You send two payments in a row from the same Ethereum-style account, and the first is stuck with a very low fee. What happens to the second payment, and why would a UTXO wallet behave differently if the two payments spend different outputs?
Show answer
The second payment stays pending behind the first, because it has the next nonce and the network will not process nonce n+1 before nonce n. In a UTXO wallet, two transactions that spend different outputs are independent, so the second can be confirmed even if the first is stuck. They would only block each other if they tried to spend the same output.