tfpdev

Where moneygoes missing.

Every way a payment system loses money, as a game you can break and an article that shows the real fix.

Visitors have attacked the naive balance88×
and walked out with money that never existed$20,494.00
  1. 01ConcurrencyLive

    Double-Spend

    You are the attacker. One $100 balance, up to 200 parallel debits, five defences to break. Three of them pay you. Two do not.

    88
    Attacks
    $20,494.00
    Extracted from naive
    $0.00
    Extracted from defended
    Open
  2. 02ConcurrencyLive

    Idempotency

    A client retries one charge twenty times at once. No key: twenty charges. A key checked in code: still several. A key enforced by the database: one.

    47
    Storms
    806
    Duplicate charges refused
    Open
  3. 03DeliveryLive

    Webhooks

    Your own inbox with a signed endpoint. Replay an event five times in parallel, deliver captured before authorized, send a bad signature. Watch the handler stay correct.

    219
    Deliveries
    122
    Duplicates blocked
    Open
  4. 04StateLive

    State Machine

    A payment with five states. The unguarded version lets you refund a payment twice and capture a voided one. The guarded version has a transition table and a version column.

    291
    Transitions
    149
    Illegal transitions blocked
    Open
  5. 05StateLive

    Ledger

    Balances stored as numbers drift the first time a process dies between two updates. A double-entry ledger cannot drift: every transaction sums to zero or does not exist.

    393
    Transactions
    $625.00
    Drift refused
    Open
  6. 06ArithmeticLive

    Money Math

    Floats, splits and minor units. Divide $100 by three and get the cent back. Runs in your browser, nothing to store.

    Open