Flashy Chat

Blog · · 3 min read

What is a flash loan?

Almost every loan in the world works the same way: someone gives you money, and you promise to give it back. The lender's problem is that a promise can be broken, so they ask for collateral, or a credit check, or a court they can take you to.

A flash loan removes the promise entirely.

The mechanic

An Ethereum transaction is atomic: every step inside it either succeeds together or fails together. There is no half-finished state. If the last instruction fails, the first one is undone too.

A flash loan is built on exactly that property. In one transaction:

  1. The lender sends you the money.
  2. Your code does whatever it wants with it.
  3. The lender checks the money is back.

If step 3 fails, the transaction reverts — and reverting step 3 also reverts step 1. The loan is erased along with everything else. From the chain's point of view, you were never lent anything.

So the lender does not need to trust you, and does not need collateral. They need one line of code that checks the balance at the end.

Why the amounts are so large

Because the lender's risk is zero, the size of a flash loan is not limited by your creditworthiness. It is limited only by how much the lender happens to be holding at that moment.

That is why flash loans are quoted in numbers that look absurd next to ordinary lending. Borrowing $1 billion for 12 seconds with no collateral is not a reckless loan. It is not really a loan at all, in the sense that word usually carries — it is a temporary read-write lease on a pool of capital, enforced by the same machinery that enforces everything else on-chain.

What people actually use them for

  • Arbitrage. The same asset trades at different prices on two exchanges. Borrow, buy on the cheap one, sell on the expensive one, repay, keep the difference. If the prices moved while you were mid-transaction and the trade no longer covers the repayment, the whole thing reverts and you lose only gas.
  • Collateral swaps. Repay a loan, withdraw the collateral, swap it for a different asset, redeposit, re-borrow — all before anyone can liquidate you.
  • Liquidations. Borrow enough to close out an undercollateralised position and collect the liquidation bonus without holding the capital yourself.

The common thread: every one of these is a trade that is profitable if it completes, and harmless if it does not.

What Flashy Chat does with them

Flashy Chat does none of the above. It borrows for no financial reason at all.

Every message sent through the contract calls Morpho once per supported token and borrows Morpho's entire balance of each — 17 tokens on Ethereum Mainnet, 16 on Base. The MessageSent event is emitted at the exact moment all of those tokens are held. Then everything is repaid, in the same transaction.

The result is that a message reading gm is permanently recorded alongside proof that, for one instant, it moved billions of dollars. Nothing was traded. Nobody profited. The point is the receipt.

You can read the exact amounts the next message would borrow by calling getFlashableAmounts() on the contract, and the homepage shows the live total.

The part worth remembering

A flash loan is not a clever way to get money you cannot afford. It is a way to use money you never have to be trusted with, because the transaction that lends it to you is the same transaction that takes it back.

Sources

  1. Morpho — Flash Loans
  2. Ethereum.org — Transactions are atomic
  3. Flashy Chat V2 on Etherscan

Last checked: