A simple database flag enabled cryptocurrency magnate Sam Bankman-Fried (SBF) to siphon billions of customer dollars into a lavish lifestyle that ultimately left failed exchange FTX over $12 billion ($US8 billion) in debt, a US court has heard as SBF’s trial nears its conclusion.

Once the second largest cryptocurrency exchange with a valuation of $47 billion, the reasons for the spectacular fall of FTX – which saw SBF arrested in the Bahamas last December after he was caught moving funds to the purportedly more crypto-friendly jurisdiction – were laid bare as the US Department of Justice walked a jury through the process by which SBF and co-founder Gary Wang defrauded customers of billions of dollars.

In December, SBF was charged by the US Securities and Exchange commission (SEC) for building what SEC chair Gary Gensler called “a house of cards on a foundation of deception.”

FTX, SEC Division of Enforcement director Gurbir S. Grewal said when SBF was arrested, “operated behind a veneer of legitimacy Mr Bankman-Fried created by, among other things, touting its best-in-class controls, including a proprietary ‘risk engine’, and FTX’s adherence to specific investor protection principles and detailed terms of service.”

“That veneer wasn’t just thin,” he said. “It was fraudulent.”

Even as customers poured billions into FTX’s legitimate cryptocurrency exchange activities, Wang testified during the ongoing trial, SBF was actually moving money into the account of Alameda Research – a Wang and SBF-owned hedge fund to FTX that, as a putative customer of the exchange, was not subject to the same regulatory scrutiny that FTX faced.

While justifying transfers to Alameda as a way of investing customer money in real-world investments – and providing a buffer fund that would protect customers from massive losses due to wild swings in volatile cryptocurrency markets – SBF was also using the money to fund a lavish lifestyle that included the amassing of more than $1 billion ($US700 million) in assets, including luxury apartments, private planes, and hobnobbing at A-lister events.

Alameda’s drawings eventually grew so large, the packed courtroom heard as Wang walked prosecutors through the operation of FTX, that SBF asked him to find a way to allow customers to maintain a negative account balance.

Wang’s solution was to create a new field in the customer database, called ‘allow_negative’, that would sidestep FTX controls designed to prevent customers from withdrawing more money than they had.

The gap was accounted for as losses incurred around the in-house cryptocurrency FTT, described by Wang as a “sort of equity” that allowed the founders to maintain the charade even as Alameda burned through customers’ fiat currency.

Alameda, it turns out, was the only FTX customer for which the flag was switched on – setting in motion a downward spiral that would see the firm extract billions from FTX customers while undermining the company’s already shaky foundation.

The scenario continued for several years but came undone in 2022, when a cryptocurrency market downturn saw investors demanding their money back and FTX going to increasingly desperate lengths to stay above water.

By the time journalists from industry news site CoinDesk uncovered a problematic Alameda balance sheet in late 2022, the firm’s account owed FTX over $12 billion ($US8 billion) – setting in motion an avalanche of disasters that, due to the company’s size, has shaken the entire crypto industry to its core.

SBF’s trial has become a media spectacle as prosecutors call a parade of witnesses to lay out the damning case against the 31-year-old SBF, who may or may not testify this week but has previously pled ignorance of the snowballing financial disaster.

He faces a range of fraud related charges that could see his assets forfeited and potential jail time.

Navel-gazing for a voracious industry

For an industry as generally bullish as cryptocurrency, the trial of SBF has floated some uncomfortable truths that – depending on whom you talk to – highlight either how bad actors can abuse investor largesse or how an almost complete lack of regulations has enabled poor behaviour to fester.

The complexity, global design and unconventional business and management structures of cryptocurrency operators have complicated efforts by regulators to apply the same prudential rules that other financial services operators face on a daily basis – such as equity buffers to protect against customer losses.

Amidst overseas efforts to normalise cryptocurrency, ASIC, for one, has been weighing regulation for some time and has taken tentative first steps towards regulation of an industry that, pundits argue, could be larger than the tourism and energy industries by 2030.

Yet with a long history of spectacular security breaches, fiduciary lapses, criminal activity and scams – which have left customers penniless and put billions into the hands of SBF and other individuals – authorities have increasingly cracked down on ‘crypto bros’ as they try to clean up an industry that will wear the scars of FTX’s collapse for some time.