4 ms·
Flash loans let anyone borrow a large amount of crypto with no collateral, provided the loan amount plus a fee is returned in the same transaction it is borrowe
by Flashtoo 6y ago
Flash loans let anyone borrow a large amount of crypto with no collateral, provided the loan amount plus a fee is returned in the same transaction it is borrowed in. No collateral is required because there is no risk (assuming no exploits).
This means you can't take the highly speculative trade, you can only go for a sure thing. But if you do have a sure thing, you can borrow as much currency as the lender can provide.
- kgin 6y agoSo the loan and the return is a single "transaction" (in db terms)? What sort of situation could this be used in? I'm having a hard time truly imagining use without any risk of transaction rollback.
- downandout 6y agoThey are primarily used for arbitrage transactions. Token swaps on decentralized exchanges are instant - there is no order book. So you can compose a single transaction that involves many exchanges, swaps involving different tokens, flash loans, etc. If the transaction ends with a profit after the loan is paid back, at the market prices that exist at the time the transaction is executed, the flash loan occurs, and profits are collected by the person that created the transaction. If it does not end with a profit, then the transaction is reverted as if it never existed.
- socialentity 6y agoHow would that work, though? It sounds like guaranteed arbitrage? But does arbitrage work as a trading strategy? I thought markets quickly become too efficient for that?
- downandout 6y agoIt is guaranteed arbitrage. There is no risk to the lender, and the only risk to the person that initiated the transaction is that slippage will occur that makes the trade unprofitable, which would cause the transaction to revert, which would cause them to lose the transaction fee for having attempted the transaction. The markets are not currently too efficient for that, and never will be. In fact Uniswap’s entire design depends heavily on arbitrageurs balancing out the markets between itself and other exchanges.
- SamBoogieNYC 6y agoWow this sent me down a rabbit hole. How are the transactions composed, with a smart contract/s, in combination with Dex API’s?
- downandout 6y agoFlash loans are composed using a smart contract. So basically you create a smart contract that will call all the DEX/loan platform/other contract functions necessary to obtain the loan, carry out swaps and pay it back. You then deploy that contract. Then you would have a separate program running on your client machine to scan for market opportunities, and when it spots one, have that program send a transaction to your deployed smart contract to initiate the loan and set into action whatever logic you programmed into the smart contract that will yield a profit. Yes, it’s quite a rabbit hole indeed. It is hard to believe that something like this is even possible, let alone profitable, but it really can be. I have seen single flash loan transactions yield up to $46k in profits. That profit is irrevocably delivered back to you in a couple of seconds.
- SamBoogieNYC 6y agoYea it’s really quite wild and an exciting application of the ‘programmable money’ concept. Did some more reading. Thanks for the rundown.
- capnorange 6y agoflash loans makes markets more efficient: https://blog.instadapp.io/six-percent-instant-return/ https://blog.instadapp.io/six-percent-instant-return/
- downandout 6y agoYes, and gas fees for failed transactions ensure you can’t just take unlimited shots at it either. However, if you are monitoring the markets and your code, connections to the network, etc. are fast enough, you can make a fortune using flash loans. A few days ago I found a trade where someone made $17k on a single trade [1] with the only necessary capital being a ~$170 transaction fee. They took a $250k flash loan that they successfully arbitraged. Smaller amounts are made all day every day. [1] https://etherscan.io/tx/0xfd35e99cbbefea68874391a14ddb09a28930147452c7efe19b78c9d6887e8789 https://etherscan.io/tx/0xfd35e99cbbefea68874391a14ddb09a289...