FTX "insurance fund" calculated by multiplying trading volume by random number
twitter.com
twitter.com
So long as the random value is truly random. Were there lava lamps in the FTX server room?
Insurance companies have very detailed models on how much risk their customers provide, how much they're likely to cost, and charge accordingly.
They don't just go "yolo random(1,100)'l" and hope they're in business in 5 years.
The fund size was 7500 * the trading volume since the fund was set up.
the reality of it boiled down to “Madoff was too big and important for anyone to dare question”.
Yes, the fraud itself was extremely simple, but I also highly doubt that a random noname like SBF could have pulled that off at the time. You really had to be someone. Someone the SEC didn’t want to touch.
https://web.archive.org/web/20130203112329/http://dev.hasenj...
But it poses a larger question: OSS can be used for war and pedophilia.
It is very refreshing and surprising compared to cloud platforms being adamant that they ought to deplatform people who hold even slightly wrong views.
Is it the same programmers holding very different philosophical views?
Protip. If you are committing fraud in the future - use a compiled language, do not use offsite version control and UPLOAD ONLY THE BINARY.
Until you get prosecuted and legally required to turn over the source code, as it happened here.
The comments were all like, “well, duh you have to use a randomized Gaussian blur to make it irreversible”. “Yeah or black out the faces entirely.”
Finally someone said, “right. Or, you know, you could just not molest children.”
Edit: this might have been it but I remember a more involved thread:
[1] https://devblogs.microsoft.com/oldnewthing/20171114-00/?p=97...
Maybe the f2d function filters negative values but it sounds like a simple float-to-double conversion.
I'm not sure whether it was intentional, but, contrary to the headline, this random value was used to update the fund size daily as shown in the rest of the code. So, a single day for which the fund actually decreases wouldn't matter much. It might even be beneficial to make it look more real.
If you get as far as a federal criminal trial, you're almost certainly getting convicted regardless of what cryptographic signatures do or do not exist.
Using some randomization on the daily trading volume makes some sense for what to actually move each day during an end of day process.
Ofc many websites do that. I did one in my previous company, it's a common social gimmick. But, once a journalist asked us how it was calculated, we removed it... we knew it was wrong from the CEO to the code monkey.
The rule I believe is: don't lie to your customers, yes even if that can extract more money from them.
Plus it makes me feel good about signing my commits!
For me it looks like this value is used only when there was no data?
Basically else part of monad
>>> None or Decimal()
Decimal('0')
So if their aggregation returned no results they'd substitute a 0. It's a client-side `coalesce()`This would be bad risk management. The random number makes it clear that not creating the fund wasn't an oversight, it was a willful deception.
Creating the possibility that some rotten luck could wreck you when you're most vulnerable is bad risk management. It's thumbing your nose in the face of Murphy's Law.
The only reason to do it this way is if there's no intent for the number to correspond to reality at all.
But to your point; if this code is written honestly, it's pretty weird that we don't see any code to post a transaction to the blockchain, or to verify that the funds are available to be allocated to the insurance funds. You would think that would happen before you wrote the new total to the database.
The RNG is used to give some variance to the number without accidentally making a pattern (which humans making up numbers tend to do). Literally using a RNG in code that’s meant to produce a value based on real world data is blatant and hard to defend if true.
...and if you are stealing, repeat a few digits occasionally: lack of repetition has caught several-a-tea leaf.
So technically it's not the randomness that's the issue, and a constant or manually updated fake amount would be as bad, but to me as a layman but it seems like they use a random number to imply a sophisticated risk management system.
It’s like putting pillows under your blanket so someone thinks you’re in bed. Once they find the pillows you aren’t going to get away with “oh I thought I was allowed to be out all night.”
When a software engineer writes code because the code makes sense or solves the problem, without interrogating the problem or how it applies to the real world, there can be real and significant consequences. We trust far too much of our lives to tech to ignore these issues when we're on the side of writing the code.
Seriously, that part is a humanities problem, and many engineers have little education in or understanding of humanitities (to the point of disdaining it).
If you study to do software engineering from the earliest age you can, do CS at university, don't join any clubs with others from non-STEM backgrounds, or even go to a STEM only university, then join a tech company big enough that you don't have to talk to non software engineers, you've just spent your life in a bubble. Sadly I think this is too easy to do.
No “import numpy as np” !?
It’s amazing that some people still defend SBF. Among his sycophants is Michael Lewis, author of Moneyball, The Big Short, and now “Going Infinite” which somehow manages to gloss over the rampant fraud happening at FTX since inception.
"Many of the reviews that I have read of the book complain that Lewis does not sufficiently explain that Bankman-Fried is Guilty and Bad, Actually, but that is not the book that he wanted to write... If you want to read a moral condemnation of crypto theft, you can get that anywhere. You go to Michael Lewis for character and story.
Also, reading those reviews you would think that the book is a defense of Bankman-Fried, but it is actually quite damning."
The interviewer maybe edits for effect, but Lewis seems very biased towards SBF.
I would normally say the latter is more random, because you're getting more entropy per call. In the same sense, a function drawing from a normal distribution is less random than one drawing from a uniform distribution.
(All of this depends on a computers view of the world, where values are in data types that have some number of bits. In a mathy view of the world where every value is effectively infinitely many bits you get just as much entropy sampling from a normal distribution as a uniform one.)
That's some mathematical nonsense.
A normal distribution is continuous from negative infinity to positive infinity, so even by your flawed judgement of what makes something "random", a sample from the normal distrubtion has far more possibilities.
The standard normal distribution is almost the definition of random.
But in that context, there is more entropy in a float32 drawn from a uniform distribution than a float32 drawn from a normal distribution, no?
It's not just the number of possibilities, it's how likely they are. For example, consider two functions:
A: 1% chance of 1, 1% chance of 2, 98% chance of 3
B: 50% chance of 1, 50% chance of 2
The entropy of a distribution, in bits, is: H = - sum over all possibilities of (p * log_2 p)
So for A it is: H_A = -(2 * 0.01 * log_2(0.01) + 0.98 * log_2(0.98))
= 0.16
And for B it is: H_B = -(2 * 0.5 * log_2(0.5))
= 1
So you can see that A has lower entropy than B, because it's more concentrated.For continuous distributions this is defined with an integral instead of a sum, but it's the same idea:
H = - integral from -inf to + inf of (p * log_2 p)
Whether there's more entropy in a sample drawn from a uniform or normal distribution, then, depends on how wide your distributions are. Consider: C: uniform distribution from -1000 to +1000
D: normal distribution centered on 0 with standard deviation 10
E: uniform distribution from -1 to 1
We then have: H_C = - log_2(2000) / log_2(2) = 10.97
H_D = 1/2 (log_2(2pi * 10^2) + 1) = 5.15
H_E = 1
Note that continuous and discrete entropies mean different things, and their values can't be compared directly. That H_E and H_B are both 1 is not meaningful.Afterall, how can U(0,1) be considered to be "less random" than U(0,1000) when U(0,1000) = 1000*U(0,1). A constant factor can't change how "random" something is.
If you look at it from a math ("continuous is actually possible") perspective I have a much weaker handle on it, but I think the problem is that the entropy of 1000U(0,1) is not the same as the entropy of U(0,1)?
It’s still ridiculous to use a normal distribution to calculate how much money should go into an insurance fund that needs to cover sudden, severe losses.
Let’s do a lottery together. We each throw in some money. Since they’re both just as random, I’m sure you won’t mind if I use a normal distribution, and choose each of our positions on the number line. :)
Your assertion is missing some needed qualifiers.
If given only mean and standard deviation, the normal distribution is the maximum entropy distribution i.e. maximally random distribution.
How does volume correlate to the value of the insurance fund? Isnt value equal to number of tokens * price per token?
It basically takes the daily volume, multiplies it by 0.00075% (on average) and adds that to the insurance fund. FTX charges a % fee on every trade, so this is the equivalent of taking a fraction of their fee revenue and putting that into an insurance fund, which seems pretty reasonable.
There was an actual insurance fund and it had a tiny fraction (5% or less) of what this number in the database claimed. The random numbers generated by this code did not represent actual contributions to said insurance fund. They were not, in fact, taking a fraction of their fee revenue and putting it into an insurance fund.
They were not doing anything even remotely reasonable, this was a flat-out lie.
The non-zero mean and relatively small standard deviation (0.4 sigma) make all the difference here.
I'd say the ethics and legality are entirely determined by how this distribution was determined and if it's consistent with promises to customers.
What _possible_ justification could there be for using that as an accounting practice for a fund other than fraud?
Also Flash Boys, which was basically a book-length advertisement for the IEX exchange.
https://www.wsj.com/livecoverage/fed-meeting-interest-rate-d...
To be fully pedantic: it's both things! It's a random number chosen from an arbitrarily sized range around an arbitrary number :)
So, for example, the problem with “randomly” picking 4 every time (a la xkcd) is that it introduces a spurious correlation between the places where it’s used.
# TODO: stub for now until we have an actual insurance fund