Decentralized Finance

Decentralized Finance (#DeFi): A Quick Walkthrough of the Ethereum DeFi Stack

Jun 26, 2019, 11:48AM
19 min, 44 sec READ

Here we present a comprehensive overview of the Ethereum DeFi ("decentralized finance") ecosystem of applications and protocols.

So, what's all the buzz around #DeFi these days?

Short for "decentralized finance", DeFi refers to financial products and applications mostly built on top of the Ethereum public blockchain. These dApps consist of immutable scripts, publicly available and auditable sets of instructions deployed on the machinery of the Ethereum golem (the EVM), which can be thought of as primitive conditional operations that are "carved in stone" as public infrastructure. These scripts, better known as "smart contracts", are also extendable and interoperable allowing for one application to make use of or integrate with others in an evolving ecosystem of composable services.

The advantages of such applications are that they allow anyone to build and integrate anything on top of the public blockchain and its base protocols such that, once deployed on the shared ledger, there are minimal to no costs to the businesses built on top of it, (as far as the operational work carried out by the blockchain itself is concerned), greatly minimizing the possibilities of undetected fraud, unauthorized appropriation, forgery, abuse, or human error and essentially removing the need for a traditional regulator to make sure everybody plays by the rules of the law.

DeFi is "trustless" in a human sense (i.e., no one can steal or cheat, technically), but not in a functional sense (as in when a developer deliberately booby traps his contract or dApp with malicious code or when a bug is discovered and suddenly comes to light). In place of traditional regulators, we have a nascent industry of contract code auditors and tools (e.g., OpenZeppelin, the Vyper language for more strictly articulating contract logic, etc.), best practice documentation and frameworks for smart contracts and dApp development (Truffle, Embark etc.) and so on.

Ethereum-powered DeFi dApps as curated by Concourse at defipulse.com. List is expected to soon expand to include other protocol innovations gaining momentum, such as the dY/dX derivatives protocol and others. 

While somewhat primitive, clunky and simple, especially in comparison to the levels of second-splitting speeds of trade, highly abstract forms of mathematical refinement and resource intensive computational complexity that characterize modern finance these days, DeFi is largely driven by community enthusiasm among those who have an affinity for tinkering to see what could be done given what is already available. An analogy with the open-source software movement could perhaps be made -- what is at first cumbersome, messy, often more than a little half-assed, a pain to set up and even more so to learn to work with may slowly throughout the years become the de facto standard of how we do things.

Although still rather rudimentary, DeFi provides an entry into a different stack of open financial applications that could spare the tedious and expensive processes of government bureaucracy and paperwork in many instances while simultaneously providing a set of useful, unpretentious public services and algorithmically automated procedures. Below we'll overview some of the more popular such applications from Ethereum's DeFi stack, as included in defipulse.com (where the selection criteria emphasize "decentralized"). 

 

Decentralized Lending: Maker, Compound, Dharma, InstaDapp, dY/dX.

Lending protocols seem to be the leading category of applications, allowing crypto holders to lend their holdings, earning passive income through the interest fees paid by borrowers. The dominant use-case for borrowing crypto seems to be margin trading. Margin trading involves borrowing to get leverage, such that traders multiply their gains (or losses), as well as short-selling - a trading strategy which makes profits when the price of an asset depreciates.

MakerDAO, which we covered previously, is the decentralized credit platform on Ethereum that supports and manages Dai (also one of the oldest Ethereum dApps and DAOs, alongside other Ethereum household trademarks like Augur). Dai is the least controversial and most transparent stablecoin whose issuance and peg to the US dollar are driven by Collateralized Debt Positions (CDPs, contracts that lock one's ETH in exchange for an amount of Dai for up to a certain percent of the value of the ETH staked, since Dai need always be overcollateralized for obvious reasons) and maintaining system parameters within an accepted range in regards to market dynamics, forces of supply and demand, volatility and price fluctuations. In that respect, Maker can be thought of also as a kind of a nascent volatility insurance platform and a prediction market focused on protection against a handful of specific types of events.

Compound Finance is a somewhat similar protocol that acts as a money market and lets holders earn interest on supplied assets or borrow assets against collateral. How much users can borrow on their collateral is usually fixed at 66% and the interest they can earn on their assets is adjusted automatically based on supply and demand. Needless to say, as somebody's debt or CDP becomes undercollateralized or drops below a certain threshold it gets liquidated. Compound has no native token itself, but Maker's DAO uses the MKR token for governance and voting on system parameters (such as risk, stability fee, proposals, types of collateral accepted, etc.) 

Dharma, lastly, is a protocol for tokenized peer-to-peer debt assets that also allows for uncollateralized loans through underwriters, trusted entities who originate loans, assess creditworthiness, and service debt. Dharma allows for borrowing and lending ETH and/or Dai for up to 90-day terms at competitive rates. It uses relayers similar to 0x.

dY/dX, a protocol for decentralized margin trading and derivatives, is said to also be added soon. 

 

MakerDAO: MKR, Dai, CDPs, and Ethereum's Central Bank DAO

Maker's CDP portal and interface for opening up a CDP on one's ETH in order to generate Dai is found at cdp.makerdao.com. It's fairly straightforward, requiring that one fill in the amount of ETH they wish to collateralize against the amount of Dai generated. Based on these inputs, the system automatically generates an estimate for the liquidation price of the CDP (the lowest market price the staked collateral can reach before becoming vulnerable to liquidation), the collateralization ratio (between staked deposit and generated Dai) in percent, stability fee paid, etc. Alternatively, the interface at settle.finance/os allows for opening up a CDP, locking the ETH in it and generating the Dai in a single transaction.

The stability fee incurred compensates for a few categories of risk associated with managing the system by MKR token holders, who make sure Dai supply is balanced with its market demand, among other things (stability fee is shown in % on MKR per year). A list of active CDPs is available at mkr.tools/cdps/funded. Once a user opens a CDP, he's responsible for monitoring it's status and health, making sure it doesn't get liquidated. 

The Maker system is developed with the intention of diversifying the range of assets one could lock up in a CDP (e.g., tokenized gold such as DGX, Augur's REP token in certain circumstances, etc.) for Dai or other stablecoins pegged to the values of other useful measures (as it had been initially proposed for Dai to be pegged to IMF's SDR currency basket instead of the US dollar, for example), but single-collateral Dai (SCD) as ETH/PETH/WETH ("Pooled ETH"/"Wrapped ETH") is the only available option right now. More details about the introduction of multi-collateral Dai (MCD) and the leveraging one's assets for an amount of Dai on the staked collateral can be found here.

Other available tools and system web interfaces (not including command-line tools) are makerscan.io (system explorer), mkr.tools (overall system status, parameters, metrics and stats, visualizations and historical records) and dai.makerdao.com (dashboard and control interface for the Ethereum address presently connected to MetaMask - operations such as wrapping and unwrapping ETH, converting WETH to Dai and vice versa, opening and managing CDPs, etc.).

The interest rate, or so-called stability fee on MakerDAO, has recently been fairly volatile, increasing from 2.5% to 19.5% in a little over a month.

The MakerDAO public RocketChat is accessible here

Github repository, here

Compound Finance: Ethereum Money Market

Compound is an autonomous, transparent money market on Ethereum that works in a similar fashion but without the DAO-related Fed-like functions and responsibilities. Instead, Compound offers one the opportunity to borrow on their staked collateral and/or earn interest on supplying assets and based on their demand at the time. (Interest rates are fluid and fluctuating based on supply and demand, paid on a block per block basis.) And rather than a DAO, it is Compound Labs, Inc., the protocol developer who currently controls the Ethereum address associated as the protocol admin. The admin has the right to support additional assets, suspend assets, upgrade the price feed oracle, upgrade the interest rate models, and withdraw sponsor equity. Eventually, the intention is to replace the admin with a community-driven DAO. 

Presently, among available assets for staking in the system, there's support for BAT, REP, and ZRX in addition to the base (WETH, Dai). How it works is one supplies asset to the Compound Protocol and gets cTokens in return, which represent one's balance in the protocol on the basis of which interest is earned. How much tokens one receives depends on various collateral factors (quality, liquidity, etc.)

The Compound native app is accessible at app.compound.finance with MetaMask on and unlocked. There's also another web interface available at presidio.compound.finance.

A liquidation dashboard of accounts and their current state, liquidity, and ratio of supplied vs. borrowed assets provides real-time information here

A quick Medium FAQ and Compound v2 details found here and here respectively. 

The Compound public Discord is accessible from here.

The white paper is available here.

Github repository found here.

Dharma Protocol: Tokenized Peer-to-peer Debt Assets

 

Dharma is an Ethereum protocol for tokenized peer-to-peer debt assets that connects borrowers with lenders. It offers loans for up to 90 days in ETH, Dai, and USDC. Unlike the previously mentioned protocols, however, Dharma makes use of relayers to aggregate and match orders and also allows for uncollateralized debts through underwriters. Underwriters serve as trusted third parties that stake their reputation in negotiating the terms of the loan with the borrower, evaluate and decide on borrower risk ratings and oversee loan issuance and repayment. The reputation system in Dharma is an empirical signal or a social cue of how much one can trust an underwriter, i.e., it's a decentralized credit market with a loose notion of reputation.

Relayer debt order books and underwriters together constitute the fundamentals of the Dharma protocol. Borrowers can use Dharma to either get leverage or to access working capital while lenders earn a fixed interest rate of return on the assets they lend.  

Dharma analytics dashboard provided here.

Dharma FAQ here

Github repository - here.

InstaDapp: MakerLite

Most recently InstaDapp was also added in the list. InstaDapp provides a more intuitive interface as an overlay of the MakerDAO protocol, such that it's optimized for users lacking more advanced technical or financial experience, allowing for keeping track of CDPs via email or Telegram notifications and perform various bundled operations in single transactions, saving gas. The platform also integrates Uniswap and Kyber, letting users manage their Uniswap liquidity pools. The team plans to add integration with other protocols and additional features, driving DeFi mainstream adoption.

 

dYdX: Margin Trading

dYdX supports trading on margin with up to 4x leverage through custom, non-tokenized, positions. It enables borrowing and lending with no minimums or lock-up periods. While margin trading on dYdX, funds are automatically borrowed from lenders on the platform.

Derivatives: Augur, Veil

Strictly speaking, things like dY/dX, Synthetix and WBTC should also be considered in the category of derivatives, but since their protocols also involve other kinds of logic and intended applications, only Augur and its overlay dApp Veil have been listed as "derivatives". The subject of Augur prediction markets and event derivative contingent claims, as well as Augur protocol overlays, have been more extensively covered in previous articles

Veil, however, has recently forked the Augur smart contracts in its own slimmed-down version of AugurLite. AugurLite is is a copy of the Augur smart contracts with large pieces of functionality removed for simplicity - it has no exchange contracts, no token, and no oracle. Instead of the Augur oracle and REP, Veil uses indisputable oracles (i.e. a single address that can resolve the market once it expires) in its AugurLite implementation. The main reason for this move is said to be the launch of Augur v2.0 later this year and users being discouraged from creating markets on the current version of Augur that may expire after Augur v2 launches. And since long-running political markets and particularly the ones centered around the upcoming 2020 US presidential election are heavily requested on the platform, this temporary fix was suggested for the time being.

Decentralized Exchange: Uniswap, Kyber, Bancor

The decentralized exchange between assets in the Ethereum ecosystem takes place via a few mechanisms that a handful of popular dApps incorporate. They provide another means for earning fees on the assets one holds by supplying liquidity. Uniswap and Kyber use similar mechanisms for on-chain token exchange, while Bancor implements are a more complex system of executing instant trades between a number of provided Ethereum assets. 

Uniswap

Uniswap is a fully decentralized on-chain protocol for token exchange on Ethereum that uses liquidity pools instead of order books. Anyone can quickly swap between ETH and any ERC20 token or earn fees by supplying any amount of liquidity. And anyone can create a market (i.e., liquidity pool) by supplying an equal value of ETH and an ERC20 token.

Kyber Network and KyberSwap

Kyber Network is another on-chain liquidity protocol allowing token holders to contribute liquidity ("reserves"). It offers multiple types of reserves, each existing as a smart contract controlled by whoever deployed it. For instance, Kyber Network maintains its own reserve.

Kyber doesn’t use order books but returns the best available price across all reserves. The most common way of accessing the Kyber Network is through KyberSwap, a decentralized exchange dApp that uses on-chain matching to instantly swap tokens.

KyberSwap web interface.

Kyber employs its native KNC token, which reserve managers are required to stake and use to pay fees (upon the execution of trades) for the right to operate reserves on the decentralized exchange platform. A common tokenomic mechanism in Ethereum dApps and platforms intended to pay for the maintenance and further development of the platform and its role as an Ethereum service provider. 

Bancor Protocol: Token Swaps and Cross-Chain Exchanges 

Taking its name from the supranational currency proposed by John Maynard Keynes after World War 2, one to be used in international trade as a unit of account within a multilateral clearing system, Bancor is a familiar Ethereum household name that gained popularity with its record-breaking ICO in 2017. Bancor is essentially a non-custodial token exchange protocol that uses pooled liquidity and an algorithmic market-making mechanism via a more complex "smart tokens" mechanism.

The Bancor exchange interface.

The platform's native token, BNT, serves as a smart token hub connecting all other tokens in the network, thereby enabling instant trades among any of the supported assets. Bancor charges no fees itself, although the complexity of its operational logic may incur higher than usual gas usage. Bancor also supports cross-chain conversions and exchange (e.g., an ERC-20 for an EOS), using the BNT token as an intermediate (e.g., REP for Dai goes through the hops of REP for BNT, then BNT for Dai). 

A more detailed description of how liquidity tokens (and Bancor in particular) work is available in this post.

Assets, Stablecoins, and Payments: WBTC, xDai, Synthetix, Lightning Network

We've written previously about WBTC (Wrapped Bitcoin, or a DAO-managed representation of Bitcoin on Ethereum) and its workings, so we'll jump directly into xDai and Synthetix. Bitcoin's Lightning Network is also included in the curated list, the only non-Ethereum exception. Lightning Network, as is widely known, is a second layer Bitcoin protocol running as a network of interconnected payment channels for facilitating micro-transactions that only get finalized on the canonical chain. The defipulse stats show the total amount of BTC locked in that second layer, the amount of BTC, the denomination in USD, and the percentage of the total supply.

XDai: Sidechain facilitating more cost-efficient Dai transactions 

The xDai chain is a separate Ethereum sidechain hosting xDai, a form of Dai that was developed through a partnership between POA Network (focused on developing cheap, fast and scalable products on the Ethereum protocol) and MakerDAO. It runs as a PoA ("Proof of Autonomy") chain in which the validators that manage the chain run as a DAO of relevant and involved agencies, instead of a centralized authority. Some advantages of xDai over regular Dai are 5-second block times (thus, speed) and low gas prices (fixed at 1 Gwei) - properties necessary for many potential applications of the stablecoin (especially financial ones). 

xDai is a massively cheaper and faster form of Dai on Ethereum, one satisfying a wide range of applications where rapid confirmation times and negligent transaction fees are necessary.

XDai represents Dai in 1:1 (which is in turn soft-pegged to the US dollar) and the two are converted back and forth via POA Network’s TokenBridge, which connects the Ethereum mainchain and the xDai sidechain. Interaction with xDai requires that one switch from the Ethereum mainnet to the xDai network and applications using xDai, therefore, do so on the sidechain. An example of an application already using xDai is the Helena prediction market.

XDai validators. XDai runs as a Proof of Autonomy sidechain, validating blocks every 5 seconds. The sidechain is run as a DAO of public notaries as validators and a bridge dApp converts Dai to xDai and vice versa. 

The operational parameters and performance of the xDai sidechain are managed by a DAO consortium of expert entities and relevant involved parties which guarantee the legitimacy and transparency of the service. Among these are Maker itself and POA

The endpoint to switch to in order to use xDai.

An xDai chain explorer and monitoring interface is available here.

The POA Network Github repository is available here.

A list of resources for starting to develop on xDai is found here.

Synthetix: Synthetic Assets on the Blockchain

Originally conceived as a mechanism for an USD-pegged stablecoin, Synthetix (formerly Havven) has gone to further develop into a more generalized platform for minting and exchange of on-chain synthetic assets on Ethereum. Synthetic assets are tokens that track the value of specific real-world assets such as fiat currencies, commodities (e.g., gold), and other crypto assets (with stocks, indices, and other derivatives expected to be incrementally added along the way).

The system operates following already familiar contract mechanisms. SNX is the platform's native token which is used as collateral (overcollateralized by five times the total value of assets in return) for minting synthetic assets against (ERC-20 tokens marked with lowercase "s"). The list of available units fixed to the denominated value of assets include pairs with sEUR, sJPY, sUSD, sAUD, sKRW, sGBP, sCHF, sCNY, sRUB, sBTC, etc. ChainLink is used as the oracle for obtaining the price feeds for the assets. 

Synthetix.exchange is the non-custodial DEX for trading synthetic assets and all trades generate small fees which are distributed to SNX holders as rewards for staking in the system. The fees help to maintain a healthy collateralization ratio and reinforce a feedback loop where the value of the SNX token grows proportionate to network usage and adoption so that the pool of available staked SNX tokens always sizes up to accommodate current demand.

The dApp for minting and burning of assets as well as for collecting fees from the network is available at mintr.synthetix.io. A dashboard is provided at dashboard.synthetix.io. Additionally, swappr is a DEX for buying sUSD directly with ETH.

The public Discord is accessible through here and the official Twitter account is @synthetix_io.

Also, official blog and white paper

Considerations, Thoughts, and Conclusions

It must be remembered that the 2008 financial crisis was also largely the consequence of a failure of organizational complexity, of failure to efficiently manage the exploding complexity of financial products and derivatives to the point where common sense rules and economic rationality led to coordination towards disaster. Since dealing with highly abstract forms of financial capital, such that they basically borrow from the future in the present, critically approximating future certainties and hedging risk plays a central role in today's world. 

While Ethereum builds a parallel infrastructure to the one in place, but one secured by massively replicated determinism of a canonical ledger reproduced across all nodes, the latter doesn't constitute complexity, let alone capacity for accommodating or managing it. Instead, it forms an infrastructure which in many ways seems like a Rube Goldberg machine of synchronizing simple arithmetic across an entire world to have the entire network verify the execution. After all, a decentralized vending machine for giving back change in chosen denominations hardly classifies as financial engineering or financial technology in the 21st century sense of the word.

Rube Goldberg. Professor Butts and the Self-Operating Napkin (1931)

The compartmentalization via Plasma sidechains marked a major step towards sophistication in Ethereum (since complexity means many different parts integrated in a working whole that is "more than the sum of its parts" rather than the massively synchronized repetition of the same) and developments such as private sidechains for hybrid public-private mainchain interoperability are already taking place. 

 

 

 

MakerDAO's role as the "central bank" or an "IMF" of Ethereum and as a potential volatility insurance platform specializing in handling all kinds of possible risk is conceptually and theoretically a "big deal", but it's worth just mentioning that MakerDAO themselves run a reference implementation in the functionally-oriented Haskell. It's difficult to imagine conservative and risk-averse institutions such as banks using something like Solidity for building their applications. And still, the necessary ingredient of public confidence and trust is necessary, as well as value entering and being secured within the system and mechanisms for integrating economic and financial variables which introduce dimensions of uncorrelated (to the overall crypto market, i.e. Bitcoin and other, by traditional criteria, toxic assets) stability to the system. 

And while the high overcollateralization mechanism may not be very capital efficient at the time being (and the notion of creditworthiness being rather loose), DeFi's value proposition should be seen as an attempt to create a financial system that isn't so tightly coupled with our existing political systems and is transparent by default. 

Links and Resources

DefiPulse.com, the Coinmarketcap of Ethereum DeFi dApps, by Concourse.

Settle.finance is a web-native operating system for decentralized finance (also developed by Concourse) integrating many of the DeFi protocols and dApps and designed to let traders use the capabilities of the new financial paradigm with ease.

DefiPrime.com, a curated list of DeFi apps.

DefiTracker.io is another web interface for monitoring DeFi related metrics associated with an Ethereum address.

Disclaimer: information contained herein is provided without considering your personal circumstances, therefore should not be construed as financial advice, investment recommendation or an offer of, or solicitation for, any transactions in cryptocurrencies.