The Buy-A-Block Attack
By: Kenneth Goodman
Tags: Hacking, Cryptocurrency, Ethereum, Blockchain, Bitcoin

Decentralized Collateralized Lending

TL;DR:

Because crypto-assets are pseudo-anonymous, lending must be over-collateralized. If a borrower has a sufficiently large borrow that starts going against them, they should buy every block until it is unlikely that the cost will outweigh the possible gains.

The Rules:

Borrow one crypto-asset (say ETH) for another (say TUSD) Collateralize the borrowed ETH by providing > 100% TUSD (TUSD is the margin/collateral) As the price of ETH goes up, the platform issues a margin-call so that borrower needs to return some of the ETH or provide more TUSD (collateral) So that value of borrowed ETH < value of TUSD (collateral).

It is important to note that if we are doing decentralized pseudo-anonymous lending, there should be no credit-risk.

The key thing we’ll be focusing on is the margin-call.

To issue a margin call, some party needs to let the blockchain know the price has changed so that it can liquidate the TUSD into ETH so that the lender of the ETH does not lose value.

We will ignore:

How the liquidation from collateral (TUSD) into borrowed asset (ETH) works How the protocol comes to consensus that the price has indeed gone up (Oracle based)

The Strategy:

If someone believes the price of an asset will be extremely volatile, there is an opportunity to make free money (arbitrage) by breaking the protocol if not application is not implemented correctly.

Suppose they believe ETH will move down relative to TUSD. They should borrow ETH using TUSD as collateral and sell the ETH on an exchange for TUSD. If the price goes down, they buy the asset for cheaper and return it (a normal short). If the price doesn’t move, just pay the interest. If the price goes up:

Block all margin calls by buying blocks to buy them more time for their position to become profitable

The Math:

If the probability that over one day the asset will become under-collateralized then into an over-collateralized position is P, the cost is C per block, with profits of W in a winning situation, then as long as E(C) ≤ W there is a winning strategy that includes buying all blocks until E(C) ≥ W.

E(C) = Cost per block * (discounting factor^i) * P(profit after i blocks); Summed from 1 to infinity.

Cost per block will always be relatively constant.

The constraint of how large W can be is directly proportional (in an exponential-like fashion) to P.

If the cost per block is 2.3 ETH (As discussed before) and the borrower has borrowed 50M USD worth of some asset, that is a cost of 0.00184% per block (at 400$/ETH). For Ethereum, thats 10.5984%/day. For a 500M borrow, thats just 1%/day. That is not a huge cost for such a devastating attack to the dApp.

Looking At Collateral:

The collateral on a borrow will be: (1 + X) * value of borrowed asset

If the volatility of the borrowed asset is high relative to X the change of success can be worth the risk.

Say we are borrowing asset A for asset B and the expected volatility is V% per day (drawn from a normal distribution) while the standard deviation is SD% per day.

We are trying to find the probability that the loan becomes under-collateralized: Z = (X - V)/SD, convert that to your z-table. P depends directly on X, V and SD. V and SD are market driven, so dApp creators and lenders do not have control, their only control is X.

I will end here without an analysis on why picking any sufficient X to keep lenders happy will likely leave all borrowers unhappy and X low enough to keep borrowers happy will leave lenders unhappy when they lose their money. In my opinion, which we’ll leave to another full article, decentralized lending will have difficulty competing with fully fledged centralized prime brokers.