Wallet Ledger

A USD wallet on a double-entry ledger. Every action below is a real HTTP call to this API, backed by Postgres.

Reconciliation: …

Wallets

Each wallet is three accounts: pending, available, held.

How it works

Money is an integer number of cents. Every movement is a journal transaction whose lines sum to 0. Entries are append-only, and a balance can never go negative: it is checked while the row is locked.

Every POST carries an Idempotency-Key. Sending the same key again returns the stored response and moves no money. Try Replay in the HTTP log.

Create or select a wallet to start.

Stress test

Creates 3 fresh wallets with $1,000 each, then fires transfers in both directions (many larger than the balance), holds that are captured or released, and duplicate requests sent in parallel with the same key. Afterwards it checks that no money was created or lost.

Browsers open about 6 connections per site over HTTP/1.1 (e.g. on localhost), so more than 6 concurrent requests queue in the browser; HTTP/2 hosts allow more.

HTTP log

Newest first. Click a row for the request and response. Replay re-sends a POST with the same Idempotency-Key.