The decentralized finance (DeFi) ecosystem refers to the stablecoins, cryptocurrencies, decentralized exchanges, money markets, and other financial products and services that are created using smart contracts and live within blockchain environments.
Analyzing The Many Ways Chainlink Can Accelerate Adoption
Decentralized Finance (often referred to as DeFi) is a growing movement around recreating common financial instruments from traditional finance using decentralized back-end infrastructure. Thus, rather than needing centralized entities to facilitate the movement of financial markets, users can access, trade, and lend assets using open-source software running on decentralized networks. The result is self-running P2P financial markets based around transparency, open access, and data-driven automation.
In this article, we outline the infrastructure, products, and market dynamics that currently define the DeFi landscape. We then highlight the many ways that developers can leverage Chainlink to increase the functionality and real-world applications of their DeFi instruments.
The Current DeFi Ecosystem
“The goal of DeFi is to reconstruct the banking system for the whole world in this open, permissionless way,” says Alex Pack, managing partner at Dragonfly Capital.
The current financial system mostly revolves around government-issued currencies and large banking institutions that act as trusted third parties in between transactional relationships. Fiat currency provides stability to financial markets, while banks expand productivity by issuing credit, assuming counterparty risk, and streamlining payments. Without these two institutions providing liquidity and critical business infrastructure, the velocity of markets and the rate of innovation would be substantially slower than current rates. Unfortunately, the current design comes with certain tradeoffs. The value and flow of capital is subject to centralized powers and process inefficiencies. This leaves markets vulnerable to censorship, limits access to capital, and prolongs the life cycles of contracts.
DeFi shifts the ownership of monetary and banking infrastructure from centralized authorities to a decentralized infrastructure that is owned by the market participants. Instead of issuing money on authority and running financial networks on centralized servers, money and markets can be self-operating by users through distributed software protocols able to constantly reach reliable consensus about the state of the network, such as Avalanche, BNBChain, Ethereum, Fantom, Polkadot, Polygon, and Solana. This new infrastructure has verifiable open-source code, permissionless access to anyone in the world, and decentralized security that guarantees tamperproof execution. Not only does DeFi shift trust away from humans and replace it with code, but it has the potential for huge network effects given DeFi Dapps are globally accessible to use and build-on, and provide new trust dynamics to financial markets.
Breaking Down the DeFi Infrastructure
There are multiple components of the DeFi infrastructure, each of which is explored in more detail below.
To have a truly functional financial market, there must be a stable and universal medium to value and conduct exchange. This medium must be scarce to accurately price markets and have universal demand to maintain its value over time as a common medium of exchange. Money has long represented that medium, with Gold being one of the best historical forms. Although the U.S. dollar is considered the world reserve currency today, gold has historically been (and is predominantly still held by central banks) the reserve money of global markets, with all currencies tying their value to their exchange rate versus gold.
Blockchains have given society new forms of money based neither on physical scarcity nor central authority, but rather on mathematical software with built-in immutable digital scarcity that’s easily transactable and publicly verified through distributed consensus. Not only do cryptocurrencies fulfill transactional demand, but DeFi is showing how they can act as a permissionless store of value (PSOV). This PSOV acts like a reserve asset that can then be collateralized to create additional credit akin to modern banking (albeit much different collateralization rates). Although Bitcoin is more commonly referred to as a reserve asset like digital Gold, the DeFi ecosystem is flourishing on Ethereum and uses ETH as the dominant form of reserve collateral. This was discussed in an article written by David Hoffman entitled “Ether is the Best Model for Money the World has Ever Seen”.
Anything, both tangible and intangible, that can be owned and exchanged for value, is considered an asset. There are a variety of assets in financial markets from physical assets such as commodities (oil, electricity, food), infrastructure (real estate, machinery, trains), and exotic luxury goods (art, cars, collectibles), to non-physical assets such as patents, copyrights, and goodwill. Most assets are tracked internally by parties in the trade. They can also be tracked externally by the bank facilitating the trade and/or government agencies collecting metadata for taxes and compliance. Furthermore, top accounting firms help give valuations to many assets and authenticate that internal and external reports are aligned.
Given the lack of absolute truth in asset markets, the current design leaves a lot to be desired. By having so many contrasting and private record-keeping systems, it becomes difficult to price assets based on holistic market observations. To reconcile differing asset valuations in markets, third-party experts are often employed to evaluate differences and assign value. If not, then parties must turn to P2P negotiations, which can be subject to disagreements and information asymmetry.
Blockchains and smart contracts can change the foundation of asset ownership and valuations. Tokenization is showing how smart contracts can be used to bring every asset into the digital world by tying its ownership to a unique public/private key on the blockchain. All types of assets can be tokenized, such as the ownership rights to real estate, a fancy piece of art, or individual goods in a supply chain. Blockchains are uniquely suited to be global asset registries given their transparent recordkeeping and access to international liquidity. They can remove cross-network friction and bring transparent, market-driven valuations to assets by having all parties operate on shared, equal access systems.
Any transfer or potential transfer of value outside of direct physical barter is a financial product. Whether it’s an exchange facilitating trade, a bank issuing debt (credit, bond), or ownership to some type of claim (equity, derivatives, access), they all represent some mechanism for trading and/or speculating on assets and events. Most financial products are offered by large financial institutions like investment banks that possess substantial pools of capital and better access to resources. These banks enjoy economies of scale as they have large capital allocations to build infrastructure and collateralize markets to satisfy liquidity demands.
DeFi tokenizes assets on the blockchain and uses smart contracts to define the trading rules and user experience of financial products. The entire life-cycle of the financial smart contract (ownership, custodial, escrow, maintenance, execution, settlement) can happen with much less human intervention, if any at all. The terms that define how the product works are open-source and hardcoded into the contract as boolean logic (if x, then y). Some of the most common financial products are being recreated as DeFi Dapps, including lending, stablecoins, decentralized exchanges, and derivatives.
All financial contracts are dependent on some type of input data to execute and produce an output. Whether it’s clicking the mouse to send a payment, having market data determine a futures contract, or using current interest rates to calculate bond payouts. The quality of data is often based around reputation, whereas some companies are better than others at capturing or creating trusted and reliable data. Data value often derives from network effects, uniqueness, authority, or quality. It also comes in both raw and processed forms. Current financial products are driven by data, but usually have human intermediaries or fallback options between the data and the actual process execution.
Blockchains are designed to make secure true/false determinations based on known data that’s already stored in the blockchain (on-chain). However, prices, interest rates, and event outcomes are common datasets that originate outside a native blockchain (off-chain) and vary in value and format across different sources. This colorfulness of data makes it difficult for blockchains to produce reliable true/false determinations on it without sacrificing consensus security. Taking into account the realities of modern data and blockchain consensus, there’s a pressing need for a standard bridge between DeFi applications and all types of off-chain data. As discussed below, Chainlink is a standard, yet customizable protocol for enabling DeFi to securely and reliably connect with off-chain resources.
While the goal of DeFi is decentralization, completely removing human control and influence is impossible. In the end, it’s humans that are creating and maintaining financial automation. There are certain areas where it’s extremely difficult to automate, particularly protocol development and internal governance. There are also externalities that affect markets such as shifting politics, changing culture, and established legal systems. While Distributed Ledger Technology (DLT) does enable self-running systems governed by decentralized autonomous organizations (DAOs), these are far from perfect. The reality is that there are still centralizing forces based around unavoidable human involvement that developers must take into account and cannot simply code away.
Examining the Current Players in the DeFi Ecosystem
Understanding DeFi as an entire market depends on its definition. One popularized method for measuring DeFi is to look at all the collateral locked in DeFi applications. This metric showcases how Dapps lock up permissionless collateral (particularly ETH and DAI) to use as the basis for making loans, providing liquidity and/or security to network processes, or representing voting power in governance decisions.
However, one could argue that the entire cryptocurrency space is a form of DeFi in some form or another. Especially for permissionless forms of money like Bitcoin, Ethereum and others, which represent value and help determine price.
Let’s explore some of the most used DeFi Dapps today to get a better idea of how and why these applications are built.
Currently, the most popular DeFi application is MakerDAO, a decentralized lending platform that creates and issues credit in the form of DAI (a stablecoin pegged to 1USD) and manages the loan process through a decentralized autonomous organization (made up of users that hold its governance token MKR). In traditional banking, banks are generally allowed to make loans as long as they maintain a certain reserve ratio, which is 10% in the U.S. for banks with over $124M on deposit. Disregarding legal nuances to the requirement, the bank needs to hold 10% of their deposits in reserve, but can loan out the rest.
MakerDAO has a similar model, but the process is decentralized and contains a much different reserve ratio. In MakerDAO, users stake their ETH in a smart contract that’s used as collateral to create loans for themselves in the form of DAI. The collateralization is currently set at around 150%, so users receive 2/3’s of the value they lockup. For example, if someone locks up 90 , 000 w o r t h o f E T H , t h e y r e c e i v e a 60,000 loan in the form of DAI. In this model, loans are over-collateralized as opposed to traditional banking, where loans are under-collateralized via fractional reserve banking.
It’s important to note that Multi-Collateral Dai has recently gone live that allows users to stake multiple different assets other than ETH. Multi-Collateral Dai has taken the symbol DAI, while the original single collateral Dai via ETH staking is under the symbol SAI.
Ultimately, MakerDAO keeps the network decentralized by aligning incentives. MKR token holders provide governance to the system by voting on the interest rates, how much of a loan can be issued, and more. To compensate them for their work, borrowers must pay their interest payments using the MKR token, which is subsequently burned to ensure it becomes more scarce over time. They also receive a portion of the penalty fees (14%) in MKR incurred by borrowers when the price of their collateral goes below the liquidation price outlined in their smart contract based loan. This auto-liquidation of loans (triggered via price oracles) keeps the network solvent by automatically hedging price volatility. Every time a loan is paid back, the system burns the DAI/SAI it previously issued. The beautiful part about MakerDAO’s design is that all users are incentivized to act in a way that benefits them and the network simultaneously, which negates the need for a central third party.
Another popular DeFi Dapp is Compound, a lending protocol that acts as a money market fund where users earn interest by loaning out capital. Borrowers can access this capital based on their “borrowing capacity”, which is a pre programmed algorithm that takes into account their token balance, market liquidity, exchange rates (via price oracles), and other factors. Borrowers are auto-liquidated in their loan exceeds their borrowing capacity.
Ultimately, Compound and Maker shift banking from privileged institutions issuing undercollateralized debt to fuel credit expansion, to decentralized market forces that overcollateralize assets to expand credit with automated stops to hedge downside risk. They lower the market barriers and process times for accessing capital, as well as allow anyone to participate as a lender for passive interest returns.
An emerging DeFi Dapp is Synthetix, a decentralized crypto-backed derivatives platform. On Synthetix, users stake the native token SNX (ETH staking coming), which is used as collateral to create debt based synthetic assets (synths) that represent fiat currencies, cryptocurrencies, commodities, indices, and more. These synths give traders/investors exposure to the movement of the underlying asset without actually holding the asset. The value of synths when swapped between one another are pegged to the underlying market value of the asset using price oracles.
The synths are backed by SNX stakers, which receive a percentage of the exchange fees from each transaction. Traders on Synthetix can take advantage of infinite liquidity given there is no order book when swapping between synths. Instead, users take on a portion of the total debt, which can increase or decrease based on the movement of their synths vs. total amount of synths in the network. Every trade is executed against the contract (staked SNX), similar to a clearinghouse that acts as the counterparty to every trade. All positions in the network are transparent to users, which allows them to hedge against over/under exposure to keep the system fully collateralized, while improving their underlying position.
Decentralized exchanges (DEXs)
Decentralized exchanges offer non-custodial platforms for exchanging assets, which provide users censorship resistant trading and different security guarantees such as maintaining your private keys as opposed to a centralized exchange handling them. Additionally, protocols like 0x are allowing Dapps to incorporate a customized DEX into their application, bZx is enabling liquidity for margin trading on DEXs by coordinating non-custodial lending across platforms, and Loopring is working on scalability and privacy for DEXs through off-chain computation and zkRollups.
Chainlink has recently integrated with Loopring to ensure that relayers stake the required amount of LRC when computing a zero-knowledge proof on-chain. To learn more about the integration, check out the recent blog post or watch the AMA.
Other DeFi Applications
Some of the other popular DeFi Dapps include Set Protocol for automated asset management of portfolios, Augur for decentralized prediction markets, and Lightning Network for retail payments in Bitcoin. There are also Initial Coin Offerings (ICOs) for token-based crowdfunding, Security Token Offerings (STOs) for equity-based crowdfunding, stablecoins, commodity-based money (such as Chainlink powering the Ampleforh protocol), staking for underlying consensus protocols (POS, DPOS), and staking in DAOs in the form of VC funds, insurance funds, and protocol governance.
How Chainlink Helps Accelerate the DeFi Ecosystem
Chainlink, a decentralized oracle network, can vastly expand the functionality of DeFi smart contracts, increase the variety of products offered, and make the market more enticing for regulated players to participate within. Outlined below are four ways Chainlink is enhancing the DeFi ecosystem.
Most DeFi applications rely on data to execute their smart contracts. Some Dapps simply don’t require off-chain data because they exclusively use on-chain data. ICO’s are a well known financial application that doesn’t need off-chain data since the rate of exchange is already pre-programmed into the smart contract. While on-chain data is sufficient for certain use cases, it’s very restrictive because it limits dApps to certain types of data and/or constrains them to data only available on their native chain. Most DeFi applications simply can’t be created without access to external data and resources.
An oracle is a digital agent employed by a smart contract to retrieve and/or connect it to data and systems outside its native blockchain (off-chain). Oracles enable this off-chain connectivity for the smart contract by reformatting external connection points (APIs) so that two different softwares are compatible for data exchange. The oracle can then pull data into the smart contract and execute actions on external systems based on predefined instructions and endpoints outlined in the Service Level Agreement (SLA).
Chainlink is a decentralized oracle network that gives smart contracts secure and reliable access to data providers, web APIs, enterprise systems, cloud backends, IoT devices, payment systems, other blockchains and much more. Through access to all these off-chain mediums, smart contracts can easily access a wide variety of already formatted inputs and outputs to replicate existing digital agreements. This allows DeFi to use all types of off-chain data and systems to trigger contract execution, as well as settle contracts through a variety of payment gateways and enterprise backend systems.
Trusted, Reliable, and Customizable Data
No matter how well a smart contract is designed, ultimately the contract is dependent on the data it receives. Data is what triggers the contract logic and therefore must be as reliable and secure as the underlying blockchain. Since the novelty of oracles is still a relatively new problem for the space, many projects began by simply creating their own oracles. These oracles usually involve aggregating data off-chain (interest rates, exchange rates, prices, etc) and then manually putting it on-chain. While it’s been largely necessary in the beginning phases of development to maintain security, centralized price aggregation leaves Dapps vulnerable to mismanagement, incompetence, and bribery of the central institution managing the data feeds.
To address this problem, we have begun rolling out decentralized price reference oracle networks on Chainlink for popular assets like ETH, BTC, LINK, BAT, USDC, ZRX and REP. The price reference feeds are calculated based on an aggregation of independent, security reviewed nodes and updated regularly to reflect changes in the price, as demonstrated by the ETH/USD and BTC/USD reference contract currently live on the Ethereum mainnet. The reference data contracts support the growth of DeFi by allowing any dAapp to leverage these price feeds in their smart contracts. This takes control and maintenance of price feeds away from the Dapps and replaces it with an increasingly decentralized oracle network.
If you are a DeFi project and would like to build your own customized oracle reference data network using Chainlink, as demonstrated in many of our recent integrations, please reach out to us at email@example.com.
Chainlink Staking introduces binding agreements (service level agreements) on Chainlink that allow users to outline the services they need (data, timeframe), the commitments they desire (stake), and the node requirements they seek (reputation threshold, infrastructure). From these service agreements, the reputation system can begin to take form using on-chain metrics that outline their past performance.
Listing services such as the Chainlink Market, provide outlets where users can evaluate and select nodes for service agreements based on the criteria outlined above. There is also the Honeycomb API Marketplace for finding authenticated data APIs that nodes can access on a per-call basis, instead of needing full API subscriptions to each data source.
We are also working on incorporating service agreements with pluggable aggregation, which allows users to use multiple oracles for computational redundancy, multiple sources for data accuracy, and aggregate them all together in any manner they want (average, remove outliers, custom weights, etc). These features give users the ability to customize their smart contracts around data they trust using any amount of decentralization and any form of data aggregation.
One more additional feature in development is Town Crier – a Trusted Execution Environment (TEE) based oracle that verifies TLS certificates to authenticate that data came from a specific website and was not tampered with en route to the smart contract. Assuming the user trusts the underlying hardware, Town Crier gives users new security guarantees that their data is authentic from the source.
Low-Cost Data and Computation
Another major problem with developing DeFi instruments is on-chain gas costs. If applications require constant price feeds and/or employ multiple oracles and data sources, then gas costs add up and limit its practical use. This creates a conundrum because decentralization is essential to data security, but is too costly to be a sustainable business model. Current on-chain aggregation models require each oracle (node) to pay gas fees to submit external resources on-chain. Thus, if 10 nodes are used to gather external data, that’s 10 gas fees for each on-chain update.
We are currently working on implementing threshold signatures into the Chainlink protocol, a novel approach to decentralized oracles at scale. Threshold signatures represent a new aggregation protocol that allows oracles to communicate with each other and arrive at a consensus off-chain about the validity of some specific data point. Off-chain oracle aggregation using threshold signatures requires only one on-chain response and one gas fee to send the aggregated data to the querying smart contract, while still maintaining high-security properties that are verifiable on-chain.
According to Chainlink researcher Alex Coventry, “Our current best threshold signature scheme (described in this post) requires about 15k gas to confirm. This means, for instance, that the 3,000 data point mentioned earlier would only cost about 2, a 1,500-fold savings (and at current gas/ETH prices, the cost would be a bit over one cent, vs about $17 for validation of a 2,000-strong quorum, using the current framework.)”
We are also building a solution to low-cost computation by creating the ability for Chainlink oracles to run in Trusted Execution Environments (TEEs) via trusted hardware such as Intel SGX. Oracle-based TEEs offer a black box environment where nodes can expand oracle services to include off-chain computation and transaction privacy. Not even the oracle is aware of the data going in and out, yet the trusted hardware can provide an attestation back to the blockchain noting that it operated correctly without tampering. TEEs have intriguing potential for bringing scalable and low-cost computation to smart contracts.
The other main problem outside of connectivity and low-cost scalability is privacy. As Sergey Nazarov, Co-Founder of Chainlink, has stated, “Most contracts in the real world simply cannot happen without privacy.” The lack of on-chain privacy outside of more expensive Zero Knowledge Proof (ZKP) designs means that many contracts cannot be redesigned as potentially more efficient smart contracts. Privacy is essential for concealing internal positions and trading strategies, as well as abiding by data privacy laws and regulations.
Two privacy solutions have initially been introduced for Chainlink, differentiated by the developer’s needs and trust assumptions. As stated above, TEE-based oracles can be used to hide oracle queries from the oracle itself, removing the possibility of them leaking sensitive information (assuming you trust the hardware). Users could also use Chainlink to connect with off-chain computing environments like the trusted compute framework (TCF) as part of the Hyperledger Avalon project.
The other more recent non-hardware based approach is Mixicles, which uses oracles to create privacy by decorrelating the inputs and outputs of a smart contract. Following this protocol design, the oracle retrieves data and makes a true/false determination (switch) on the data off-chain. The determination is then relayed to a mixer that issues designated outputs based on that oracle input. The basic premise is that the state change (determination) is decorrelated publicly on-chain form the output payment for settlement. For even deeper security needs, users can use TEE-based oracles or DECO in tandem with a Mixicle to hide the switch from the oracle. For a more thorough understanding, please read the research paper or our less technical blog post.
Bringing New Customers and Products to the DeFi Ecosystem
Undoubtedly DeFi is becoming one of the fastest-growing and most in-demand fields for smart contracts. While progress should be celebrated, the reality is that most of the world has no exposure to DeFi. There is a major untapped market of potential for DeFi products to merge with existing infrastructure and/or reinvent current financial markets, but only if new features are added to the smart contract stack.
We are continually building and offering practical solutions on Chainlink to solve the core problems of connectivity, trusted data, low-cost scalability, and transaction privacy currently holding back a larger wave of DeFi development. By bringing these new tools to developers, next-generation smart contracts can be built that meet the demands of both permissionless and permissioned systems. Ultimately, Chainlink is an open-source tool that brings customizable connection between blockchains and with traditional systems that run the world so that connected consensus can emerge across ecosystems.
Build Your Connected Smart Contract Today!
If you’re a developer or enterprise looking to create any type of oracle for your externally connected smart contract application, reach out to us at firstname.lastname@example.org, visit the developer documentation, or join the technical discussion on Discord. We are here to help and support you in building an oracle design in an efficient manner that’s customized to your specific needs, while still maintaining the highest security standards.