Byteball Exchange Bot

We already have unique tools for ICOs on Byteball platform, for example, they can easily KYC all their customers or limit access to tokens only to non-US investors, and there will be more tools. One part that was missing until now is liquidity of the tokens.

Investors are more likely to invest when they know that it will be easy to sell the tokens whenever they want. With conditional payments, it is very easy to do secure P2P trades, but one still needs to find a counterpart for the trade.

Today, we are launching an exchange bot that is available right inside the wallet, can be easily found in the Bot Store, and allows ICOs to get instant liquidity of their tokens before they list on traditional exchanges.

The bot already lists two tokens: TitanCoin(TC) and SilentNotary (SNTR).

It guides you through the exchange process in a lightweight chat interface. After it collected all information about the order you are going to place, it offers a smart contract, or a set of smart contracts, that you need to accept in order to create an order.

The smart contracts are contracts between you and the exchange operator. Under each contract, the asset that you are selling is stored on a shared address that can be spent:

  • by you, after some timeout, which is the minimum lifetime of the order. This clause allows you to cancel the order after this timeout.
  • by the exchange operator, if he simultaneously sends the required amount of the asset that you are buying, to you. The amount is determined from the price that you set when creating the order.

The contract means that the operator can never run away with your money without paying you the other asset. Even if the exchange is hacked, there is nothing the hacker can do to steal your money. If the exchange goes out of business without notice, you just cancel the order.

Order matching is still centralized. If there is an opposite order that matches your order in size, or a combination of matching orders, the operator will fill all these orders simultaneously, all in a single transaction. If the transaction fails, for example, due to a double-spend because you tried to cancel the order at the same time, then the entire transaction fails and no exchange happens. If the transaction succeeds, all transfers happen at the same time.

Although each smart contract is very simple, the interface might be a bit difficult to deal with because usually there is more than one contract. Since these smart contracts do not allow partial fills, we have to split the order into multiple sub-orders of standard sizes, each standard size being a power of 2. These standard sizes are more likely to match exactly against each other, or against 2 orders of the next smaller standard size, or against 4 orders of the next after next smaller standard size. E.g. a buy order of size 64 can match against a sell order of the same size, or 2 sell orders of size 32, or 4 sell orders of size 16.

Since only orders of the same size, or sums of smaller orders, can match, it is possible that buy and sell orders exist on the book at the same price, or even at crossing prices, and they stay unmatched. For example, we can have a buy order of size 64 and a sell order of size 2, and they do not fill until there are more sell orders at this or lower price.

Order splitting also leads to your order being filled in several transactions, usually one transaction per size.

So, you should be prepared that the exchange bot operates differently from traditional exchanges.

For traditional exchanges, the RPC API is also updated to support listing tokens, and those exchanges that already list Bytes, can add Byteball-issued tokens with minimal effort.