Offline transit fare authorization
Your task
Design a transit-fare wallet where riders tap at gates that are frequently offline (subway, no connectivity), so a tap must be authorized at the gate in <300ms WITHOUT a round trip to the server, then settled later when the gate reconnects. ~50M cards, peak ~20,000 taps/sec across gates. The hard problem: a rider with a near-zero balance could tap at multiple offline gates and overspend (double-spend). How do you authorize offline yet keep the wallet balance correct and bound the loss?
It covers
- Offline spend
- Double spend
- Reconciliation