#2 Decentralized Finance Explained
Recently, I started a decentralized finance explanation to assist many that wish to factor out what DeFi sector is all about. On estimate, over 2,800 crypto-assets were listed on exchanges as of September 2019 and the listing keeps growing as ew crypto-assets keeps invading the crypto ecosystem. From the study of some of the tokens, most of them are economically irrelevant and have a negligible market cap and trading volume, there surely is a need for marketplaces where people can trade the more popular ones. This allows them to rebalance their exposure in accordance with their preferences and risk profiles and to adjust portfolio allocations.
Trades in crypto space in most cases are conducted through centralized exchanges which are relatively efficient but they have one severe problem. In order to be able to trade on a centralized exchange, traders must first deposit assets with the exchange which forfeit direct access to their assets and have to trust the exchange operator. Dishonest or unprofessional exchange operators may confiscate or lose their assets. Furthermore, centralized exchanges create a single point of attack and therefore face the constant threat of becoming the target of malicious third parties.
Decentralized Exchange Protocols
The above problems attached to a centralized exchange brought in decentralized exchange protocols to mitigate these issues by removing the trust requirement. The protocols require no deposit of funds to an exchange platform instead, users remain in exclusive control of their assets until the trade is executed. In the execution of the trade, it will happen atomically through smart contracts (both sides of the trade are performed in one divisible transaction, mitigating the counterparty credit risk).
The early decentralized exchange I stumbled upon in 2017 was Etherdelta follow by Etherfork both were set up as walled gardens with no interaction between the various implementation, while a smart contract may assume additional roles effectively which is a dependant of the exact implementation and result to many intermediaries such as escrow services and central counterparty clearing houses obsolete. Etherdelta then has no shared liquidity, which led to relatively low transaction volumes and large bid/ask spreads. High network fees as well as cumbersome and slow processes to move funds between these decentralized exchanges have rendered supposed arbitrage opportunities useless.
Now, the new decentralized exchange protocol is here which is an open exchange protocol. This is to streamline the architecture of decentralized exchanges by providing standards on how asset exchange can be conducted, and allowing any exchange that is built on top of the protocol to use shared liquidity pools and other protocol features. However, most importantly, other DeFi protocols can make use of these marketplaces and exchange or liquidate tokens when needed.
The Image below revealed the common protocol in decentralized finance
Decentralized Order Book Exchanges
There are different ways to implement a decentralized order book exchanges. They all use smart contracts for transaction settlement but they differ significantly in the way the order books are hosted. In particular, one has to distinguish between on-chain and off-chain order books.
On-chain order books have the advantage of being completely decentralized. Every order is stored within the smart contract. As such, there is no need for additional infrastructure or third-party hosts. The disadvantage of this approach is that every action requires a blockchain transaction. It, therefore, is a very expensive and slow process, for which even the declaration of the intent to trade results in-network fees. Considering that volatile markets will require frequent order cancellations, the problem becomes even more severe. For this reason, many decentralized exchange protocols rely on off-chain order books and only use the blockchain as a settlement layer (It allows the network to securely store ownership information and ensures that any of the state changes adhere to the network’s ruleset)
Off-chain order books are hosted and updated by centralized third parties, usually referred to as relayers. They provide takers with the information they need to select an order they would like to match. While this approach certainly introduces some centralized components and dependencies on the system, the relayers’ role is limited. In particular, relayers are never in control of the funds and neither match nor execute the orders. They simply provide ordered lists with quotes and may charge a fee for that service. The openness of the protocol ensures that there is a competition between the relayers and mitigates potential dependencies.
The dominant protocol that uses this approach is called 0x. The protocol uses a three-step approach for trades.
First, the maker sends a presigned order to the relayer for inclusion in the order book.
Second, a potential taker queries the relayer and selects one of the orders.
Third, the taker signs and submits the order to the contract, triggering the atomic exchange of the crypto assets.
Follow me closely on the study of a decentralized financial system.
If you miss my first article, read here
Watch out for next article on decentralized finance.