Double-Entry Ledger Service for Marketplace Wallets and Payouts
A double-entry ledger service for marketplaces and wallet apps that records every rupee or dollar as balanced entries, handles holds, refunds and seller payouts, and proves its balances are correct. A fintech final year project in systems design, idempotency and concurrency, modelled on how Stripe and Uber track money movement.
Advanced
Needs a team, real planning, and a supervisor who knows the area.2 semesters · 3 students
7 to ship
3 optional extrasSuggested stack
What you should ship
- A ledger API with accounts, balanced multi-leg transactions, pending holds (authorise, capture, void) and reversals, where an unbalanced transaction is rejected by the service and by a database constraint.
- Idempotency keys on every write: replaying the same request any number of times produces exactly one transaction, proven by an automated retry-storm test.
- Concurrency control that prevents overdrafts on non-negative accounts under 200 parallel writers, with the chosen strategy (row locks, optimistic versions or single-writer partitions) documented and measured.
- A marketplace demo flow: buyer pays, platform fee and seller share are split, refund reverses the split, and a weekly payout batch moves seller balances to a payout account.
- A balance-as-of query that returns any account balance at any past timestamp, plus a nightly job that checks the sum of all accounts is zero and alerts on drift.
- A property-based test suite that generates random sequences of operations and asserts ledger invariants after every step.
- A load test report with throughput and p95 latency for single-account hotspots versus spread-out traffic.
If you have time left
- Multi-currency accounts with explicit FX conversion transactions and a realised gain or loss account.
- An append-only hash chain over transactions so tampering with history is detectable.
- A reconciliation importer that matches ledger payouts against a bank or wallet settlement file.
The problem with tracking money in a normal database table
Most student and startup marketplaces store money as a single balance column on a user row and run UPDATE balance = balance - 500 when something is bought. It works in the demo. It breaks the first time a payment webhook arrives twice, two checkout requests race each other, a refund lands after a payout, or an accountant asks what a seller's balance was on the last day of the quarter. At that point nobody can explain where the money went, because the system kept the current number and threw away the history.
Every serious payments company solves this the same way: a double-entry ledger, where money never appears or disappears, it only moves between accounts, and every movement is an immutable record. Stripe has written about its internal Ledger system for tracking and validating money movement, and Uber has written about LedgerStore, its immutable store for money events. Small marketplaces, wallet apps, school fee portals and ride or delivery startups in Pakistan and elsewhere need the same correctness without building a payments team first.
What already exists and the gap
- TigerBeetle is an open source database built only for double-entry accounts and transfers, very fast and heavily tested, but it is a new piece of infrastructure a small team has to run and learn.
- Modern Treasury Ledgers and Fragment offer ledgers as a hosted API, priced and designed for funded fintech companies.
- Accounting packages such as Xero or QuickBooks keep books for humans, not a real-time API that a checkout flow can call a thousand times a minute.
The gap is a small, well-tested ledger service that runs on plain PostgreSQL, which a three-person startup already knows how to operate, with the marketplace flows (holds, splits, refunds, payouts) already modelled.
What you build
A standalone ledger service with a clean API and one demo marketplace that uses it.
- Accounts have a type (asset, liability, revenue, expense), a currency and an optional non-negative rule.
- Transactions have two or more entries that must sum to zero, an idempotency key, a timestamp and metadata linking them to an order or payout.
- Holds reserve funds at checkout, then capture or void them later, the same authorise-then-capture shape card networks use.
- Queries return current balance, balance as of a timestamp, and the entry history behind a balance.
- The demo marketplace is a thin web app where a buyer pays, the platform takes a fee, the seller is credited, a refund reverses it and a payout batch runs weekly.
The technically interesting part
The hard problem is correctness under concurrency and retries. You must show three things to your evaluators. First, idempotency: the same request replayed after a timeout creates one transaction, not two, including when the retry arrives while the first attempt is still running. Second, no overdraft: two parallel captures against a seller account with 1,000 in it cannot both succeed if each needs 800. Third, invariants hold forever: the sum of all accounts is zero and every balance equals the sum of its entries.
Compare at least two concurrency strategies, for example SELECT FOR UPDATE on the account rows versus optimistic version numbers with retry, and measure how each behaves when one popular seller account becomes a hotspot. Property-based tests are your strongest evidence here: generate thousands of random operation sequences, including duplicates and failures, and check the invariants after every step.
How to evaluate it
- Correctness: zero invariant violations across at least 100,000 generated operations, with the test seed recorded so anyone can rerun it.
- Idempotency: a retry-storm test that fires each request 5 times concurrently and proves exactly one transaction per key.
- Throughput and latency: transactions per second and p95 latency for spread-out accounts versus a single hot account, under each concurrency strategy.
- Audit: reconstruct any balance at any past time and show it matches a replay of the entries.
- Usability: two developers outside the team integrate the demo checkout using only your API docs; record where they got stuck.
Suggested plan
- Weeks 1 to 3: read the Stripe and Uber ledger posts and the TigerBeetle docs, write the data model and the invariants on one page.
- Weeks 4 to 8: accounts, balanced transactions, idempotency keys and the property-based test harness.
- Weeks 9 to 12: holds, reversals, balance-as-of queries and the nightly zero-sum check.
- Semester 2, weeks 1 to 5: the demo marketplace flows and payout batches.
- Weeks 6 to 9: concurrency strategy comparison and load tests.
- Weeks 10 to 14: documentation, external developer test and the final report.
Path to a product
The first customer is a local marketplace, school fee platform or wallet startup that currently keeps balances in a single column and has already had one reconciliation scare. Sell it as an open source core with a paid hosted version or a support contract. A realistic model is a monthly fee per environment plus a setup engagement to migrate existing balances. Scale by adding reconciliation importers for common banks and wallets, which is where most operations teams spend their time.
Scope warning
Do not move real money, integrate a live payment gateway or hold customer funds: use a sandbox or simulated gateway. Do not build a general accounting package with invoices and tax. Do not add a blockchain; an append-only table with constraints gives you everything this problem needs.
Learn what you need on Sefism
- System Design roadmap : consistency, idempotency and hotspot handling are the core of this project.
- Backend cheat sheet : transactions, isolation levels and API design in one place.
- Stripe Engineering Blog : primary reading on how a payments company tracks money movement.
- PostgreSQL Documentation : row locks, constraints and isolation levels you will rely on.
- Stripe Documentation : see how a mature API models idempotency keys and authorise-then-capture.
Get help with this idea
This is a strong project for anyone aiming at backend or fintech roles, but it lives or dies on the invariants you choose to prove. If you want a second opinion on scope, stack or how to evaluate it before you pitch it to your supervisor, bring your draft proposal and we will pressure-test it together. You build it; the guidance is on the decisions.
New here? Create a free account first.
Ideas and guidance, not finished projects
These are project ideas and scoping guidance, published free for students to use as a starting point. I do not build, write, or sell final-year projects, and I do not complete coursework for anyone. Take an idea, make it yours, and build it.
Not sure this one fits you?
I help students pick an idea that matches their skills and their deadline, then scope it down until it is finishable. Guidance only, never done for you.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
Follow along
New writing, resources and project ideas land here first.