Distributed Ledger Before Blockchain: How a 1990s Ticketing System Helped Solve a Railway Fraud

One of the core advantages of blockchain, the technology behind Bitcoin, is the concept of distributed ledger. Because many copies of the audit trail exist in many places, there is no single point of failure, which makes it extremely hard to tamper with. Long before Satoshi Nakamoto introduced it in 2008, the same idea was used to audit a financial application, and it even helped solve a crime! When I first read about this a several years ago, it reminded me of my design back in the ’90s.

The Background:

It was the late 1980s and early ’90s, and life went on happily without cell phones and the internet. We were building ticketing systems for unreserved train travel, and the constraints were strict: they had to be decentralized, survive power failures, and be tamper-proof. Each booking window collected over ₹200,000 in cash during an eight-hour shift.  To put it in perspective, in those days, ₹200,000 was several years’ salary for the booking clerks and hence there was a significant incentive to break into those systems and tamper with them. With no long-distance computer networks, we relied on an RS-232C serial connection between each ticketing machine (a self-contained unit, one per window) and the station’s central accounting server (a PC). At the end of each shift, data was transferred, consolidated into station-wide reports, and sent on floppy disk to the divisional headquarters’ accounting department.

The Solution:

Each machine was a standalone Motorola 68000-based unit, for which we had written the artsbbvt2software almost from scratch:  a microkernel, device drivers, application code, global data tables, all “burnt” into an EPROM. We moved to flash memory as early as 1993. The station-specific data was stored in a separate pluggable sealed cartridge with its own EPROM and an internal rechargeable battery. The transaction data was stored both on the main system as well as the cartridge, so in case the main system went down for any reason, (Plan B) the booking clerk could plug the cartridge into another working system and continue their shift. As a further precaution (Plan C) in case the whole station lost power or is down for any reason, we designed it such that the cumulative cash collected until that point was printed in a simple codified way on top of the next (unsold) ticket. In this image (randomly picked up from Google) the code JFBA (A=0 through J=9) on the top-left indicates the cash amount of ₹9,510 collected in that shift until and including the previous ticket sold.

unreserved-train-ticketThis let clerks close their shift even if the system was down, remit the cash shown by the code, and go home. This was also how the distributed auditing aspect was built into the system. Every ticket carried the shift’s running cash total, and passengers took those tickets to stations far away, where staff collected many of them at the exit gates and stored them. The majority of the booking clerks enjoyed the benefits of a quick shift closing with one click and did not have to manually account for the card ticket stock, cutting down their shift closure from almost 30 minutes to just a minute.

The Fraud:

However,  there were some bad actors who decided to defraud the system. The western zone railway authorities noticed a significant drop in revenue at Surat railway station in 1996 (pic below) and started investigating. It was obvious that there was some fraud going suratstnon, but the railway officials were missing evidence to prove the exact amount embezzled and other specifics.  On the surface, everything seemed perfect with the end of shift reports showing the (lower) amounts collected, which were deposited accordingly. We noticed that there was a gradual reduction of the amount over a period of a few months. Apparently, the staff started small, and when no one caught them they became greedier and bolder as months went by- which incidentally caused a bigger dent in the revenues, big enough to get attention. Earlier there seemed to be a healthy mix of high-value (long-distance) tickets and low-value (short-distance) tickets in a shift, depending on the train schedules. But recently, all tickets were reported to be sold for shorter distances and hence the low revenues. Prima facie, the reports tallied and the ticket stock was properly accounted for. So they sealed all the systems in that station which they believed were tampered with and brought in replacement systems and staff to keep operations running while suspending the supervisor and a few suspected clerks. Now they needed proof and specifics. As the Chief Architect of the system, I was asked to be on the investigation team and visit Surat along with other railway officials. Given the stakes, we were briefed on safety precautions and given police protection even before we arrived.

How Distributed Auditing Cracked the Case:

Even before reaching Surat, we asked the superintendents of far-off train stations (such as Secunderabad, Bombay Central, which receive trains from Surat) to collect as many used tickets (originating in Surat during that period) as they could. (Remember, tickets were collected at the end of each journey.) Our team painstakingly collated each ticket’s date/time stamp, machine ID, and encoded cash total, piecing together solid evidence of how much cash was embezzled during those days and exposing the phantom shifts they created using dummy paper instead of real ticket stock. As an undocumented feature, I also had a running counter of the total cash collected on each machine which was also being transmitted to the central report server (but did not announce its existence until after this fraud). That counter completed the puzzle to provide an exact total. The disciplinary process then took its course to punish the guilty. The leadership appreciated the tamper-proof design and cleared our systems for further usage. Eventually thousands of such machines were spread out across hundreds of Indian Railway stations, issuing 5 million tickets per day, the most in the world.

Key Lessons:

  • When temptation and stakes are high, fraud is a natural consequence- prepare to address it!
  • Distributed auditing saved the day to provide indisputable proof of the audit trail.
  • It is not enough to build tamper-proof systems; checks and balances for the operating process need to be built as well.
  • Keep an ace up your sleeve: if the people doing the checks themselves commit fraud, you need another layer they don’t know about.

Published by tvprasad

I like making a difference to millions of users with the systems I developed/managed develop and am going to lead developing.

One thought on “Distributed Ledger Before Blockchain: How a 1990s Ticketing System Helped Solve a Railway Fraud”

Leave a Reply