A flash loan is a loan in which the borrower does not have to provide collateral. Flash loans must be paid back within the same transaction block. Typically, flash loans consist of three steps:
- Receiving the loan: the assets of the lender are sent to a smart contract which gives the borrower temporary access to the assets.
- Spending the loan: the borrower can now spend or invest the borrowed assets in decentralized apps (DApps) such as decentralized exchanges (DEXes).
- Paying back the loan: The borrowed money must be paid back with the addition of the agreed interest.
Thanks to the smart contract, the lender always gets its assets back – if the borrower does not re-pay within the same transaction block, the smart contract reverses all transactions as if the loan was never taken out. This can be accomplished because the lender’s assets have always remained his: the smart contract allowed the borrower to use the assets, not own them. This explains why the borrower is not required to provide any collateral for the loan in the first place.
It may seem like a short time frame in which to pay back the loan (one transaction block) but the borrower can do a lot in this time. In general, flash loans are most commonly used for arbitrage opportunities. This means that an investor can take advantage of the price difference of a token between two or more decentralized exchanges and then pay back the borrowed amount to the lender, keeping the profit.