How to become a liquidity provider on DogeDEX network?
An explanation on how to provide liquidity on DogeDEX network.

Can I setup liquidity on DogeDEX?

Yes, there are two ways that you can add liquidity to the DEX. One way is using the mobile or desktop application and creating orders with a price and volume of your choosing. The second way is creating a dedicated liquidity provider node (LP).
We are working on a simpler way to setup the LP nodes from a desktop. Currently, you need to have experience with command-line interfaces to set up an LP node.
LPs on DogeDEX are not like LPs on Uniswap. In order to make profits, LP nodes needs to arbitrage between exchanges. They can buy low and sell higher on the DEX network or vice versa. There are benefits to this architecture. There's no impermanent loss on DogeDEX and more secure contracts. On a Uniswap automated market maker model, you're exposed to impermanent loss as a liquidity provider as well as security risks with the contract.

How To Become a Liquidity Provider on AtomicDEX

The following tutorial introduces the reader to a simple method to become a liquidity provider on the main network of the AtomicDEX software.

#Requirements

#Virtual Private Server (Recommended)
We recommend that the user have a Virtual Private Server (VPS) (opens new window)with at least the following specifications.
  • 2 vCPU
  • 4GB RAM
  • OS: Ubuntu 18.04 (Preferably a clean installation)
#Home-Based Connection
If the user prefers to use computer hardware at home, instead of a VPS, we recommend that the user have a very strong Internet connection. We also recommend that the user have a competitive hardware setup running on Ubuntu 18.04.
  • Internet speed - at least 1 MBPS
  • RAM - at least 4 GB
  • Processor - at least i5 or equivalent

#Installing Dependencies

#Step 1: OS Packages
#Command
1
sudo apt update
2
sudo apt-get install build-essential git jq llvm-3.9-dev libclang-3.9-dev clang-3.9 cmake libssl-dev pkg-config
Copied!
#Step 2: Install Rust
#Command
1
curl https://sh.rustup.rs -sSf | sh
Copied!
When asked to select an installation type, select the following.
1
2) Customize installation
Copied!
Choose default host triple and toolchain, then select minimal profile.Show Sample Output
Once the installation is complete, enter Logout and then Login again.
Alternatively, you may execute the following command in each active shell until you reach the Login again.
1
source $HOME/.cargo/env
Copied!
#Step 3: Install Rust components
#Command
1
rustup install nightly-2020-10-25
Copied!
Show Sample Output
#Command
1
rustup default nightly-2020-10-25
Copied!
Show Sample Output
#Command (Optional, skip this step if it fails)
1
rustup component add rustfmt-preview
Copied!
Show Sample Output

#Install MarketMaker Software

#Step 1: Download source code
1
cd ~ ; git clone https://github.com/KomodoPlatform/atomicDEX-API --branch mm2.1 --single-branch && cd atomicDEX-API
Copied!
Show Sample Output
#Step 2: Compile Source Code
#Command
1
cargo build --features native -vv
Copied!
Show Sample Output
#Step 3: Download the Coins Configuration File
#Command
1
cd ~/atomicDEX-API/target/debug ; wget https://raw.githubusercontent.com/KomodoPlatform/coins/master/coins
Copied!
Show Sample Output

#Running the MarketMaker

#Step 1: Download and Edit Scripts to Provide Liquidity for the KMD/LTC Pair
Navigate to the directory: ~/atomicDEX-API/target/debug
1
cd ~/atomicDEX-API/target/debug
Copied!
Download the scripts used to start and interact with MarketMaker.
1
git clone https://github.com/gcharang/mm2scripts
Copied!
Copy those scripts to the current directory.
1
cp mm2scripts/* .
Copied!
#Create a Secure Seed Phrase
The user must create a seed phrase that will serve as a type of password for accessing all coins in the user's digital wallet.
Various tools are available in the cryptocurrency community to create a secure seed phrase. One available method is to use the automated procedure that is included in the Verus Agama Wallet (opens new window).
Backup these 24 words carefully. They provide access to the coins that are stored in the addresses created by the MarketMaker.
To learn more about creating secure phrases, read this linked content on the Bitcoin wiki.(opens new window)
#Edit the start.sh File
Danger!
We are about to place the seed phrase in the user's start.sh file. This step is crucial for cryptocurrency security. Failure to properly execute this step can (and likely will) lead to a loss of all your funds.
Open the start.sh file in the current directory using the nano software.
1
nano start.sh
Copied!
Replace the value REPLACE_TRADING_WALLET_PASSPHRASE in the file with the seed phrase.
#Create an RPC Control User Password
Keep the nano software and start.sh file open.
Separately, create an additional password for Remote Procedure Call (RPC) access.
This should be a simple password that is sufficiently random, has at least eight digits, and is based on numbers and letters.
#Place the User Password into the start.sh File
Replace the text "RPC_CONTROL_USERPASSWORD" with your RPC user password.
#Example
Show Example
Hit Ctrl + X to save and exit.
Observe the bottom of the terminal for any prompts. Hit y when asked to save. When the file name is shown, hit Enter if the name matches start.sh.
#Edit the userpass File
Replace the text RPC_CONTROL_USERPASSWORD with the same password used in the start.sh file.Show Example
We now have basic scripts to use the MarketMaker as a liquidity provider.
#Step 2: Start the MarketMaker
#Command
1
./start.sh
Copied!
Show Sample Output
Note
Starting the MarketMaker 2.0 software in the above manner causes the passphrase to be visible to other programs such as htop.
To avoid this issue, there is an alternate method that uses a json file to replace the command line parameters
To use it:
1
cp MM2_sample.json MM2.json
2
nano MM2.json
Copied!
Edit the values of the keys "rpc_password" and "passphrase" with the same values used in the start.sh file. Save and close the file.
To start the MarketMaker:
1
stdbuf -oL nohup ./mm2
Copied!
#Step 3: Connect to the Coin Networks (KMD & LTC)
Open a new terminal and navigate to the directory: ~/atomicDEX-API/target/debug
1
cd ~/atomicDEX-API/target/debug
Copied!
#Connect to the KMD network
#Command
1
./KMDconnect.sh
Copied!
#Response
1
{"address":"RG1yR8UGqyHmRBcrwAakUEi8u1AC5jNABY","balance":"0","coin":"KMD","result":"success"}
Copied!
Take note of the address.
TIP
We recommend here that you make sure that the public address above matches the address generated by the same passphrase, when entered into the AtomicDEX wallet or the Verus Agama wallet.Show Response
#Connect to the LTC network
#Command
1
./LTCconnect.sh
Copied!
#Response
1
{"address":"LRxjbptpKojFbywpe8avejShLx4sYvKSBZ","balance":"0","coin":"LTC","result":"success"}
Copied!
Show Sample Output
#Connecting to a Network Other Than KMD or LTC
To connect to a coin network other than KMD or LTC, first make sure that the coin's details are present in the coins file you downloaded. Also make sure that the file has the property "mm2": 1.
Next, create a new file named "COINNAMEconnect.sh" and add the following contents; replace the characters < and > and all text between them with values from your coins file. (For example: <text where 7771 should be inserted> becomes 7771.)
1
#!/bin/bash
2
source userpass
3
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"electrum\",\"coin\":\"<COIN TICKER>\",\"servers\":[{\"url\":\"<url of electrum server 1>\"},{\"url\":\"<url of electrum server 2>\"}]}"
Copied!
Make the file executable
1
cd ~/atomicDEX-API/target/debug
2
chmod +x COINNAMEconnect.sh
Copied!
Execute the command ./COINNAMEconnect.sh to instruct your Market Maker 2 instance to connect to the coin's electrum server.

#Trading

#Step 0: Query the Current Orderbooks
Display the KMD/LTC Orderbook.
TIP
See this linked document for an explanation of the output.
#Command
1
./orderbook.sh KMD LTC | jq '.'
Copied!
Show Sample Output
Display the LTC/KMD Orderbook.
#Command
1
./orderbook.sh LTC KMD | jq '.'
Copied!
Show Sample Output
#Step 1: Fund the Address
In this example, we sell KMD for LTC.
To achieve this, we first fund the KMD address created by the MarketMaker.
Use the following command to find the address and check the balance.
1
./mybalance.sh KMD
Copied!
#Response
1
{"address":"RFmQiF4Zbzxchv9AG6dw6ZaX8PbrA8FXAb","balance":"2.98","coin":"KMD"}
Copied!
#Step 2: Place an Order
Execute the following command to sell 2 KMD at the price of 1 KMD = 0.013 LTC.
#Command
1
./place_order.sh KMD LTC 0.013 2 | jq '.'
Copied!
#Response
1
{
2
"result": {
3
"base": "KMD",
4
"created_at": 1563800688606,
5
"matches": {},
6
"max_base_vol": "2",
7
"min_base_vol": "0",
8
"price": "0.013",
9
"rel": "LTC",
10
"started_swaps": [],
11
"uuid": "d375fce0-5d7c-4d1d-9cfa-6177c78df44a"
12
}
13
}
Copied!
#Step 3: Check the Status of an Order
Check the status of an order by referring to its uuid.
#Command
1
./order_status.sh 6621efd5-72dd-422c-89a8-7b655b744ead | jq '.'
Copied!
#Response
1
{
2
"order": {
3
"available_amount": "2",
4
"base": "KMD",
5
"cancellable": true,
6
"created_at": 1563800688606,
7
"matches": {},
8
"max_base_vol": "2",
9
"min_base_vol": "0",
10
"price": "0.013",
11
"rel": "LTC",
12
"started_swaps": [],
13
"uuid": "d375fce0-5d7c-4d1d-9cfa-6177c78df44a"
14
},
15
"type": "Maker"
16
}
Copied!
#Step 4: Withdrawal of Coins
After someone accepts the order and your trade is finished, the coins received (LTC) and the coins leftover (KMD) can be withdrawn.
Execute the following command to withdraw 0.97 KMD to the address RUFf4de7gZE7sp5vPcxaAsvv6j79ZbQgAu.
#Command
1
./withdraw.sh KMD RUFf4de7gZE7sp5vPcxaAsvv6j79ZbQgAu 0.97 | jq '.'
Copied!
#Response
1
{
2
"tx_hex": "0400008085202f8901c25ecb12f5fc17120bf92ed18ff71754b5f58e6eece2fba44fc114f14176df04010000006a4730440220732047807944afcb062f5dc7af87fe5b9979e447cd235ef1b130e50008c3d51a02201b232814bcee9c0b5a29aa24d453e493cd121a0e21d94c0e84476de0a15e74a101210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06ffffffff02401ac805000000001976a914d020156e7d0fead249cfb5a458952ae941ac9f9e88ac5800fb0b000000001976a9144726f2838fc4d6ac66615e10604e18926e9b556e88ac06a5355d000000000000000000000000000000",
3
"tx_hash": "e07709088fa2690fdc71b43b5d7760689e42ca90f7dfb74b18bf47a1ad94c855",
4
"from": ["RFmQiF4Zbzxchv9AG6dw6ZaX8PbrA8FXAb"],
5
"to": ["RUFf4de7gZE7sp5vPcxaAsvv6j79ZbQgAu"],
6
"total_amount": 2.98,
7
"spent_by_me": 2.98,
8
"received_by_me": 2.00999,
9
"my_balance_change": -0.97001,
10
"block_height": 0,
11
"timestamp": 1563798788,
12
"fee_details": {
13
"type": "Utxo",
14
"amount": 1e-5
15
},
16
"coin": "KMD",
17
"internal_id": ""
18
}
Copied!
Copy the "tx_hex" value from the above response and send it to the network using the sendrawtransaction.sh script.
#Command
1
./sendrawtransaction.sh KMD 0400008085202f8901c25ecb12f5fc17120bf92ed18ff71754b5f58e6eece2fba44fc114f14176df04010000006a4730440220732047807944afcb062f5dc7af87fe5b9979e447cd235ef1b130e50008c3d51a02201b232814bcee9c0b5a29aa24d453e493cd121a0e21d94c0e84476de0a15e74a101210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06ffffffff02401ac805000000001976a914d020156e7d0fead249cfb5a458952ae941ac9f9e88ac5800fb0b000000001976a9144726f2838fc4d6ac66615e10604e18926e9b556e88ac06a5355d000000000000000000000000000000
Copied!
#Response
1
{
2
"tx_hash": "e07709088fa2690fdc71b43b5d7760689e42ca90f7dfb74b18bf47a1ad94c855"
3
}
Copied!
The above tx_hash can be searched for in an explorer to check the status of the withdraw.

#Miscellaneous

#Stop
To stop the MarketMaker, use the stop.sh script.
#Command
1
./stop.sh
Copied!
#Response
1
{
2
"result": "success"
3
}
Copied!
#View All the Orders Placed by Our Node
#Command
1
./myorders.sh | jq .
Copied!
#Response
1
{
2
"result": {
3
"maker_orders": {
4
"d82357c5-22c9-483d-bf3d-1d09d0d921bf": {
5
"available_amount": "2",
6
"base": "KMD",
7
"cancellable": true,
8
"created_at": 1563797287088,
9
"matches": {},
10
"max_base_vol": "2",
11
"min_base_vol": "0",
12
"price": "0.013",
13
"rel": "LTC",
14
"started_swaps": [],
15
"uuid": "d82357c5-22c9-483d-bf3d-1d09d0d921bf"
16
}
17
},
18
"taker_orders": {}
19
}
20
}
Copied!
#Cancel an Order
Cancel an order by referring to its uuid.
#Command
1
./cancel_order.sh 6621efd5-72dd-422c-89a8-7b655b744ead
Copied!
#Response
1
{
2
"result": "success"
3
}
Copied!
Last modified 8mo ago