TEX, the Decentralized Token Exchange

The First Decentralized Exchange of the DeFi-on-Bitcoin Ecosystem

Exchanges are an important part of the Bitcoin ecosystem, but also its Achilles heel. Many exchanges have been hacked, the most spectacular case was undoubtedly the one of Mt. Gox in February 2014, when 850,000 Bitcoins were stolen. Although security measures have improved since then, a centralized exchange will always be an attractive target for hackers.

Even worse, centralized exchanges can easily be forced by governments to comply with their outdated laws, which were designed for the old system of intermediaries who require trust. But they make no sense for Bitcoin, which is defined by its trustlessness and regulated by its protocol, not by authorities. If you want to use a centralized exchange like Kraken, Bitstamp or Binance, you have to go through an annoying „Know-Your-Customer“-process (also known as KYC). You have to upload a copy of your passport, take a selfie and disclose other things that are nobody else’s business.

Decentralized exchanges do not have all of these disadvantages. Users are in control of their private keys and do not have to entrust their money to a third party. Therefore there is no risk of hacking, as long as the exchange’s smart contracts are properly programmed. Another advantage: there is no KYC process. All you need to use those exchanges is a wallet like Metamask or Nifty. You can borrow, lend and trade on these exchanges without having to disclose your identity to anyone.

TEX is based on the Rootstock Network

So far, most decentralized exchanges work on Ethereum. The biggest ones in volume are Uniswap, SushiSwap and Curve Finance. As opposed to centralized exchanges, they do not accept fiat currencies such as dollars or euros, their focus lies on Ethereum tokens. As Bitcoin on DeFi is still in its infancy, only very few exchanges exist yet in this new space. The newest on the market is TEX, created by Money-on-Chain which we already presented in issue 3.

TEX works similar to the well-known decentralized exchanges on Ethereum, but it is built on the RSK network. So far the tokens you can trade there are Money-on-Chain´s Dollar-on-Chain, BitPro and MoC, as well as RSK´s Smart Bitcoin (rBTC) and RIF Token.

„We have built TEX in the first place as we saw the need for a secondary market for RSK-based tokens“, says Money-on-Chain‘s co-founder and COO Manuel Ferrari. “It is very expensive to get a token listed on a big exchange, so it made more sense to create our own one.”

Technically, every Ethereum token could also be ported to TEX, as there is a bridge between Ethereum and RSK. But this is not the focus of the TEX team, as there is no lack of Ethereum-based exchanges.

TEX works with a technique called “Ticks” to avoid front-running

The advantage of TEX over other decentralized exchanges is that it also works even if not much liquidity is available. To achieve this, TEX uses a feature called a Tick. It was inspired by the London Gold Fix, by which the price of gold is fixed twice a day. In contrast to that relatively slow method, a Tick can occur every few minutes. It enables the order book to facilitate price discovery until a match is made. Its frequency depends on the market activity. The probability of having a Tick will increase with the numbers of orders in the order book.

The reason for using this method is to avoid front-running and to allow a fair price discovery even with low trading volumes. Front-running means to take advantage of insider knowledge of a large pending transaction that will influence the price of the underlying asset. Often it means to carry out a personal transaction in advance of a transaction of the same asset for a client’s account. Front running is considered a form of market manipulation.

Using a Tick also avoids the risk of a slippage, which is the difference between the moment where the system signals the entry and exit for a trade and the moment where clients actually enter and exit the market. Especially in new platforms with low volumes this can be a problem and lead to unexpected losses for traders.

“TEX is an important piece of the Money On Chain protocol,” explains Max Carjuzaa, co-founder of Money On Chain. “The decentralized order book ensures a fair and transparent price discovery process.”

TEX currently offers two types of orders: limit orders and market maker orders. A limit order assures that you can buy or sell at the intended price or a better one. If there is a buy order for 1 BTC at 20,000 USD and a sell order at 19,800 USD, both orders will be put together and processed. The price will be the one that benefits both parties the most. The buyer will not spend more than the maximum he wants to spend, the seller will not receive less than the minimum he expects. In this example, the price will be the average between the two, which is 19,900 USD.

A limited order

A market maker order is a special type of limit order. When you enter a market maker order you specify a percentage difference to the so called fair price. This can be obtained from an oracle, or if no oracle is available, from the latest Tick. For Bitcoin, Money-on-Chain has developed oracles which are algorithms that collect price data from various exchanges. For less popular tokens, for which no oracle is available yet, using the Tick to define the price of a market maker order is the standard.

For example, let’s suppose that the price of Bitcoin is 20,000 USD. You enter a market maker order to buy 20,000 DOC for RBTC and specify a price difference of 0.5%. Your limit order will then be put at a price of 19,900 USD, which will change with the price of Bitcoin. If it goes up or down, the price of your order will be adjusted automatically. In this example you will buy Bitcoins at 19,900 USD or better.

A Market Maker Order

TEX charges a trading fee which has two components, a fixed and a variable one. The fixed fee is 50 Cents per order, the variable fee is 0.1% of the traded amount. Let us assume the user places an order of 100 USD. 50 cents are deducted as a fixed fee, the variable fee on the remainder is 0.1% (99.5 USD x 0.001 = 0.0995 USD). The order will therefore be established for 99.4005 USD with 0.5995 USD as fee reserve.

For each partial match, a proportion of the fee is charged. In our example, if 30% of the total order is matched, $ 0.17985 is charged from the fees reserve and $ 0.41965 remains in reserve. If the order is matched in full, the entire fees pool is consumed.

There are several other projects which try to bring Bitcoin to decentralized finance by recreating it on Ethereum. They either wrap BTC (WBTC) or custody it on the Bitcoin network (SBTC, renBTC, tBTC) and then unlock the corresponding amount on the Ethereum Blockchain. Money On Chain goes the other way around: it uses RSK’s Layer 2 on top of Bitcoin to build an Ethereum-style token exchange with the improvements described above.

The demand for BTC as a collateral for lending, borrowing and stablecoin issuance is already quite high: nearly 3 billion USD worth of BTC has been issued in various forms on Ethereum. However, doing this in a Bitcoin-native environment makes a lot more sense: the Bitcoin Blockchain is much more secure than Ethereum’s and it has lower fees. Furthermore, having to entrust your Bitcoins to a custodian is the opposite of what Bitcoin stands for.

“Many RSK-based projects will be launched soon”, says Manuel Ferrari. “And they will all need a secondary market for their tokens. Therefore we expect TEX to play an important role in the Bitcoin-DeFi ecosystem.”

By Aaron Koenig