Market Making for JellySwap Protocol via Butler

Designed by JellySwap team - 31.03.2020 - [email protected]


This document will describe briefly the logic behind a trustless cross-chain atomic swap protocol called JellySwap. We will explain in clearly what is market making and what are the incentives and risks for the liquidity providers. We will analyze a few different market making strategies and we will propose an innovative software - Butler which can automatically validate, place and match orders with a counterparty, rebalance your portfolio and potentially earn profit.

1 Introduction

What market making is? This business exists for a long time in different forms, but for our purposes we will give some definitions for market making in financial markets and then will note the analog in the cryptocurrencies market.

Market makers—usually banks or brokerage companies—literally "make a market" for a stock by standing ready to buy or sell a given stock at every second of the trading day at the market price. This is good for traders because it allows them to execute trades whenever they want, more or less. When you place a market order to sell your 100 shares of Disney, a market maker will purchase the stock from you, even if it doesn't have a seller lined up. The opposite is true, as well, because any shares the market maker can't immediately sell will help fulfill sell orders that come in later.[1]

The above mentioned definitions are valid for the stock market, but almost the same rules and strategies are applicable for the cryptocurrency market. However, there are a few significant differences:

  • Anyone can be a market maker, not only banks, brokerage companies and wealthy individuals

  • Provided assets are not stocks or company shares, but cryptocurrencies

  • It is much faster and cheaper to be a market maker at the cryptocurrencies market

  • As long as JellySwap protocol is decentralized and trustless almost all of the profit will be in the hands of the market makers

With all that being said, it is obvious that market making in the crypto markets could be profitable and reveals a great potential and some risks as well. Next important step is to fully understand what is the JellySwap protocol and how does it work.

2 JellySwap Protocol

JellySwap is a p2p permissionless cross-chain swap protocol for instant liquidity. Everyone can participate, provide liquidity, and execute swaps via HTLC contracts[2]. There are many reasons and incentives for the JellySwap protocol participants. We can use as reference Kyber Network[3] and Uniswap[4]. They are liquidity aggregators, simple and efficient Ethereum[5] based swap protocols. The whole decentralized finance ecosystem is built around these two products. Can you imagine multichain uniswap with much more liquidity, many different blockchains, much more trading opportunities, a brand new cross-chain trading financial system - trustless, secure and decentralized. All these things are possible thanks to hash time locked contracts technology. More info about the protocol can be found here: [6]

3 Market Making Strategies

There are many trading strategies that can be used by the market makers, but we will list three strategies that can be used as a starting point.

Long and Short positions - Let’s analyze a theoretical situation where a market maker believes that the price of Bitcoin[7] will go up and the price of Ether will go down. Simply said the market maker is Long on Bitcoin and Short on Ether. He/she will provide liquidity on Bitcoin-Ether pair, therefore everyone will be able to exchange Bitcoin for his/her Ether with a little price spread(some extra price percentage on top of the market price of the asset)[8], which is an extra profit for the market maker. With this strategy the market maker will convert all his/her Ether to Bitcoin , without paying any taxes and even a small profit. If the price of Bitcoin goes up, the market maker will earn a good profit, because all of his/her funds will be in Bitcoin.

Neutral Strategy - Let’s analyze a theoretical situation where a market maker believes that the price of Bitcoin and Ether will stay at the same rate for the next months. Simply said the market maker is in a neutral position. The market maker will provide liquidity on Ether-Bitcoin and Bitcoin - Ether, therefore everyone will be able to exchange these assets with a little price spread, which is an extra profit for the liquidity provider. With this strategy the market maker will try to keep his/her balance and as long as the price of Ether and Bitcoin is stable he/she will have some profit from the price spread, without doing any complex computation, just via running the liquidity provision software, supporting both of the markets.

Portfolio Rebalancing Strategy - Let’s analyze a theoretical situation where a market maker wants to keep the ratio of my Ethereum - Bitcoin to 50/50. The market maker wants to keep this ratio, but he/she would like to earn profit from the price spread of each swap. He/she will provide liquidity on Bitcoin - Ether, therefore everyone will be able to swap these coins with price spread, which is an extra profit for the liquidity provider. With this strategy the liquidity provider will try to keep his/her balance ratio and earn some profit. If the ratio is changed e.g. Ether - Bitcoin 70/30, the market maker can go to some other exchange and to rebalance his/her portfolio. At the end of the day, the liquidity provider should have profit based on the price spreads.

All these strategies sound easy and reasonable, some of them like the lazy strategy and long and short positions strategy are more risky than portfolio rebalancing strategy, but there is something in common between all of the strategies. In order to match with each individual swap the market maker should be online and to validate all trades or he/she might use an automated liquidity provision software.

4 Butler - Liquidity Provision Software

Butler is automated market making software that is used for liquidity provision to JellySwap protocol. Everyone can run Butler instance on his own machine and start earning interest from market spreads. Butler supports automatic order matching, withdraws, refunds, portfolio rebalancing, email and slack notifications. Supported coins are BTC, ETH, DAI, AE, WBTC, AES, USDC. The final goal of Butler is to keep operator's portfolio balanced and to earn profit from the configured swap spreads. On Figire 1 you can see visually the pricnciple of work of the protocol and Butler.

Figure 1

Butler can be used with any of the listed strategies from part 3. We would recommend the portfolio rebalancing. It is one of the secure strategies and lowers the risk for the market maker. Two of the most critical components for the automated liquidity provision software are the price feed provider and the rebalancing exchange. Currently we do support two price feeds - Cryptocompare[9] and Binance[10], but, if you have the technical background, you can add your own connector and price source. Here you can find a useful guide for Butler setup: [11]

Our approach for the market making is different than the approach of Uniswap and Kyber and it is initially designed that way, because cross-chain liquidity provision is more complicated and requires interaction with many different blockchains. In opposite of Uniswap you do not have to lock your funds in ethereum smart contract, but to run Butler and configure it with your keys. Our implementation requires a machine that works 24/7, but is also more flexible and every liquidity provider can determine and offer his/her own price, therefore the final rate for the different markets can be better for the end user. All statistics and liquidity providers info can be monitored real time on this link: [12]

5 Risks

Butler is automated software and it should be up and running 24/7 as long as you want to participate in the protocol. Risks related to connectivity and hardware:

  • Power outage

  • Internet outage

  • Hardware problem

Next group of risks is related to software and service dependencies:

  • Bug in the Butler software or smart contracts

  • Price provider service outage

  • Lack of connectivity to blockchain

  • Database problem

  • Problem with connecting to rebalancing exchange

  • Hacker attack that can get access to Butler operator's machine

Market related risks:

  • Highly volatile market and big price movement can bring some losses

  • Ghost attack - fake swaps are started, but never finalized - no losses for Butler operator, but funds will be locked for 4 hours in HTLC

  • Slow blockchain transaction speed due to network overload, usually combined with massive price movement

All swaps have a lock period of 24 hours. If Butler is down for some of the above mentioned reasons or some new unexpected bug, every Butler node operator have 24 hours period to recover his/her Butler and no loses will be encountered.

JellySwap team have paid for 3rd party security audit and all of the code for Butler is open source, therefore everyone can check it and run it on his/her own risk.

6 Conclusion

Butler is an automized market making agent that is used to provide liquidity in JellySwap - cross-chain atomic swap protocol. The are a few really innovative components in the system. First, the protocol by itself which is trustless, decentralized and supports cross-chain swaps, therefore everyone can join within a few clicks. Second, the market making approach could bring more competitive swap rates, compared to the pooled liquidity, which is the most used method at the DeFi[13] ecosystem by now. A Consequence of the above mentioned factors might be more usage of the protocol and more profits for the liquidity provider aka Butler operators.