If you've been following DeFi or Ethereum over the past few months, you've likely heard the term "flash loan" mentioned again and again.

This new DeFi primitive has been at the core of a number of economic exploits and arbitrages.

A thread on the basics of flash loans - 👇

Most DeFi loans take place across days, weeks, or even months.

You can deposit Ethereum into Aave, then withdraw stablecoins for yield farming in Yearn, for instance.

On-chain loans have garnered much traction, with total debt outstanding moving toward $2.5 billion.
While popular, DeFi loans are not capital efficient: to account for custodial risk and volatility risk, you need to put up 130-150% of the value of your loan in collateral.

If your collateral slips below the threshold, you're liquidated, resulting in a fee anywhere from 5-13%.
Flash loans are much different than longer-term DeFi loans.

Flash loans are non-custodial, take place over the course of one block, and require no collateralization.

That's to say, the coins you borrow never appear in your wallet.
When taking a flash loan, you can direct the coins to any protocol and function, as long as you pay back the loan + interest fee within the same transaction.

So what the hell? What are flash loans used for?

More often than not, arbitrage.
This means that if you spot mispriced markets between AMMs or dexs, you can take a flash loan to arbitrage the pools.

Here's a simple example I spotted in the mempool a few months back:

https://t.co/hiBHuTerQH

More on what's happening in the next tweet.
- This user flash borrowed 2,048,000 USDC from dYdX

- Traded that USDC for 2,028,367 DAI in Curve's Y pool

- Traded that DAI for 2,064,182 USDC in Curve's sUSD pool

- Paid dYdX back + 2 wei

All in one block...

Profit: 16,182 USDC
Cost: $60 in gas

Crazy, right?
The transaction I mentioned is just one of many simple arbitrages between different AMMs and diff pools. (More on AMMs in the linked thread.)

There are also advanced arb strategies that enabled the "attacks" on Eminence, Harvest, etc.

Let's take a look.

https://t.co/wftj1YuPtG
Many of these arbs are not AMM based. Instead, these arbs are accomplished by leveraging some faulty or buggy logic in the economic design of a protocol.
Eminence:

- Borrow 15 million DAI from Uniswap
- Mint EMN
- Burn some EMN for eToken, driving up EMN up the curve
- Sell remaining EMN for DAI
- Make millions

The bug was the bonding curve was steep and could be manipulated.

https://t.co/fP3ae4oDXQ
Harvest:

The bug was that Harvest didn't use the get_virtual_price() function from Curve, allowing for manipulation.
Flash loans can also be used for other purposes.

Governance attacks are a good example. They're scary but still kind of sick, to be honest.

On October 26th, a user used flash loans to influence a MakerDAO proposal.

https://t.co/naqLqOi1bS
This user completed multiple complex functions with a single tx, within a single block.

They

- borrowed $20m worth of WETH from dYdX
- deposited it on Aave to borrow $7m worth of MKR
- Locked MKR in governance
- Voted on a proposal
- Unlocked MKR
- Sent MKR, then ETH back
Related to flash loans, developers are working on flash mints for Wrapped Ethereum and DAI. Will do another thread on these later.

Flash loans will be similar in concept to flash mints but will involve the minting, then burning of tokens rapidly to accomplish some feat.
To conclude: Flash loans are an extremely powerful DeFi primitive.

I forgot who said it but they're going to accelerate the wheat from the chaff when it comes to protocols with good economic design.

I'm excited (and scared) to see what flash loans are used for next.

More from Crypto

1/ @MIT discussing the need for blockchain gateways to achieve interoperability across different blockchain networks, and to support the cross-blockchain mobility of virtual assets

https://t.co/PbjQkSlTT3

@quant_network are collaborating with MIT in the creation of ODAP

$QNT

2/ "In order for blockchain-based services to scale globally, blockchain networks must be able to interoperate with one another following a standardized protocol and interfaces (APIs)"

Gilbert founded ISO TC307 which 60 countries are working towards standardizing the interfaces


3/ "We believe that a blockchain gateway is needed for blockchain networks to interoperate in a manner similar
to border gateway routers in IP networks. Just as border gateway routers use the BGPv4 protocol to interact with one another in a peered fashion we believe that a...

4/ blockchain gateway protocol will be needed to permit the movement of virtual assets and related information across blockchain networks in a secure and privacy-preserving manner"

You can read more about the gateway protocol ODAP in this 21 tweet


5/
"We motivate the need for blockchain gateways and blockchain gateway protocols in the following summary:

✅Enables blockchain interoperability:
Blockchain gateways provide an interface for the interoperability between blockchain/DLT systems that operate distinct consensus...
Excited to share our 2020 #Bitcoin review.

2020 will be remembered as the year the long fabled institutions finally arrived and #Bitcoin became a bonafide macroeconomic asset.

Below are the top highlights of each month for Bitcoin’s historic year.

1/


Bitcoin is now at all-time highs capping off an extremely successful year.

But it was by no means stable ride up.

2020 was a historically volatile year.

@YoungCryptoPM and I provided a detailed overview of every month of 2020 in all its

Jan.

3 days into the new year the US assassinated Iran’s top general Soleimani.

BTC surprisingly reacted to the events behaving like a safe haven as the risk of war increased.

The events provided the first hints of BTC potentially having graduated to a legitimate macro asset.


Feb.

COVID-19 reached a tipping point causing markets to crash.

BTC’s correlation with the S&P 500 reached an ATH in the following weeks.

This is when everyone learned BTC was not a recession hedge, it was a hedge against inflation and loss of confidence in fiat currencies.
https://t.co/JB7dJ3qp6M


Mar.

Financial markets in free fall.

The liquidity crisis was so severe BTC experienced one of it’s worst days ever.

Now known as Black Thursday, on March 12, BTC plummeted as much as 50% to below $4,000 at its lowest point on the day.

BTC closed the day down 40%
Out of curiosity I dug into how NFT's actually reference the media you're "buying" and my eyebrows are now orbiting the moon

Short version:

The NFT token you bought either points to a URL on the internet, or an IPFS hash. In most circumstances it references an IPFS gateway on the internet run by the startup you bought the NFT from.

Oh, and that URL is not the media. That URL is a JSON metadata file

Here's an example. This artwork is by Beeple and sold via Nifty:

https://t.co/TlJKH8kAew

The NFT token is for this JSON file hosted directly on Nifty's servers:

https://t.co/GQUaCnObvX


THAT file refers to the actual media you just "bought". Which in this case is hosted via a @cloudinary CDN, served by Nifty's servers again.

So if Nifty goes bust, your token is now worthless. It refers to nothing. This can't be changed.

"But you said some use IPFS!"

Let's look at the $65m Beeple, sold by Christies. Fancy.

https://t.co/1G9nCAdetk

That NFT token refers directly to an IPFS hash (https://t.co/QUdtdgtssH). We can take that IPFS hash and fetch the JSON metadata using a public gateway:

https://t.co/CoML7psBhF

You May Also Like