Decentralized Exchanges Workshop Outcomes

Quick links: DEX projects breakdown spreadsheet, video from the DEX meetup.

As part of our mission to decentralize the web, the Web3 Foundation will act as an advocate, steward and supporter of decentralized protocols and projects — particularly those that utilize blockchain technology.

This year, we plan to roll out a series of workshops designed to create collaboration across specific blockchain initiatives including: decentralized exchanges, scalability and on-chain governance.

The goal of these workshops is to bring together highly technical teams and to develop a shared understanding of some of the larger ecosystem initiatives necessary for the deployment of highly functional and consumer-ready decentralized software. Where crossover and industry-wide issues are found, the Web3 Foundation will seek to deploy capital and resources for research and development initiatives to address those greater ecosystem issues. Please get in touch with us on twitter at @web3foundation or by email at hello@web3.foundation if you would like to get involved in any of the topics touched in the article or want more information.


The DEX Workshop

Our first workshop focused on decentralized exchanges (DEXs). We think supporting the growth of decentralized exchanges is critically important at this time. We’ve seen a massive influx of interest in cryptocurrency in the past year, and have seen the stress it has put on centralized exchanges. Until recently, centralized exchanges have typically provided better user experiences — from UX design to order book fulfillment to centralized 24/7 customer support.

Michael Oved of AirSwap presents at the Web3 DEX Meetup in Berlin

With technology and cryptocurrency adoption progressing — we’ve also seen the promise of DEXs to deliver on a similar user experience. Now is the time to ensure that a fully decentralized trading ecosystem becomes a reality.

We invited a number of technical teams to join us in our Berlin offices on January 23rd for a full day workshop around the following topics:

  • front running prevention
  • order book unlinkability
  • throughput
  • dark pools
  • cross chain exchanges.

Joining us were devs working on: 0x, Airswap, Augur, Gnosis, Herdius, Kyber, Melonport, OmiseGo, and Radar Relay as well as a number of other devs working on specs and DEX support initiatives.

On the following day we organised a community meetup, where a few of the teams were able to speak about decentralized exchanges in general and their projects, you can see the Meetup video here.

In order to make it easier to understand other projects and make the discussion more structured the participants proposed a number of different categories that each project should cover:

1. Order Book: On or off chain? Is there even a single order book?

2. Provably Fair Matching: Is it necessary to trust a third party to match the orders fairly?

3. Order placement: Does the way orders are placed make front running easy?

4. Throughput: How many orders can it process? How much volume can it process?

5. Latency: How long does it take to settle trades?

6. Cost: How much does it cost to conduct an exchange?

7. Privacy: Do the participant identities get revealed? Are orders linkable?

8. Legal: What legal considerations have you taken? Do you perform KYC on the users?

9. Target users: What set of users is your exchange targeting? Is it aimed at low liquidity niche tokens or high liquidity popular markets?

10. Assets: What is the universe of assets tradable on the exchange?

11. Worst case failure: Given a failure of security assumptions, what is the worst that can happen?

12. Development stage: Is the project live? When will it be deployed and usable?

13. Greatest challenges: Which element of working on the exchange has been the most challenging?

We then followed on to discussing each of the projects and trying to understand how they fit together. We hope that this common understanding of how these projects relate to each other will help them realise ways to collaborate or find their market niche. You can see the summary of our analysis in the breakdown spreadsheet.

From the overview of the projects it is clear that exchanges can decentralize two aspects of their operation: custody and matching. Maintaining custody of the assets while trading is a great mitigation strategy for many exchange related risks and costs. Trust-free matching can have the same effect. Some exchanges attempt to do both, while others only one, avoiding many pitfalls of decentralised matching. Maintaining custody while still matching on chain may be also beneficial, avoiding any DEX implementation issues.

After looking at the particular projects we identified the main issues that would be worth discussing: front running, scaling, ongoing vs batch auction, privacy, liquidity and legal. Below are the general outcomes of different discussions.


Front Running

Informational advantage that is exploitable by a mechanism arbitrage, that is exploitable by a mechanical arbitrage, that leads to another market participant receiving a worse economic price than would have otherwise occurred.

Possible ways to get front ran:

  • getting a front by other market participants
  • getting a front ran by a miner (participant with transaction ordering capabilities)

In traditional exchanges front running is limited by a trusted party that collects the orders. This kind of trusted ordering can be also used for decentralised exchanges, given reputation of the matcher and maintaining custody over funds.

To make it impossible to for other participants who are able to order the transactions not to be able to order them in an unfair way, the orders have to be concealed. After the ordering is determined the orders get revealed. This can be achieved using a commit/reveal scheme or in order not to rely on the reveal phase using a distributed key store. Both Gnosis and Parity (Parity Secret Store) have been working on a distributed key generation, storage and reveal implementation. A threshold signature is used and to break this scheme multiple key servers would need to collude.

Sometimes just seeing that there is an order is enough to gain some information about other market participants, in this case a Submarine send scheme can be used.


Ongoing vs Batch

The only project focused on creating an exchange based on batch auctions was Gnosis. Batch auctions are a departure from how a traditional exchange works, however have many benefits in context of blockchain — specifically make front running less of a problem. General agreement was that they can be good for markets with guaranteed minimum liquidity and when the price is not too volatile.

More about the Gnosis Dutch exchange.


Scaling

The goal is to increase the exchange throughput at reasonable costs.

Ethereum Researcher, Vlad Zamfir, speaks to attendees at W3F DEX Meeting

In general scaling solutions for decentralised exchanges can be categorised into changes to the underlying protocol and changes to the exchange application itself. Exchange application can be modified by introducing batching, faster signature schemes and optimising the matching algorithm.

The most generic way for increasing the throughput is to improve the throughput of the underlying state machine. There is a number of solutions under development which aim at lowering costs and increasing throughput, some of the mentioned ones: Polkadot, Cosmos / Ethermint, Plasma and Raiden. Many more solutions are in development.

One perspective on scalability was provided by Melonport which focuses on asset management on the blockchain. They decided to build Melonchain, a stand alone chain which will be bridged to the Ethereum mainnet. To use a token across chains a token contract has to be duplicated on the 2nd chain with an additional `mint(…)` function. To move the tokens Parity Bridge can be used. They have a plan to convert into a Polkadot parachain down the road. A useful initiative that can be taken on is to set a standard for cross chain tokens.

In order for those solutions to fit the requirements of applications and align timelines it is useful for the application builders to remain in touch with scalability solutions builders. Since not many of those solutions are productions ready it is important to keep the exchange application protocol abstract to be then able to adjust to changes in the underlying technology.

In order to facilitate communication between application and protocol builders the Foundation will steward an initiative we’re calling ScalingNOW! We will work in collaboration with Giveth to bring focus to scalability solutions that can be implemented within a 3–6 month timeframe. Here is the current framework:

  • Giveth will run a series of interviews with devs working on scaling solutions. You can check out those videos here: ScalingNOW interviews
  • Web3 Foundation and Giveth invite you to join the conversation around scaling at our Riot channel, which is open to all.
  • Web3 Foundation will organize a small working group in Barcelona this March to bring together DApp developers and those working on scaling solutions. As with this blog post, we’ll make the findings available to the community.
  • Web3 Foundation will organize a large scale conference in mid/late 2018 focusing on scaling solutions, both near and long term. This will be open to the community and we’ll share more details as we get further along organizing. If you’d like to be involved, please shoot us a note: hello@web3.foundation.

Privacy

Trade/participant indistinguishability. There are 3 main approaches:

  • zkSNARKs are not usable for decentralised exchanges because one loses the ability to prove the message sender. There is also too much computational overhead involved.
  • Ring signatures which are already implemented for EVM, based on this paper.
  • Set accumulators. They appear to be doable in Solidity and Matthew di Ferrante is working on it. More information about cryptographic accumulators can be found here.

Liquidity

As new exchanges are created often they lack liquidity to be used. Either there is not enough funds to provide sufficient liquidity or the exchange is not able to provide liquidity for legal reasons. Any risks associated with providing liquidity are similar to centralised markets. Automated or designated market makers can provide base liquidity, research and partnerships with those is useful. Potential solutions for improving liquidity is to partner with centralized exchanges or allow pooling of liquidity across decentralised exchanges.

Working Group at W3F DEX Meetup

Herdius proposes that in addition to working with centralized exchanges DEXs should also work together on sharing liquidity between each other. One potential solution to this is to set up an intra DEX settlement network / system that can match trade orders across the different decentralized exchanges utilizing it. DEXs could subsidize cross-DEX trade order by taking a cut from their share of the fees. In this case scenario the user would not pay a cost overhead for their transaction. Through this network even the borrowing and lending of liquidity becomes possible between different DEXs.


Legal

Decentralized exchanges face a significant amount of legal scrutiny similar to their centralised counterparts. Every jurisdiction has a different set of rules, which make it hard to operate a globally accessible exchange. Many of the projects focus only on open source development and there are questions as to who should be the regulated parties in the ecosystem.

Ideally, DEXs will utilize cross-project legal advice in order to avoid duplicating their efforts. While there are some risks associated with shared legal findings, a number of projects expressed their interest in collaborating on a knowledge-base and in funding legal analyses. One organisation that has been working on these questions is COALA, and projects should be aware of their work in this area. Web3 Foundation will work on information sharing initiatives and further legal discussions in the space.

In terms of jurisdictions, Gibraltar, which recently released the Gibraltar DLT regulation (similar to the BitLicense in NY) appears to be a business-friendly option. Under current German regulation DEXs that only do crypto to crypto trades do not fall under any current regulation. However, if in the future cryptocurrencies and tokens are deemed as financial instruments under EU law, a licence will more than likely be required.

Another vital area of focus is the verification of supported digital assets as non-securities, which some exchanges manually verify, one token at a time to ensure compliance with national and international regulations. One initiative that may reduce this overhead would be to create and maintain a shared list of digital assets determined to be non-security tokens, and to fund this analysis through a consortium.


Continued Work

Many other discussions happened in smaller groups and we hope that they had a valuable outcome.

In addition to the educational value of the projects identified above, we hope that the following initiatives will also help to accelerate this application:

  • ScalingNOW workshop and gathering focused on immediate scalability solutions. Join the ScalingNOW Riot channel and see the ScalingNOW interviews organised by Giveth.
  • Organise a general Blockchain Scalability conference.
  • Standardising cross chain token standard and wrapped ETH <> ETH equivalence.
  • Supporting research on set accumulators for privacy.
  • Aggregation of high level-legal findings of different projects and creation of a shared knowledge base.
  • Shared list of non-security tokens, which require less regulatory oversight when being traded.
  • Coordinate a framework for liquidity pooling across decentralized exchanges.

Thank you to all of the projects and individuals that participated in these events. We look forward to continuing the discussion on identified topics and to organising follow-up workshops and meetups.