WikiTheory and comparisonAccount-Based vs eUTXO

The main divergence: Account-Based vs. eUTXO

1. The Account-Based Model Polkadot (same as Ethereum)

How It Works:

  • Think of a centralized bank ledger where everyone shares the same record.
  • Every account’s balance is stored in a global database visible to the network.
  • Transactions update balances directly in this shared ledger.
Global Ledger:
- Alice: 100 DOT
- Bob: 50 DOT
 
Transaction: Alice sends 20 DOT to Bob
 Global Ledger updates to:
 - Alice: 80 DOT
 - Bob: 70 DOT

Key Features:

  • Centralized/Global State: Like a bank, everyone trusts the same ledger.
  • Mutable Balances: Balances are overwritten (no record of transaction history).
  • Sequential Updates: If Alice and Bob both send funds simultaneously, transactions queue up.

Trade-Offs:

  • Simplicity: Easy to track balances (just check the ledger).
  • Bottlenecks: High demand for popular accounts (e.g., a DEX pool) slows the network.

2. The eUTXO Model Cardano (inspired by Bitcoin)

How It Works:

  • Think of physical cash in your wallet. You own specific “notes” (UTXOs), and spending them requires breaking them into smaller denominations.
  • Each UTXO is like a unique bill with a value and ownership tag.
  • Transactions consume UTXOs and create new ones, like handing over cash and receiving change.
Alice’s Wallet:
 - UTXO 1: 50 ADA (Wallet A)
 - UTXO 2: 50 ADA (Wallet B)
 
Transaction: Alice sends 70 ADA to Bob
 Consumes UTXO 1 (50 ADA) + UTXO 2 (50 ADA)
 Creates:
 - New UTXO for Bob: 70 ADA (Wallet C) 
 - New UTXO for Alice (change): 30 ADA (Wallet A or D)

Key Features:

  • Decentralized Ownership: UTXOs are like cash in your wallet—no global ledger tracks them.
  • Immutable History: UTXOs are spent, not modified, creating an auditable trail.
  • Parallel Processing: Different wallets (UTXOs) can transact simultaneously.

Trade-Offs:

  • Scalability: No waiting in line—transactions using separate UTXOs run in parallel.
  • Complexity: Developers must manually track and combine UTXOs (like managing cash).

Key Differences Simplified

AspectAccount Model (Polkadot)eUTXO Model (Cardano)
State ManagementSingle global ledger (like a bank).UTXOs are owned locally (like cash).
Transaction FlowSequential updates (wait your turn).Parallel processing (no waiting).
SecurityRisk of reentrancy (shared state).No reentrancy (deterministic validation).
FlexibilityEasy to code, hard to scale.Hard to code, easy to scale.

Why This Matters for Developers

  • Account Model:
    • Best for: Apps needing shared state (e.g., a lending protocol where users interact with a central pool).
    • Watch out for: Race conditions (e.g., two users trying to borrow the last token).
  • eUTXO Model:
    • Best for: High-throughput apps (e.g., NFT mints, batch payments) or atomic swaps.
    • Watch out for: “UTXO management hell” (e.g., splitting/merging UTXOs for complex logic).

Final Analogy

  • Polkadot’s Account Model:
    • Like a shared Excel sheet—everyone edits the same file, but you wait your turn to avoid errors.
  • Cardano’s eUTXO Model:
    • Like passing physical cash—no central ledger, but you need to organize your wallet(s) carefully.