UTXO vs Account Models
Tracking user balances in decentralized networks relies on two models:
- Account Model (Ethereum): Tracks balances like a bank ledger (simple and intuitive).
- UTXO Model (Bitcoin): Tracks specific unspent outputs from transactions (complex but powerful)
1. Account Model (Like Your Bank Account)
Think of this like a simple bank statement:
Example:
- Alice has 100 ETH
- Alice sends 30 ETH to Bob
- Result: Alice now has 70 ETH, Bob has 30 ETH
Pros | Cons |
---|---|
Simple to understand | Less private |
Works well with smart contracts | Can be vulnerable to replay attacks |
2. UTXO Model (Bitcoin's Approach)
Think of UTXOs like individual bills in your wallet:
Example: Bob has three "bills" (UTXOs):
- One 5 BTC UTXO
- One 3 BTC UTXO
- One 2 BTC UTXO
To spend 7 BTC, Bob has multiple options:
- Use the 5 BTC and 3 BTC UTXOs and receive 1 BTC back as 'change' (a new UTXO).
- Alternatively, use the 5 BTC and 2 BTC UTXOs without needing any change.
Key Points:
- UTXOs can only be spent once (like using a paper bill)
- Each transaction creates new UTXOs
- Your balance is the sum of all your unspent UTXOs
Pros | Cons |
---|---|
Better privacy | More complex to understand |
Prevents double-spending | Harder for complex applications |
Parallel transaction processing | Requires UTXO management |
3. Comparing Models
Feature | Account Model | UTXO Model |
---|---|---|
Balances | Total balance (e.g., 10 ETH) | Collection of UTXOs (e.g., 2, 3, 5 BTC) |
Ease of Use | Intuitive | Complex |
Privacy | Limited | High if new addresses used |
Design | Flexible for smart contracts | Stateless, simple transfers |