A familiar problem

You've seen this before

You scan a QR code at a shop and pay Rs 500 on UPI. The screen says "Processing..." and then freezes. Your bank says Rs 500 was deducted. The shopkeeper says nothing arrived.

Or you book a train ticket online. The payment is taken, but the ticket never shows up.

Notice the shape: a payment is not one step, but a few steps that only make sense together. Money leaving without arriving is worse than the payment never starting. Next, you will be the bank that has to fix it.

How to play

You are the bank

Your goal: every payment must either fully go through or not happen at all. No money may be lost or created.

  1. Every payment has 3 steps: check the customer has enough, take Rs 500 from the customer, add Rs 500 to the shopkeeper.
  2. The steps are only in flight at first. The bank's ledger (the real balances) changes only when you press Finalise payment. Reverse payment cancels everything in flight.
  3. Things go wrong: the shop's bank stops responding, the system crashes, two payments arrive at once. You decide what to do.
  4. Check the ledger: the total money in the system must never change. First you watch what can go wrong, then you solve 3 challenges.

Run the payment desk

Challenges

Reflect

Think back on what just happened

No right answers here. Just sit with these for a moment.

The reveal

You were protecting a transaction

Each payment was a transaction: a group of steps a database treats as one single piece of work. The rule that protects it is atomicity, which means all or nothing. Either every step happens, or none of them does.

While the steps are in flight, they are only a draft. Pressing Finalise is a commit, which makes everything permanent at once. Reversing, or losing the draft in a crash, is a rollback, as if the payment never started. Banks, ticket sites and shopping apps all work this way.

Atomicity is one of four promises called ACID. The others showed up in your challenges too: consistency (total money never changes and no balance goes below zero), isolation (one payment at a time from the same wallet) and durability (a finalised payment survives a crash).

Transaction = all steps happen, or none doCommit finalises the whole payment. Rollback cancels all of it.
Start payment
→
Check, take money, add money (in flight)
→
All worked: COMMIT, final in the ledger
Failure: ROLLBACK, as if it never started
The whole paymentTransaction
Steps in flightUncommitted changes
Finalise paymentCommit
Reverse, or a crash before finalisingRollback
Total money never changesConsistency
One payment at a time from one walletIsolation
Finalised payment survives a crashDurability
💸
Rs 500 vanishedSaving each step on its own can leave a payment half done when something fails.
✅
Never half doneGrouping the steps means a failure leaves the ledger exactly as it was, or fully updated.
Checkpoint

Test what you learned

Think through each scenario and apply what you learned.

Home

Go back?

Going back will lose your progress on this page. Are you sure?

All four rounds fixed!