Wallet Ledger
A composite data structure for marketplaces that segregates the high-performance view layer (cache) from the immutable source of truth (SQL).
Key Details
- A wallet ledger tracks stored value, available balance, pending transactions, and holds for each user or entity in a marketplace
- Segregates the hot path (real-time balance checks, transaction authorization) from the cold path (reconciliation, reporting, audit) for performance
- In marketplace contexts, manages creator/seller balances, platform fees, escrow holds, and withdrawal eligibility simultaneously
- Must handle concurrent operations safely — race conditions in balance updates can lead to negative balances or double-spend scenarios
- Typically backed by pooled funds in a master bank account, with the wallet ledger tracking each participant proportional entitlement