Blockchain technology has the potential to tackle the opacity and barriers to entry of the existing global financial system. Reducing financial exchange to a transparent and open settlement network, accessible to all parties, is one of the dreams at the heart of the public blockchain movement.
A wave of ‘decentralised’ exchange projects is one of the latest incarnations of this important aim. Every week a new project appears with the aim of delivering decentralised exchange. In the context of crypto-asset exchange, the most common use of the term ’decentralised’ is used to refer to a platform not requiring central custody of funds, or the trust of a third party to settle trades and disputes.
This makes sense, as the Ethereum ecosystem is itself a movement fuelled by a need for decentralised, trustless and transparent modes of operation. Blockchain has the power to eliminate unnecessary middlemen and monopolies and, particularly given the past vulnerabilities of cryptocurrency exchanges to security breaches, exchanges therefore seem like the ideal targets for decentralisation.
Decentralised exchanges, with on-chain settlement via smart contracts, have sprung up through a need to combat the rather serious drawbacks to centralised exchange. These drawbacks include a requirement for trust, a lack of transparency, and a tendency for them to inevitably become attractive targets for malicious actors. Decentralised exchanges, on the other hand, do not require users to trust anyone with control of funds but only to give control to smart-contracts, and for this reason cannot theoretically expose users to counter-party risk.
What could possibly go wrong…?
Basic Approaches and Issues
An analysis of two of the most popular decentralised exchange approaches, EtherDelta and 0x was posted on Hacking Distributed, highlighting some of the most obvious problems associated with these, as well as a similar article about Bancor, which offers a method of asynchronous on-chain exchange.
A few examples of the specific challenges mentioned in above articles, or found through some of Ethfinex’s own work with different approaches to on-chain exchange include:
- Ever present risk of bugs in smart contracts, or bugs introduced through future upgrades
- Latency of on-chain orderbook and on-chain order generation and cancelling
- Prevention of miner front-running in transparent on-chain settlement
- Expense and latency of on-chain transactions
- Vulnerability to off chain communication channel manipulation
- Phantom order books created through off-chain order generation
- Scalability limitations of public blockchain
In a general sense, many of the most obvious problems stem from sacrificing transaction speed for rate limited settlement on-chain. These problems are not unique to the previously mentioned projects, but extend to all decentralised exchange projects. Future approaches using state-channels, or even side-chains as proposed by some decentralised exchange projects, will go much of the way towards solving these problems.
Decentralised exchange projects are contributing valuable research and experience to the ecosystem, and it is of course much easier to point at their flaws than to create alternate solutions to the problems they attempt to solve.
However, it is evidently clear that there still exist several serious unsolved challenges in current approaches to decentralised exchange settlement, affecting all models to varying degrees.
Thinking Long Term / The Ethfinex Approach
In addition to these basic challenges, the speed and complexity requirements of the most sophisticated trading customers mean that practical implementation of fully decentralised matching and settlement on-chain still requires significant further development. Margin trading, involving a peer-to-peer financing market on blockchain, is a further challenge that is as yet unsolved, but is essential to attaining large scale liquidity.Ethfinex will pioneer a hybrid exchange model — sharing liquidity between centralised users and decentralised exchange users.
Our vision is to ultimately transition towards complete decentralisation, with distributed exchange, ownership and governance, but for the short term we believe a hybrid approach will provide the best experience for users. What the hybrid approach will mean in practice is that those customers who value speed most highly will continue to use Ethfinex as any other centralised exchange, by depositing their funds before trading. On the other hand, customers who value trustless settlement first and foremost, and don’t mind waiting for their transaction to be included and settled through the Ethereum blockchain, can choose to trade without depositing to Ethfinex, via a set of smart contracts. Both types of users are able to interact with each other via Ethfinex.
For some aspects of exchange, such as storing order books, we believe it can be unnecessary, inefficient, and expensive to use a blockchain. Blockchain should not be treated as one-size-fits-all solution, and exchanges should be decentralised only to the point at which it adds value to the user.
There are alternative ways to attain the benefits of decentralisation, such as additional security and resistance to DDoS attack. This is why, for example, our team has developed a microservice architecture called Grenache, which works to split the platform into many microservices that use distributed hash tables for peer-to-peer service discovery.
However beyond all the issues of on-chain exchange highlighted so far and in the hacking distributed articles, the most serious impediment will be the speed and transaction scalability limits of the blockchains these decentralised exchanges are built on. This applies even just to eventual settlement, with everything else taken off-chain and to state-channel based solutions.
To build some context around the previous statement about scalability limits:
- Current ethereum transaction rate ~ 2–5 tx/second
- Ethereum post proof-of-stake and sharding ~ 100 –1000 tx/second
- Potential Plasma transaction rate ~ 1000 –10000 tx/second
- Bitfinex average load today ~ 4000 tx/second
- Bitfinex current peak period load ~ 10000 tx/second
- Projected Bitfinex load 1 year from now ~ 100000 tx/second
- NASDAQ transaction rate ~ 1000000 tx/second
It becomes clear when looking at these rough orders of magnitudes how far decentralised exchange technology, and blockchains themselves, need to go before approaching anywhere close to being a substitute for the matching engines of centralised exchanges.
This philosophy of long term thinking and planning has been central to Ethfinex’s product development and roadmap. Designing the ultimate on-chain exchange based only on what Ethereum, or any other existing blockchain is currently able to achieve would not make sense given how rapidly things are changing and improving.
Ethfinex is working to create a trustless and transparent crypto asset exchange which will be able to handle not just current loads, but the projected loads of the future. Ethfinex will continue to invest into exchange technology, and aims to create an open experimentation zone for all decentralised exchange projects and protocols to speed up iteration and development of scalable approaches.
The customer experience must always come first. As a first step, Ethfinex will allow users to trade trustlessly via smart contracts rather than deposit their funds to trade, and a large proportion of users may choose this option.
This will be revolutionary in and of itself, but is far from being the final solution, and many customers may likely continue to use Ethfinex as a centralised exchange, to benefit from the lower latency and execution cost until a solution exists which does not involve sacrificing the execution rate.