Decentralized Loans: Is Under-collateralization Possible?

Keir Finlow-Bates
5 min readSep 14, 2023

When I first learned Solidity, after grasping the basics and writing a few simple smart contracts, my first significant learning experience involved trawling through the constellation of code libraries that make up Aave, the decentralized crypto-lending platform.

Side note: I do not recommend this approach to beginners unless you are a stubborn person with a masochistic streak. In hindsight, I would not choose it again, although it was a learning experience.

I found DeFi lending fascinating. Still do.

In traditional lending, unsecured loans and loans that are only partially collateralized — backed by nothing or perhaps some other asset that does not cover the total amount — can be issued based on an assessment of the borrower’s creditworthiness. In short, it helps if you know who you are lending to.

In DeFi, it is more complex. With anonymity and the ability to spin up a blockchain address in seconds on a chain such as Ethereum, you are lending blind. Add to that the dramatic volatility of cryptocurrencies and digital assets such as NFTs, and as a lender, you are in a bind.

Before Charles over at Resonance Security introduced me to Dmitry and Vlad, the founders of Primex Finance, I thought there were only two ways to manage anonymous loans on a blockchain:

  • over-collateralization, and
  • flash loans

Charles had his team audit some of the Primex code and thought I would be interested in the project. Clearly, he knows me well!

Over-collateralized loans

Over-collateralization is when you must deposit something worth more than the loan’s value as a second asset. For example, to borrow 100 USDC, you might have to deposit 150 dollars worth of ETH. In decentralized over-collateralized lending protocols, this is supposed to provide enough of a window for the collateral to be sold off to cover the loan if the value of the collateral starts to plummet, and there are incentives for people to monitor the market prices and trigger liquidation if those prices shift downwards too much.

Midjourney may have solved hands, but it hasn’t solved trombones…

You can think of this as the equivalent of a pawnbroker being allowed to sell the antique trombone you pawned if (and only if) the market for antique trombones suddenly starts crashing.

Flash loans

A flash loan is taken out during an atomic transaction in which you receive the funds, use them for some purpose, and then repay the loan (plus any fees) all in one. If any part of the transaction doesn’t work, then the whole transaction fails.

This is the blockchain equivalent of someone saying: “Can I borrow your pen for a second — I’ll give it back straight away.”

A third way

As a former test engineer, inventor, and staunch fallibilist, I would never bet on there only being two ways to handle anonymous loans. However, even though I spent a few weeks considering the problem back in 2020, I couldn’t come up with another method.

But that’s exactly what Dmitry and Vlad have done, and from what I can tell they’ve achieved it by using some genuine “out of the box” thinking in the real sense of the phrase.

Suppose you take the naive approach, and look at the problem of guaranteed anonymous loans from too close up, considering only the borrower and the lender. In that case, I predict you will have a hard time coming up with a lending protocol that isn’t based on over-collateralization or a time-limited atomic transaction.

However, if you step back and ask yourself, “What might the borrower want to do with the funds they receive?” new solutions become apparent.

In Primex’s case, they considered loans solely for margin trading, which opened the box and allowed them to think outside it.

Why is lending for margin trading different?

You can read all the details and practicalities of how Primex has implemented a lending system for margin trading traders here. Still, it helps to understand the basic underlying concept:

If a trader sees what they believe is an opportunity to invest in something for a limited time and turn a significant profit, they will want to borrow funds to maximize their returns. This is known as “margin trading”.

The lender will be OK with the loan if the traded asset increases in price (or stays the same). Either way, they get to charge interest on the loan and make a relatively safe profit.

However, if the traded asset decreases in price, then there comes a point where the collateral provided by the trader only just covers the loss. In traditional trading, this results in a “margin call”, whereby the trader or the broker liquidates the position to ensure losses to the trader do not become losses to the broker or lender (or the trader has to provide further funds to move the position out of the danger zone for the lender).

Decentralizing margin calls

In the decentralized protocol provided by Primex, a variety of limit orders can be set up, positions can be managed, and most importantly, margin calls are acted on automatically. Through this mechanism, a lender can provide trading funds to a trader at a lower risk without requiring the trader to put up more funds than are lent as “collateral.”

By acting as an automatic intermediate system (this is called the Keeper Network), the Primex protocol ensures that:

  • lenders can’t liquidate the trader’s position just because they feel like it, and
  • the trader cannot continue to maintain the position if it could start to cause losses to the capital provided by the lender.

Of course, the mechanics behind this are a lot more complicated than the description I’ve provided above, but that, in a nutshell, is the idea that makes the system work.

Conclusion

I am not a trader — I tried it for a year back in 2018 or so and discovered that I simply do not have the temperament for risk-taking, and I like to be able to sleep at night. But some people seem to enjoy it.

What I find interesting is the mechanics behind it all, and in this case, it was fascinating to discover that it is possible to provide under-collateralized loans in DeFi.

Provided those loans are used for a specific, narrowly defined purpose.

In this case, to provide margin trading in a decentralized and automated manner, without lenders relying on a broker detecting that a margin call needs to be made and liquidating them on behalf of a trader to cover the losses.

All in all, it is a lovely example of how changing the scope of the problem you are looking at (either by going wide or, in this case, by going narrow) can result in a new solution — one that initially seemed impossible.

--

--

Keir Finlow-Bates
Keir Finlow-Bates

Written by Keir Finlow-Bates

I walk through the woods talking about blockchain

No responses yet