Do you feel lucky? Picture this, it’s Saturday night and you decide to go to the casino with your friends. On your way over, you begin to think about the money you have at your disposal and how much you’re willing to gamble. You know it’s a risky proposition to play in the first place but you’re committed to the evening nonetheless. You arrive at your destination and begin experimenting with different games. You try Blackjack, Poker, Slots, and Craps… all while trying to figure out your risk/reward for each hand that you play. By the end of the night, you’re losing and getting ready to call it. Then, an idea hits you. What if you try the roulette table but instead of betting on one number (odds in winning: 1/36), you decide to bet on every number except one. You know you stand to win a smaller amount with each spin but you also understand that your odds in winning is drastically improved.
This is what margin lending on a centralized exchange may feel like: a safe bet. What one must realize is that while the risk of losing a bet is small, using this methodology repeatedly will pose a serious risk to your capital. In other words, you may win 99% of the time but you have a 1% chance to lose it all at any given moment. Furthermore, when it comes to margin lending on a centralized exchange, you need to consider additional risks not posed in our casino analogy.
Custodial risk is the risk of an exchange being hacked or otherwise losing lender funds. It has been estimated that centralized exchanges have lost over $800 million to hacks over the past two years. The unfortunate impact of these security issues is decreased liquidity in margin trading and prevention of efficient price discovery, thereby inhibiting correct asset pricing. This phenomena causes assets to fall victim to “bubble prices” and ultimately limits the number of users lending and trading on margin with crypto.
Decentralized exchanges (DEXes) present an obvious solution to security for crypto exchanges, as there is no vulnerable, centralized agent involved. However, while this minimizes the custodial risk that traders and margin lenders face, lenders still face the significant risk factor of counterparty risk.
Margin lenders face counterparty risk when borrowers are not consistently liquidated in time for the lender to regain their assets. When users do not feel safe about lending out their tokens, they end up participating less in margin lending. The fewer the lenders that use a platform, the higher interest rates become for margin traders. When interest rates become too high for traders, less will participate in margin trading and the overall health of the exchange will decrease. Fortunately, a solution has been devised and is readily available through the unique architecture and integration of the bZx protocol and its oracle layer. To understand exactly how this complex problem is tackled, let’s take a deeper dive into the mechanics of the protocol.
Pythia: the High Priestess and Oracle of Delphi
As per Greek tradition, oracles were mythological figures who saw what men could not see. Blockchain oracles, by definition, onboard information that exists outside the blockchain onto the blockchain so that smart contracts can be useful in the real world.
Blockchain oracles see what the native blockchain cannot. Ethereum smart contracts are not natively aware of asset prices on and off the blockchain. This limits the ability of a decentralized exchange contract to provide margin lending and trading on the Ethereum platform, as it is not natively able to keep track of asset prices. Without a source of pricing information, borrowers cannot be force-liquidated in the event of a margin call, leaving lenders open to adverse market movements. A reliable oracle is needed to import the asset price data necessary for margin trading to occur on Ethereum.
The open-source bZx protocol allows for any type of oracle-based solution to be built with regards to margin lending. For example, the flagship oracle, bZxOracle, uses Chainlink’s decentralized oracle network to provide consistent and accurate market data. Off-chain bounty hunters, users that monitor the solvency of margin accounts, let the contracts know when it is time to consult with the price data to determine whether a margin call is necessary. In the rare event of a flash crash, a guarantee fund pays out losses to lenders. As lenders provide the resources necessary for margin trading, their protection is of the utmost importance. Another oracle solution can be seen with bZx’s strategic partnership with Chainlink, the leader in trusted oracle services. Price feeds and liquidity powered by a Chainlink-based oracle opens up a wider range of margin calling options for lenders and traders in addition to allowing all ERC20s and ERC721s to be supported by the protocol.
Centralization falls along a spectrum, from completely centralized by a single party, to partially decentralized among a consortium of trusted parties, to completely decentralized among a network of unaffiliated individuals. Furthermore, there are several key features of a margin call that can fall along this spectrum of centralization. These features include:
- who monitors the margin accounts
- who prices the margin accounts
- where liquidity for margin calls is sourced.
Within a single system it is possible to mix and match solutions exhibiting varying degrees of centralization for each of these essential features. For example, lenders or relays could monitor their own margin accounts, making the monitoring of margin accounts centralized and vulnerable to a single point of failure. A more decentralized option would be for a consortium of relays or an M-of-N multisignature wallet to monitor margin accounts. At the extreme end of the decentralization spectrum would be a permissionless system where anyone can monitor margin accounts.
The pricing of margin accounts follows a similar pattern. The pricing of margin accounts comes into play when it is time to execute a margin call against a margin account that is under margin maintenance. A completely centralized approach might allow a lender or relay to unilaterally liquidate a margin trader based on their own interpretation of the health of the margin account. This has the downside of giving the margin trader no assurances that their loan will not be called in prematurely. The risk is particularly high when it is the lender tasked with valuing the margin account. Further along the decentralization continuum are the use of a price feed in conjunction with another party that executes the margin call. At the extreme end of decentralization you have the averaged price of multiple price feeds working in coordination with individuals performing their own calculations and executing a margin call when a position is in need of liquidation. Such a decentralized system gives traders confidence that their margin loan will not be called in prematurely.
Lastly, there is the question of where liquidity comes from once a margin call has been successfully initiated. An example of complete centralization would be a lender or relay providing liquidity from their own stockpiles or orderbooks. This presents a danger because a malicious liquidity provider could intentionally misprice assets to the benefit of a lender or trader. There are several decentralized approaches to providing liquidity which include the use of on-chain DEXs, Chainlink oracles, or permissionless Dutch Auctions. The Dutch Auction approach has the strength of allowing liquidity to be sourced from the entire ecosystem, lowering liquidity risk. The downside of this approach is that Dutch Auctions take a significant amount of time and expose lenders to the volatility of the market, essentially trading liquidity risk for counterparty risk. In contrast, on-chain DEXs and Chainlink oracles exhibit a higher liquidity risk while shielding lenders from counterparty risk. This protection from counterparty risk is a result of their ability to execute margin calls instantly.
In summary, bZx is the first protocol to allow secure margin lending on decentralized exchanges. Lenders no longer need to rely on centralized exchanges to make sure their assets do not become compromised. More lenders participate when they can trust in a secure system, and, in turn, traders benefit from lower interest rates generated by a healthy amount of lenders. bZx supports 60+ ERC20 tokens, and as new margin calling solutions develop, that number will expand to encompass all of them. Instead of passively keeping tokens in an ETH wallet, users can leverage a secure way to lend out of their ERC20s and earn interest. In providing solutions for security and settlement time for margin lenders, bZx effectively creates an ecosystem where any user of the Ethereum ecosystem can benefit.