Back in 2019, an estimated 99% of crypto-asset transfers took place on centralized exchanges (CEXs), according to the number that was used by main crypto critic Nouriel Roubini. CEXs are likely to remain a central fixture of the crypto trading landscape for the foreseeable future. CEXs are fast and convenient, but typically require traders to deposit funds in an account controlled by the exchange. Unfortunately, history illustrates that this loss of sovereignty over a user’s digital assets can be an extreme and costly compromise. 

Decentralized exchanges (DEXs) offer an intriguing alternative and are gaining momentum, but are still not yet ready for prime time. Therefore, there must be a way to bridge the gap between user sovereignty and exchange performance.

Related: DeFi proved resilient during the March 2020 and May 2021 market crises

When it comes to custody, control is better than trust

The nightmare scenario for traders using CEXs is that they might fall victim to hacking or fraud and lose their deposited funds. Although seven years have passed since the collapse of Mt. Gox in 2014, its name still remains synonymous with the dangers of cryptocurrency fraud. Once the world's largest Bitcoin (BTC) exchange, it filed for bankruptcy in 2014 after Bitcoin of an estimated 650,000 customers went missing. The victims are still attempting to receive partial compensation from the insolvency process in 2021.

Sadly, this form of counterparty risk remains a threat to this day. In April, the founder of Turkish exchange Thodex absconded with $2 billion of investor assets unaccounted for. A year before that, China’s FCoin and Australia’s ACX both closed without warning. Whether those failures were due to fraud, a hack, or problems with the business model, it doesn’t matter much to the investors left out of pocket. In an ideal world, the exchange operator (or a hacker who has compromised an exchange) should be denied the ability to move client funds discretionarily between accounts.

Related: Trust is still a must in the trustless world of cryptocurrency

The status quo: Managing risk brings greater costs

For well-capitalized or well-connected traders, there are ways to mitigate these risks, but the solutions come with their own drawbacks.

Credit is one way to avoid having to pre-fund an account. Yes, that is possible if you are willing to pay high fees to a broker or if you can get a credit line with a particular exchange by establishing yourself as a top customer. Either way, it is expensive (and in the latter case, slow), and only the biggest of spenders stand any chance of developing such a good relationship with multiple exchanges.

Off-exchange settlement networks provide an alternative to loading funds directly onto exchanges. These intermediaries hold the trader’s funds and take on the counterparty risk for each exchange. In the current environment, such intermediaries provide a valuable service for institutions, but they still represent an added layer of expense. So much for frictionless trading.

DeFi and the trouble with transparency

If the problem is the loss of asset sovereignty on CEXs, could DEXs be the solution? Yes and no. By using smart contracts and decentralized liquidity pools to enable asset swaps, DEXs remove intermediaries and enable traders to retain sovereignty over their assets. However, DEXs also involve heavy compromises, particularly for larger traders.

On a DEX, instead of buyers and sellers being paired through a centralized matching engine, a smart contract performs the trades. Participants called “yield farmers” can lock their assets into a liquidity pool and earn yields in return. Each liquidity pool facilitates trading for a particular pair of assets, such as Bitcoin and Tether (USDT), for example. The smart contract will adjust yields according to the relative volume of assets in the pool, in order to attract more of the scarcer asset and maintain a healthy balance. At the same time, the transaction fee a trader pays will vary depending on the relative scarcity of the assets involved.

Although innovative, this approach does not scale well. Depending on the size of the liquidity pool, large trades can immediately have a strong effect on trading fees. In addition, DEXs are highly susceptible to frontrunning. Frontrunners are traders (often bots) who scan for information that suggests a big trade is coming, then jump in with their own transaction to profit from the expected price move. Of course, these exploitative trades have their own effect on the market price, reducing the profit of the originally planned transaction. On CEXs, the risk is that if prefunding is conducted on-chain, third parties may be able to infer that a big trade is about to happen. However, these risks are greatly magnified when using a DEX.

Due to the networking delay when processing transactions, pending transactions may circulate among validating nodes before they are finally committed to a block. Indeed, on smart-contract-based DEXs, bids are sent transparently, so a frontrunner simply needs to observe incoming bids and place their own bid with higher fees or with less networking delay in order to profit. Furthermore, as validators decide on the order of transactions for the blocks they produce, it could introduce another opportunity for manipulation.

Thus, while DEXs are a tantalizing idea and present the opportunity to earn passive yield, they are currently not well suited to the needs of most traders.

Related: Yield farming is a fad, but DeFi promises to change the way we interact with money

Can we build a better DEX?

So, can the interests of traders be better protected without the downsides of existing DEXs?

One possible approach here would be to use blockchain as the source of trust and combine it with off-chain confidential computing hardware to handle order matching. For example, trusted execution environments (TEEs) can establish an isolated area within a computer processor, running separately from the standard operating system that is not accessible to the system admin.

The matching engine and trade execution software for an exchange could be placed within a TEE, removing it from the control of the exchange owner. Each trader could then determine an allowance that the TEE could spend to settle trades on their behalf, eliminating the need for prefunding or intermediaries. In addition, as matching would be performed off-chain, the risk of frontrunning would also be reduced.

Thinking more long term, a combination of other emerging techniques such as multi-party computation or zero-knowledge proofs might be able to be used to achieve similar results, but these approaches are currently less mature and would be difficult to implement in real world scenarios.

Conclusion

The need for prefunding on cryptocurrency exchanges introduces problems and risks that pose a significant barrier to the adoption of digital assets. While DEXs offer an innovative alternative that leaves the trader in control of their funds, they also entail significant trade-offs. To drive the mainstream adoption of digital assets and gain a competitive advantage, cryptocurrency exchanges need to explore ways to preserve user sovereignty without compromising on performance.

This article does not contain investment advice or recommendations. Every investment and trading move involves risk, and readers should conduct their own research when making a decision.

The views, thoughts and opinions expressed here are the author’s alone and do not necessarily reflect or represent the views and opinions of Cointelegraph.

Alain Brenzikofer is a co-founder of Integritee AG, a hardware-enabled confidential computing solution that combines blockchain and trusted execution environments. Active in blockchain since 2013, he contributed to the Quartierstrom peer-to-peer energy markets initiative and founded Encointer, a crypto-based universal basic income project. In 2020, he led the team that won the Energy Web Innovation Challenge for a project that used trusted execution environments for off-chain computation.