Written by KomoDeFi Editorial Team on May 1, 2020

AtomicDEX Orderbook Tutorial - Part 2

The full stack atomic swap tutorial only gets better! Here you will have your own web app for exploring the atomicDEX p2p orderbook market. Market pairs not available on centralized exchanges exist on this p2p trading network. Community exotics such as RVN/DGB directly being listed with DEX prices. No intermediary currency (like BTC/ETH/USDT/BUSB/etc.) and certainly no intermediary party. Your keys your coins!

In part 1 of the tutorial, setting up the telegram bot which relayed our wallet passphrase was helpful. If you did not do it, the passphrase is available in plain text in the root of the container at /passphrase.txt - more advanced docker options to share a file on the host to the container are also available which will be covered at the end.

Viewing Market Orders From A Web App

When I wrote part 1, it was designed for the types of automated testing that can be done without a GUI. Fire up 50 docker instances, with some accompanying scripts. This is ideally what the Komodo dev team would want to use for load testing the network from several data centres around the globe. This image has the web GUI enabled. You need docker installed to play along!

Step 1 - Pulling Updated Tutorial Image

docker pull coingateways/atomicdexorderbook:0.8.4

Step 2 - Start AtomicDEX API, Middleware & Web Front End

For this I'm going to only leave instructions for a telegram bot. If you are not going to use a telegram bot, just omit the (-e) environment variables, it will still work without a problem. Please don't send large amounts of funds without properly having the passphrase backed up. It is auto-generated randomly.

If you have run through tutorial 1, you will want to stop the running container (if you haven't) and remove it. Make sure you have the passphrase saved if you did adventurous things on your own accord (like sending real value to the address). You can recover the funds using the Verus Desktop Wallet.

docker run -i -t -p 127.0.0.1:7780:7780 -p 127.0.0.1:8001:8001 -e MMBOT_URL="http://localhost:7780"  -e BOT_TOKEN="XXXXXXXXX" -e BOT_CHATID="XXXXX" -e BOT_USERNAME="XXX" -e ME_PUBLIC="false" -e ME_PRIVATE="true" --name orderbook coingateways/atomicdexorderbook:0.8.4

We have added the web port to open communications for the browser to connect to on port 8001.

We have also added two variables to pass in ME_PUBLIC & ME_PRIVATE. They are simple true/false values. Best results are reached when they are opposite of each other. ME_PRIVATE enables more dangerous operations from a financial risk point of view e.g. making trade orders broadcast on the network with a funded account.

Step 3 - Browse To Application

Wait! The front end app needs to be compiled - nothing from your end needs to be done, but there will be about a 10 second start up whilst the javascript is optimized. The application is written in VueJS with Material Design baked in from Google. The project VuetifyJS is used for this seamless developer experience.

Browse to http://localhost:8001

The browser will redirect to the dashboard and you will likely see 60+ wallets showing zero balance.

So easy!

Step 4 - Browse P2P Crypto Markets

Currently, atomicDEX is in beta, so there are not many users or orders or volume. So we'll have a look at only 3 markets - firstly an exotic community market - KMD / VRSC. Verus is the home of the desktop wallet & Komodo is the original multi-chain blockchain project. Verus is a fork of Komodo, the address format is the same.

Scroll down to the bottom for VRSC
A button to go to the selected button is also half way down the screen - yes some UX / CSS adjustments to make...
The market data!

Step 5 - Update Coin Gecko Fiat Price

For the first integration with the centralized world, an example of the price feed being updated. This is a cyclical update on the middleware server. It fetches an update approximately every minute. From the above screenshot, to update to the latest fetched data, simply click on the banner!

KMD goes up a tiny bit like the good oscillating currency that it is

You will note the "INVERT" button. This will flip the market around. All orders are sellers, they are just selling at the opposite ends of the market! This is the underlying logic in the atomicDEX marketmaker software.

Step 6 - Invert Market

Not many VRSC sellers! This will increase, especially as I've deployed a coin specific interface for the community at https://vrsc.orderbook.live

What's Next

What's next for me is to do some live streaming using this interface. Creating orders with test coins and the community. Automation is a big feature of this orderbook app. It is designed for web communities to watch orders countdown in a reverse auction style contest.

Re-Using Passphrase

Instead of auto-generating a new passphrase on container start up, a plain text file can be mounted from the host to the container. The container has been built in such a way to auto detect the existence of a pre-shared passphrase!

Back to Top
Experience Web3
© 2024 komodefi.com