5 ms·
Flash loans are a great example of how blockchains enable new types of financial transactions that either aren't possible or are very difficult to do in a tradi
by v64 6y ago
Flash loans are a great example of how blockchains enable new types of financial transactions that either aren't possible or are very difficult to do in a traditional financial setting.
If you identify an arbitrage opportunity in the market, you can atomically borrow a large sum of money to take advantage of the price difference. You also have the added assurance that if the arbitrage opportunity goes away before you can take advantage of it, the entire transaction fails and you only lose the Ethereum transaction fee. It's essentially risk-free arbitrage.
This paper [1] dives into detail about how these arbitrage mechanics play out on the blockchain, and how both arbitrageurs and miners manipulate transactions in order to make a profit.
[1] https://arxiv.org/abs/1904.05234 https://arxiv.org/abs/1904.05234
- the_local_host 6y agoWouldn't a lender charge money for what is essentially an option to borrow contingent on the arbitrage transaction going through?
- ryebit 6y agoPer other responses, they frequently do charge a special fee (I think Aave charged around 0.09% at one point but can't find good ref right now). One interesting thing I think is still under dev/consideration is adding the ability for MakerDAO to make "flash mint loans"(https://forum.makerdao.com/t/mip25-flash-mint-module/4400/9 https://forum.makerdao.com/t/mip25-flash-mint-module/4400/9) -- essentially a flash loan where the caller can mint an arbitrary amount of DAI without having to back it with anything, so long as they pay it back + fee at the end. There's a similiar idea being worked out for WETH10 (https://github.com/WETH10/WETH10#flash-loans https://github.com/WETH10/WETH10#flash-loans), a project trying to make a feature update of the WETH (wrapped ether) token. I'm honestly unsure WTH the impact of something like these would be, but would definitely prevent arbitrage from going too far out of bounds, since there would always be unlimited liquidity. Multi-party atomic financial transactions are kinda insane.
- AaronFriel 6y agoSo someone else starts a lender to charge slightly less. The race to the bottom happens very quickly.
- the_local_host 6y agoI don't think it makes sense to handwave the cost of an option to borrow to 0 in a scenario where arbitrage is assumed to still exist. If anything is going to become perfectly efficient first it's the arbitrage ("free money!").
- qqii 6y agoFeeless flash loans exist: https://money-legos.studydefi.com/#/dydx https://money-legos.studydefi.com/#/dydx Aave is 0.09%: https://aave.com/flash-loans/ https://aave.com/flash-loans/ It is also an important part of uniswap: https://uniswap.org/docs/v2/core-concepts/flash-swaps/ https://uniswap.org/docs/v2/core-concepts/flash-swaps/ Any fees on a flash loan will disincentive closing arbitrage positions to that fee amount.
- the_local_host 6y agoThis seems to good to be true. From https://money-legos.studydefi.com/#/dydx https://money-legos.studydefi.com/#/dydx : Borrow x amount of tokens. (Withdraw) Call a function (i.e. Logic to handle flashloaned funds). (Call) Deposit back x (+2 wei) amount of tokens. (Deposit) It looks like unlimited leverage for flat fee.
- v64 6y agoThis article [1] does a deep dive into how flash loan mechanics are structured using an actual Ethereum transaction as an example. This particular flash loan used dYdX, Uniswap, Aave, and Curve.fi. Because of the atomicity of the transaction, there's no way to default on the loan. If you can't pay it back, you're never loaned the money in the first place. [1] https://medium.com/@kentmakishima/the-43k-defi-magic-trick-flash-loans-smart-contracts-and-atomic-swaps-galore-b26b22bb0423 https://medium.com/@kentmakishima/the-43k-defi-magic-trick-f...
- deleted 6y ago[deleted]
- xwdv 6y agoWow this sounds like a great way to make a lot of risk free money very quickly. How do you scale the identification of arbitrage opportunities?
- deleted 6y ago[deleted]
- v64 6y agoThe Flash Boys 2.0 paper I linked to in my original comment provides some detail as to how these opportunities are identified and exploited by competing arbitrageurs.
- EGreg 6y agoNo, blockchains are not the future, they are really the reason why one transaction can happen at a time in the whole world. Even Ethereum 2.0 will have shards which will do away with this anomaly. The only reason flash loans even work with no collateral is because you can be sure nothing else is running on the “world computer” while your transaction runs, so you can roll it back with no risk except gas fees. Vitalik himself acknowledges this, the guy is quite honest and straightforward about its limitations: https://thenextweb.com/hardfork/2019/08/19/vitalik-buterin-ethereum-blockchain-almost-full-scalability/ https://thenextweb.com/hardfork/2019/08/19/vitalik-buterin-e... Vitalik Buterin: Using Ethereum is expensive, and its blockchain is ‘almost full’ He also said blockchain's 'problem' is that every computer verifies every transaction Actually blockchains are a first-generation technology that do global consensus for every block, which literally means all transactions in the world must go through one computer in the world (the miner) although it’s a different one each time. And the situation is actually worse, since you don’t know who would mine the next block in advance, every transaction must be sent to every potential miner! Imagine if BitTorrent had every computer store and seed every movie instead of using DHT. The ability to send or loan arbitrarily large amounts for a fixed fee is a symptom of centralization. In a fully distributed network, transaction fees would have to be proportional to transaction size! Almost every other protocol on the Internet does not have such bottlenecks in its design. No one asks how many emails or websites can be served per second. Blockchain is trying to secure every transaction using the entire network! That is why so much electricity is wasted just to do 7 transactions per second. The next generation of crypto will actually be able to power payments using embarrasingly parallel architecture. Until then, we have blockchain. Ethereum is nicknamed the “world computer” for a reason. Gas fees are super high for small transactions like paying for coffee or voting in a secure election. Just one app KryptoKitties can clog up the entire network. We built Intercoin apps on top of Ethereum (https://intercoin.org/applications https://intercoin.org/applications) but we are not going to wait around for Ethereum 2.0 - which is blockchain also. Kik Messenger and others have long gotten off.
- qqii 6y agoSharding is simply not ready, as far as I know no project currently with smart contracts have non a blockchain structure. That said currently ethereum has many L2 solutions (https://ethereum.org/en/developers/docs/layer-2-scaling/ https://ethereum.org/en/developers/docs/layer-2-scaling/) that "run in parallel" and result in low gas fees. So far I've not seen any hint of an "embarrasingly parallel architecture" that can satisfy the safety requirements that a blockchain also does and run smart contracts. I'd be happy to read up if you can point me to any research or projects that I've missed.
- joosters 6y agoBut the only legitimate use of a flash loan is to do some arbitrage - and there’s plenty of that in existing financial systems. All the other uses are for leveraging up theft and manipulation of markets. Well done cryptocurrencies, you’ve made a new cesspool of villainy! Anyway, it’s not clear to me why flash loan providers are still a thing, as they seem to be open to a second layer of abuse: transaction copying / sniping: All flash loan borrowing transactions are profitable (otherwise they wouldn’t be able to pay back the loan) - but why let the originator of the transaction keep that profit? What a sensible attacker should do is: 1) watch for flash loan transactions to be submitted by someone, then 2) quickly submit a duplicate transaction with a larger fee, but change the destination wallets to your own. That way, you get all the proceeds of a theft, and not just the loan interest rate. Given this possibility, flash loan pools could be considered as ‘bait’ or a trap for the unwary thief...
- v64 6y ago> But the only legitimate use of a flash loan is to do some arbitrage - and there’s plenty of that in existing financial systems. There are two main differences: 1) The atomic nature of a flash loan makes flash loan arbitrage much less risky than performing arbitrage traditionally. Doing the same type of arbitrage non-atomically may mean that you miss the arbitrage opportunity, resulting in a loss from having to pay back the loan you took out plus interest without having made any money with it. 2) Because the debt must be repaid in the same transaction, the loan is uncollateralized. As far as I know, one cannot borrow millions of dollars in the traditional financial system without putting up some kind of collateral. > What a sensible attacker should do is: 1) watch for flash loan transactions to be submitted by someone, then 2) quickly submit a duplicate transaction with a larger fee, but change the destination wallets to your own. This has been observed on the blockchain in practice. The paper I linked to describes the mechanics of how this plays out and what strategies competing arbitrageurs use to win these opportunities.
- fbrusch 6y agoHere's a story about that (it's called "frontrunning"): https://medium.com/@danrobinson/ethereum-is-a-dark-forest-ecc5f0505dff https://medium.com/@danrobinson/ethereum-is-a-dark-forest-ec...