How does Decentralized Finance Work?

How decentralized finance (DeFi) is shaking up financial services.

A lack of trust in technology
It takes the place of the trusted third party
Smart contract risk
Liquidity Provider

A primer for traditional finance

DeFi (Decentralized Finance) is a buzzword that anyone who has read about Web3 will have come across. But it can also be a tricky concept to get your head around. This is because many of the services that DeFi deals with – traditional financial services – are already pretty complex and abstract.

Financial services is a term used for the investment, lending, and management of money and assets.

For most people, that begins and ends with their bank – the bank looks after your money, you might get loans or mortgages from them, and you may make investments through them too.

There is one main utility provided by banks, and other providers of financial services: trust.

You put your money in a bank because you trust their ability to look after it better than you can yourself. You also are putting trust into a legal system that will uphold your rights if that money is not looked after according to the bank’s contractual obligations.

The problem with traditional finance

People use financial services providers (let’s just call them ‘banks’, though they aren’t all banks) because they need someone to trust with their money. Traditionally, that means the bank must be a centralized entity – an institution governed by a group of people with complete executive control of its operations.

This is because for most of history, the only way to ensure trust was to enter into a contract between two legal entities. When you open a bank account, that’s what you do. You enter into a contract with HSBC or Bank of America or whichever other institution you choose.

The problem with this system is that it puts an incredible amount of power and money into the hands of the centralized entities that govern our financial system. All the transactions made through centralized banks are set up to allow the bank to take a small slice of the pie.

Many individuals would prefer to engage in financial processes – borrowing, lending, investing – in a way that didn’t force them to allow these institutions to take a slice of their money.

This is the problem that DeFi sets out to solve, by replacing the need for trusted central bodies in financial transactions with a trustless system built on the blockchain.

Smart contracts

Most of us use traditional contracts with trusted bodies for managing our finances. You need a name like Citibank or Wells Fargo on the other side of the contract to ensure that you know who is responsible when something doesn’t go right with your money.

The cornerstone of DeFi’s ambition is to replace centralized entities with a technology called ‘smart contracts’.

In a sense, smart contracts are very simple. The difference between a smart contract and a traditional contract is that a smart contract is enforced by a computer code on a machine, whereas a traditional contract is enforced by government power.

The only thing compelling someone to honor a traditional contract is the knowledge that the law could intervene. In a smart contract, the terms are self-executing, with the machine being programmed – visibly, and indisputably – to fulfil its side of the agreement.

How smart contracts are enforced

So, why aren’t we all managing our money with smart contracts, and instead making traditional contracts with centralized banks who take much of our capital gains for themselves?

The answer, once again, is trust. For most of the history of computing, it hasn’t been possible to ensure an incorruptible machine with which to make your smart contract. Therefore you couldn’t be certain that your side of the deal would be paid out, unless there was some legal entity willing to put their name on the other side of the contract.

However, in a world where blockchains exist – meaning a trustworthy, impossible-to-tamper-with ledger of information – it becomes possible to create smart contracts that people can trust without the need for a trusted authority backing them up.

For example, say that you wanted to purchase insurance against rain. Currently, you would purchase this through a company, and after it rains on the agreed-upon date, you’d file a claim to the insurance company documenting the rain. To actually claim your money, you’d need legal proof of rain, and probably weeks of bureaucracy, while the company went through its own protocols for verifying your claim.

It’s now possible to program a smart contract to point to an “oracle” – an agreed-upon source of information – and write that “if RAIN in AUSTIN on DATE, PAY me AMOUNT.” Assuming this oracle is independent and honest, the moment rain occurs in Austin on January 1st, money appears in my crypto wallet.

How Blockchain enables DeFi

Blockchain, in its simplest form, allows for a totally transparent ledger of information, that all parties can refer to and no party can change.

This is the perfect forum for true smart contracts to exist in. People wanting to access financial services can do so directly by making contracts with one another, and those contracts can be automated.

Imagine you wanted to lend out some money at a 4% annual interest rate. Many would be interested in doing this, but they aren’t going to spend the money on lawyers to draw up contracts, ratings agencies to establish the creditworthiness of their borrowers, etc. So traditionally, you’d lend that money through a broker – buying government bond perhaps – and in so doing, you’d have to let that broker take a cut.

With a smart contract, you could guarantee all the same assurances as a broker, and that your money will be paid out. Both the borrower and the lender would benefit in this scenario, as all the traditional middlemen have been taken out.

Blockchain enables this because it takes the place of the trusted third party. Both parties in the agreement can see the smart contract – which is public, readable and auditable – and know that it can’t be changed.

Collateral in smart loans

Currently, when borrowing or lending money, the borrowers typically put up collateral to secure the loan. When asking for a major loan, for example of $50,000, a bank might ask that you put your house up as collateral. This means that if you don’t pay them back within a reasonable stretch of time, they will take your house. This protects the lender and gives them a guarantee of repayment.

”DeFi

However, currently, even if a borrower is struggling to pay back a loan, it is hard for the lender to claim the collateral. Typically, collateral needs to be collected through extensive legal action, which can be long and arduous.

The nature of smart contracts is that they are self-executing, meaning that once the contract has been agreed, the borrower isn’t going to be able to withhold their collateral if the terms are not met. In fact, if the value of the loan exceeds the value of the asset, the smart contract can automatically “liquidate” the asset, simultaneously selling it and paying off the loan.

This is a significant advantage for anyone wanting to engage in borrowing or lending money – it is a safer bet for the lender, and that can often translate to lower prices for the borrower, since the costs of lawyers to create the contract, and accountants to audit the collateral, goes down.

Smart contracts and insurance

Another financial industry where decentralized finance can be useful is when it comes to insurance. The principle of insurance is that people pay a flat fee so that if a disaster strikes, for example them crashing their car, they will get a payout to compensate for their loss. Fundamentally, insurance is a way of counter-balancing risk.

However, a significant issue with current contractual insurance is that claiming a payout can take time. Typically, you have to make a claim using a complicated form, which will then take time. Plus, insurance companies sometimes use that time to try to wriggle out of paying the claim through contractual loopholes.

With smart contracts relating to insurance, theoretically both sides can trust that the payout will be triggered when the specific conditions are met. This is particularly true when something can be easily verified by a computer.

In theory, as a result of smart contracts, it is not up to either side to decide whether a payout is appropriate. Moreover, there should be no room for disputes or ambiguity because it occurs automatically. In practice, the integration of real-world information to the blockchain via price oracles is limited, but over time as this data increases, the type and complexity of smart contracts will as well.

Applications in DeFi

So far, we’ve covered some of the major principles of theory behind decentralized finance. But how does one access it? If I wanted to get involved with DeFi, how would I go about doing it?

Well, currently, decentralized finance is largely accessed through apps which let you buy/sell/swap crypto tokens and invest/lend money. At the moment, many apps in decentralized finance model existing financial institutions like banks, exchanges, or even casinos. However, as Web3 develops and users understand its potential, applications will develop further, eventually including the integration of real-world assets like real estate.

However, the technology behind decentralized finance applications is not fully developed yet, so it isn’t fully reliable. Sometimes there can be bugs in the code or vulnerabilities to scammers because the technology is so new.

As a result, it is important to make sure that the decentralized finance application has been audited and thoroughly tested before trusting it with significant sums of money. Although every investment carries risk, the unique risk associated with contract vulnerabilities is called ‘smart contract risk’ and in some cases, may result in the complete and total loss of assets ‘locked’ in the contract.

Staking - locking up assets to earn yield

There are many different ways you can invest in DeFi, but one of the first that you’ll come across is ‘staking.’ Think of this as locking up an asset for a particular amount of time, often called an ‘epoch,’ and being rewarded with some amount of yield. The simplest form of staking is in the validation of the blockchain itself.

For ‘Proof of Stake’ (PoS) blockchains, a group of people choose to be validators by staking, or locking up, a certain quantity of assets to have the right to implement the chain’s consensus mechanisms, validate the authenticity of new transactions, and package those transactions into a new block to be added to the blockchain.

Since this is a very important job that ensures the integrity of the chain, the staked funds act as an assurance that the validator will act in good faith. If they do this correctly, they’re rewarded. If the validator attempts to cheat or violates the validation rules, their stake is ‘slashed’ and they lose part of their capital as a punishment. This provides an incentive mechanism for proper validation of the blockchain.

Traditional liquidity

Liquidity may be one of the most important but taken-for-granted parts of our economy. Let’s take, for example, buying or selling a car. We all take it for granted that if we have money and want to buy a car, or have a car and want money, we’re able to make that happen, usually through a car dealer.

In this example, the car dealer provides liquidity to the car market. He or she has a pile of cash and a bunch of cars and is willing to buy cars or sell cars at certain prices. This ensures that your average consumer always has a liquid market between cars and money to be able to transact.

In the traditional financial system (TradFi), this happens through market makers. These are generally large financial firms willing to take either side of a trade at any given time to ensure that your average consumer can buy or sell their Apple or Tesla stock when they want. In exchange, the market maker may take a fee for providing this service.

Liquidity in DeFi

In DeFi, liquidity is handled a bit differently. In order to trade two tokens, for example USDC and ETH, there needs to be a ‘car dealer’ willing to have some of each to enable people to swap. Rather than a single large player like in TradFi, DeFi smart contracts enable anyone to lock up these two assets in a ‘liquidity pool’ and become a ‘liquidity provider’ or LP. As other users swap these assets, they’re deducted automatically from the liquidity pool and the LP takes transaction fees in exchange for providing liquidity.

Of course, this construct means that the pool that may have started with equal amounts of each asset quickly becomes out of balance. As a result, the price of the assets adjusts to compensate for demand. Although being an LP may be lucrative, there are also risks associated with the price movement of the underlying assets called ‘impermanent loss’ that are complex and should not be underestimated. As with any DeFi interaction, smart contract risk exists as well.

Yield farming - chasing LP yield and incentive programs

With thousands of crypto tokens in circulation and a limited amount of capital in DeFi, there are small cap tokens that unfortunately do not have any ‘car dealers’ with inventory, making it virtually impossible to buy or sell those assets. To combat this problem, many tokens have their own incentive programs to encourage people to provide liquidity for that asset. In some cases, this comes in the form of free tokens as an ‘airdrop’ to users willing to LP. Together, these rewards are stacked on the transaction fees earned by LPs to increase the overall yield of an LP position.

Yield farming, therefore, is the act of earning returns in exchange for locking up assets in an LP position. Several services, including Yearn Finance, offer a continually-updating list of yield farming opportunities for users to choose from. These often combine LP positions and staking to offer users high returns in exchange for the most efficient use of their capital.

Layer one vs layer two

Bitcoin and Ethereum were designed quite a while ago with a focus on decentralization and security. As a result of the complex operations involved in running their blockchains, Bitcoin could only process about 7 transactions per second (TPS) and Ethereum wasn’t much better at about 15 TPS. As the blockchain grew in popularity, these limits were quickly reached, resulting in network congestion and high transaction (e.g. ‘gas’) fees.

Several other blockchains have tried to solve this, most notably Solana. Ethereum has also drastically improved its transaction rate. However, these blockchains follow an older technology called ‘Layer One’, that effectively caps the speed that they could ever reach.

Newer blockchains have been developed called ‘Layer Two’ blockchains that set out to solve this. They are actually built on top of existing blockchains like Ethereum.

Think of L2 blockchains as the equivalent of skyscrapers. Although there is a finite amount of physical land in Manhattan, theoretically skyscrapers can scale infinitely tall, massively increasing the number of people that can live on a small piece of land. The most notable L2 blockchains are the Lightning Network and Polygon.

Uses of DeFi

One of the reasons why DeFi is used is because it avoids government oversight and regulation. While decentralized finance is not fully anonymous – you can still see which computers are involved in a transaction – you don’t need to share your full personal details. This differs from existing systems for opening a bank account and taking out a loan, which normally requires giving all of your personal information to the financial institution.

One benefit of this is that borrowers with poor credit histories or who prefer privacy are able to use decentralized finance. As a result, lenders have been reluctant to provide ‘undercollateralized credit,’ or in other words, any loan that isn’t backed by at least that amount of underlying assets. By ‘overcollateralizing’ loans, the lender ensures that if the collateral’s value declines, they’re able to liquidate (i.e. sell) that asset to pay off the loan.

Another advantage of decentralized finance is that it largely avoids human error, since humans make mistakes! Whereas normal contracts can be open to subjective legal interpretation, the automatic conditions of smart contracts provide clarity and reliability to relationships.

Can people ever trust DeFi?

When it comes to any financial system, there is one key feature upon which all success is predicated: trust. If people don’t trust that their money is safe in a financial system, it will never be able to successfully take off. This is one problem that people have identified with DeFi.

Even though the Blockchain is largely associated with reliability by experts in computer science, a big question with DeFi is whether ordinary consumers will be able to get onboard with it. Will they be able to understand the fact that their money can’t just be “hacked”?

When it comes to existing banks like Barclays, HSBC and Santander, people trust that their money is safe because of the fame associated with the brand. They have heard of these companies before and can visit their physical branches to speak to staff. However, with DeFi, there is no centralized authority. That means there is nobody to abdicate responsibility to. There is nobody to blame when things go wrong. And, perhaps most importantly, there is nobody to bail you out if you fall victim to a scam.

For all these reasons, there remains skepticism amongst some analysts about whether DeFi is ever going to take off.

You might also like

Redefining Communities;

How DAOs may radically reshape all forms of human organization.

Introduction to Web3;

An introduction to the wild world of Web3

What is Web3?;

A fad or the next technological revolution?

What’s a blockchain?;

An overview of the technology that makes everything in Web3 possible.

Cryptocurrency;

Crypto doesn’t have to be cryptic. An explanation of how cryptocurrencies work, starting with the first principles of economics

Security in Web3;

Blockchains are very secure - but there are weaknesses that have been exploited.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scan to download