Hacker News new | ask | show | jobs
by machiste77 1518 days ago
The thing about a flash attack is that you don't need to be rich to buy that many tokens. You can borrow funds, buy the tokens with borrowed funds, execute your vote, sell the tokens, and then return the funds all in the same transaction.

The only money you would need is the cost of gas.

1 comments

Absolutely, the mixing of flash loans in all this is a fascinating little "innovation" that made this transaction that much easier. But there's certainly crypto whales out there with enough funds that could've done this if they felt like it. A 2x return on an 80M investment is a pretty darn juicy opportunity for someone with a sufficient lack of scruples. TBH, the more I think about it, the more surprised I am that it took this long for someone to take advantage of this weakness...
Can you elaborate on what a flash loan is? I don't understand how someone can anonymously borrow $80M worth of anything.
It's a loan with a guaranteed atomicity in repaying.

A single atomic transaction does:

1) Borrow $80M 2) Use $80M however you want 3) Return $80M + loan fees (e.g. on Aave this would be 0.09%)

The lender is algorithmically guaranteed to get the money back and the borrower can potentially take advantage of large scale transient opportunities, or...just wreak havoc on a poorly secured system.

More info here: https://docs.aave.com/developers/guides/flash-loans

And if you're wondering "but why??", if I'm not mistaken, one of the initial use cases for flash loans was in exploiting arbitrage opportunities, which tend to be transient with fairly low returns, which means you need access to large amounts of funds fairly quickly in order to take advantage of them.
They’re used a lot to maintain uniform exchange rates across Defi projects etc. In theory allowing anybody to borrow a lot of tokens to exploit arbitrage opportunities means that the rates will converge simply due to market forces (because if one project offers a better rate than another it will quickly be arbitraged away).
So it is purely a tool for speculative trading? There is no connection to the "currency" part of "cryptocurrency"?
It's a tool for...atomically loaning and repaying large amounts of money. You can use that however you want, most typically for arbitrage to bring markets into equilibrium while earning a profit. The arbitrage isn't fundamentally different from what happens in traditional markets and flash-loan-like primitives are being developed outside of crypto.

(I don't know what the second question means or what your mental model of a "real" currency is)

A flash loan is a risk free crypto loan. It works by releasing the money only on the condition that it is returned before the end of the block. If it is not returned by the end of a block, the block is invalid and can not be added to the blockchain (provided the majority follows the block chain rules). Any block that is added to the blockchain has an exclusive lock to the entire block chain (no two blocks can "happen" at the same "time") meaning this guarantees atomicity of what happens in a block.
But then how are the funds used? Why is somebody able to transact with funds that they will receive in a block that hasn’t yet been added to the chain?
The transaction is basically a function call like this:

flash_loan(int amount_borrowed, func arbitrary_trades)

1. give LOANEE_ADDRESS amount_borrowed

2. call arbitrary_trades()

3. give LOANER_ADDRESS (amount_borrowed + interest)

When 2. is executed, the loanee has the money. When 3. is complete, the loaner has the money back. If the loanee doesn't have the money to give, 3rd step fails. And since its atomic, the whole transaction fails.

This but it's transactions, not blocks.