Molly White's Citation Needed - The FTX trial, day four: The fraud was in the code
Episode Date: November 29, 2023The jury got a taste of code review as they examined a falsified "insurance fund" and the infamous FTX → Alameda Research "backdoor". Originally published on October 9, 2023....
Transcript
Discussion (0)
I'm Molly White, and you're listening to the audio feed of the citation-needed newsletter.
You can see the text version of the newsletter online at newsletter.mollywhite.net.
The fraud was in the code.
The jury got a taste of code review as they examined a falsified insurance fund
and the infamous FTX to Alameda Research Backdoor.
This issue was originally published on October 9, 2023.
We got our first glance.
at the FTX codebase on Friday.
The prosecution brought out GitHub screenshots as they questioned cooperating witness Gary Wong,
the former CTO of FTX, who at various times was responsible for the code bases
powering both FTX and Alameda research.
Wong has pleaded guilty to four charges.
Although there is some risk of confusing the jury when presenting them with code snippets,
prosecutors had Wong step through what the code was doing in a way that seemed pretty clear
to me. It probably helped that FTX's engineers wrote decently clean code with descriptive variable
names and concise functions, and chose a very human-readable language, Python. Note to self,
if you're going to write code to do fraud, make it messy and unreadable to reduce the chances
it's later put in front of a jury as evidence. Much of the conversation revolved around the
allow-negative flag that was introduced to the FTX codebase on August 1, 2019.
Wong testified that Sam Bankman-Fried had asked him and Nishad Singh, the former FTX engineering
director, who is also pleaded guilty, to add the flag.
GitHub screenshots show Singh making a code change to add the column in the database and adding
logic to exempt accounts with the flag from checks that would otherwise determine if they
had sufficient funds to withdraw. A later change by Wong himself also exempted accounts with
this flag from ever being liquidated. Prosecutors took this opportunity to point out that
practically the same day this change was being made at Bankman-Freed's direction, Bankman
Freed was out on Twitter, claiming that Alameda's account is just like everyone else's.
Wong testified that the allow-negative flag was a special privilege given only to Alameda
research's trading accounts.
and a database screenshot also showed the effectively unlimited line of credit that Alameda research could dip into.
Wong explained that Alameda had not started out with such a high credit limit,
but that periodically the trading firm had run into issues placing trades because they didn't have enough collateral,
and Sam Bankman-Fried kept asking him to increase their credit limit to prevent it from happening.
According to Wang, the limit was originally set to, quote, a few million dollars,
but was then increased to $1 billion.
After they ran up against that limit, too,
Bankman Free Aid asked him to set it to a number so large
that they wouldn't likely hit the limit.
At that point, Wang set it to around $65 billion.
Finally, prosecutors questioned Wang about the FTC's insurance fund,
which was ostensibly supposed to protect both FTCS and its customers
from trades that went badly even more quickly than he exchanges' risk engine could account for.
FTX published the fund's supposed balance on their website and bragged widely about its existence,
including in testimony to U.S. Congress.
However, according to Wang, the numbers shown on the website was falsified.
The AUSA questioned, is it a real number?
Wong replied, no.
The AUSA asked, so it's a fake number, to which Wong said yes.
The AUSA asked, was the real number higher or lower than?
than the fake number, and Wong replied, lower.
Code snippets shown to the jury demonstrated how Nashad Singh wrote some code that would update
the insurance fund amount by adding to it the daily trading volume, multiplied by a randomish
number around 7,500, and then dividing it by a billion. Thus making it appear as though the
website was referencing a real account balance that was fluctuating as the exchange added funds
or withdrew from it to cover losses.
In reality, it was all made up.
This is pretty damning.
One could possibly explain away an inaccurate number,
say one that was hard-coded into the website
and never changed to reflect the true fund balance
by saying that they had correctly represented it at one point in time
and forgot to change it.
But it's really hard to come up with a good explanation
for why the fund was being incremented
by a random fluctuating number
that was in no way tied to any actual account balance besides the obvious,
that FTX was trying to present a falsified but convincing number to customers.
That would be fraud.
Elsewhere in the code, it's possible to observe that the amount of FTT in the fund
was actually represented by a hard-coded value in the user interface
and was not pulling from an external data source to get a real number.
This wasn't highlighted to jurors, though,
probably because the randomized number is far more damning.
As prosecutors continued to question Wong, he explained that there were repeated incidents
in which FTX suffered losses that exceeded the real, smaller amount of assets that had been
set aside in an insurance fund.
One such example was in 2021, when a trader was able to exploit a bug in FTX's margin system
that allowed them to take out a massive position in the mobile coin cryptocurrency.
They were eventually liquidated, and FTCS suffered a loss of, quote, several hundred million dollars, according to Wong.
Prosecutors haven't mentioned it, but Sam Bankman-Fried would go on to testify under oath in front of the U.S. Congress in May 2022 that, quote,
the insurance fund has paid out a net total of $9.5 million, end quote, in the preceding three years, and that, quote,
the single biggest daily drawdown from the FtX.com insurance fund was $4.7 million.
They did, however, play a clip from the Oddlots podcast in which Sam Bankman-Fried lied to interviewer Matt Levine,
saying that FTC's risk management engine was so good that they had, quote,
never had a day where there's more money that we lost in blowouts to revenue than we had just made from trading fees.
And if you're like a big exchange with a lot of capital, like,
like empirically how good is the risk management?
Like do you guys regularly have like blowouts that you don't,
that you're not made whole?
It's a good question.
So we,
um,
we,
we put a bunch on the risk engine.
We don't have big issues.
Like,
we've never had a day,
I think,
where there were,
there's more money that we lost in blowouts to revenue that we made just
from trading fees.
So,
and on most days,
it's effectively zero dollars cost.
So this is not like a big deal for,
for us.
I mean,
it's a big deal.
Think about,
but like,
economically hasn't been a big cost to us. Wang went on to testify that the mobile coin losses
and other similar losses that exceeded the amounts available in the insurance fund were taken on
by Alameda. That is, Alameda took over the account's position in collateral, effectively absorbing
the loss as its own. Wang said that Bankman-Fried reasoned, quote, that FTC's balance sheets are more
public than Alameda's balance sheets, that investors have access to FTCS's finances, but not
Alameda's finances. Indeed, just the previous day we had heard testimony from Paradigm Venture
Capitalist Matt Wang, during which balance sheets were shown to the jury that showed $63 million
in estimated trading expenses and $63 million in estimated other expenses for all of 2021,
clearly omitting the several hundred million dollars lost to the mobile coin incident.
The defense team only briefly questioned Wong before the court session ended, but began by suggesting
to the jury that he might be saying what the government wants to hear in the hopes of receiving
a lighter sentence. He faces a maximum of 50 years in prison, but will likely receive a substantially
shorter or even no custodial sentence due to his cooperation. They also tried to offer an
alternative explanation for the allow negative flag, that Alamedo was in charge of doing conversions
from U.S. dollars to stable coins, and for a brief period in this transaction, they needed to borrow
the funds from FTCS before returning them in stable coin form.
Why they would need a $65 billion ceiling to do so, however, was not addressed and seems likely
to come up and redirect when court resumes on Tuesday.
Tuesday will also bring the testimony of Caroline Ellison, former Alameda Research CEO,
and on-and-off girlfriend of Sam Bankman Fried.
She is expected to be the star witness in this case, and the defense team has already
tease their blame Caroline defense in opening statements. Thanks for listening to this issue of
the citation needed newsletter. To learn how to support my work, visit mollywhite.net slash support.
If you would like to read the text versions of these episodes, sign up to receive the newsletter
in your email, or support my work on a recurring basis, go to newsletter.mollywhite.net.
