How to trade on a DEX using only Lisk Desktop (Lisk Hub)

Jonathan Gros-Dubois
6 min readDec 6, 2019

This guide will show you:

  • How to use Lisk Desktop to access a Lisk sidechain and create a wallet on that sidechain.
  • How to use Lisk Desktop to buy and sell a sidechain token in exchange for LSK.

For this guide, we will use Lisk Testnet, the Capitalisk PoC sidechain and we will interact with them using Lisk Desktop.

Part 1: How to use Lisk Desktop to access a Lisk sidechain and create a wallet on that sidechain

Before you can buy sidechain tokens, you need to have a wallet address on the sidechain which you can send the sidechain tokens to.

This can be done easily using Lisk Desktop.

Firstly, you need to have one of the latest versions of Lisk Desktop installed and then you need to run it (either from source or as executable). You can download it here: https://lisk.io/wallet

Once Lisk Desktop is running, you need to go to the settings screen.

Then tick the Network switcher checkbox; this will allow your to switch to different Lisk subnets.

Now you need to go to the home screen by clicking on the Lisk icon near the top left of the screen. The home screen should look like this:

To connect your Lisk Desktop application to the Capitalisk sidechain, you should click on the drop down near the top right of the screen (which says Mainnet by default).

When the menu comes up, you should paste one of the following URLs in the text input box under Custom Node and then click on the Connect button:

  • http://18.212.59.239:7010
  • http://34.227.22.98:7010
  • http://3.93.232.78:7010

These nodes are part of the Capitalisk subnet so we need to point to one of them in order to access the sidechain.

Once you are connected to a sidechain node, you should click on the Create an account link to create a new wallet on the Capitalisk sidechain.

Follow all the prompts as you would if you were creating a regular Lisk wallet. Remember to save both your passphrase and your wallet address somewhere as we will need them later to receive some CLSK tokens in part 2 of this guide.

Once you’ve created your wallet, you can use your passphrase to sign in.

Note that at this stage, we are still connected to the Capitalisk sidechain.

You can check that this is not the Lisk network by opening the Delegates tab; all the delegates will be different from those on the Lisk testnet. It’s an independent blockchain except for that fact that you can easily convert value between LSK and CLSK chains using Lisk Desktop.

Part 2: How to use Lisk Desktop to buy and sell a sidechain token in exchange for LSK

At this stage, there are no fancy UIs or trading platforms for buying and selling CLSK sidechain tokens using LSK but with a few simple commands, you can easily place orders on the DEX using only Lisk Desktop.

To buy some Capitalisk (CLSK) tokens, you need to sign out of your current wallet and point your Lisk Desktop app back to the Lisk Testnet network using the network switcher (you just click on Testnet in the drop down).

Once you are connected to Testnet, you need to log into a wallet address which already has some testnet LSK tokens in it.

If you don’t have any testnet LSK, you can ask someone from the Lisk community Discord chat [insert link here] to send some to your testnet LSK address.

Once you’re logged into your Lisk testnet wallet. You can buy some CLSK tokens by sending some transactions to the Lisk DEX address.

The DEX address on the LSK testnet chain is: 11279270540263472697L

How to make a market order

From the Wallet tab on Lisk Desktop, click on the Send LSK button. Then from that screen:

  • Set the recipient as 11279270540263472697L (the DEX address on the Lisk chain).
  • Under Amount, specify the amount of LSK you want to convert to CLSK.
  • Under Message, paste the following command (replace ${targetWalletAddress} with your own CLSK wallet address): clsk,market,${targetWalletAddress}

Once you have sent your transaction/market order to the blockchain, the DEX nodes for the CLSK/LSK market will independently process it and add it to the decentralized order book.

If your order matches a counterparty order from the CLSK chain, the DEX nodes will process the necessary cross-chain transactions so that both parties will receive the desired tokens.

If there is liquidity in the market, your market order should go through within about a minute.

You can watch the order book via this API endpoint (which can potentially be installed on any DEX node): http://34.227.22.98:7011/orders

The pending transfers API endpoint is here: http://34.227.22.98:7011/transfers/pending

Once your order has gone through, you can make Lisk Desktop point back to one of the CLSK nodes as shown in Part 1.

After you log into your CLSK wallet, you will be able to control your new CLSK tokens using Lisk Hub.

A market order is the easiest way to trade sidechain tokens on a DEX.

How to make a limit order

A limit order allows you to buy or sell a token for a certain price. If a match cannot be found immediately, your order will be added to the DEX order book until it finds suitable counter-offers.

You can send a limit order in the same way that you send a market order by sending a transaction to the DEX address, but the command is slightly different:

  • Set the recipient as 11279270540263472697L (the DEX address on the Lisk chain).
  • Under Amount, specify the amount of LSK you want to convert to CLSK.
  • Under Message, paste the following command (replace ${targetPrice} with the rate you want and ${targetWalletAddress} with your own CLSK wallet address): clsk,limit,${targetPrice},${targetWalletAddress}

How to cancel/close an unfilled limit order

You can close a DEX order using the following command:

${targetChain},close,${orderId}

Replace ${targetChain} with the target chain of the original order which you want to close (e.g. clsk).

Replace ${orderId} with the blockchain transaction ID of your original order. It is recommended that you set the amount as 0.11 to guarantee that you get a response from the DEX.

When you close an order, any unfilled portion of that order (minus transaction fees) will be refunded back to your wallet.

How to convert CLSK back to LSK

Selling CLSK for LSK is essentially the same as buying CLSK but the DEX address on the CLSK chain is different. Also, you need to specify lsk (instead of clsk) as the target chain.

The DEX address on the CLSK chain is: 6054385933994690091L

The command for a market order to sell CLSK looks like this:

lsk,market,${targetWalletAddress}

Note that using a different address on either chain was done for security reasons to prevent possible replay attacks across different chains.

It is highly recommended that you also use different wallet addresses on both chains until the fix has been implemented in Lisk SDK.

Lisk DEX protocol

You can find out more about the DEX protocol here: https://github.com/jondubois/lisk-dex#dex-protocol

--

--