This guide will be a walk though for learning about setting a bob server.


Step-by-step guide


First thing we will need to do is set up a VPS (Virtual Private Server) with ubuntu 16.04 on it with at least 4gb of RAM and 2 cores .

  1. Services like Digital Ocean, Vultr, OVH, etc, are easy to use and have accessible prices on different server setups.
  2. Once you access the server for the first time youll need to be sure to create a user where you will install the services needed to be a Bob node. Services should never be installed in the root directory. Please follow this guide to create a user in ubuntu.


Remember that to be a bob you will need some knowledge on how to work on the Linux command line


Installing coin clients


To have a bob you will need to install the native command line clients of the coins you will offer liquidity to.


Installing komodo (zcash type installation process)


Komodo blockchain is not needed to have BarterDEX working, but as an example for this guide we will install it.

After setting up a user in ubuntu, move to that users account and install all dependecies:


sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python python-zmq zlib1g-dev wget libcurl4-openssl-dev bsdmainutils automake curl cmake


Once the dependencies are installed we will need to clone the komodo repository:


git clone https://github.com/jl777/komodo


Then move to the komodo directory you just cloned into the server and run the fetch-params.sh and build.sh scripts:


cd komodogit checkout dev#you might want to: git checkout <branch>; git pull./zcutil/fetch-params.sh# -j8 uses 8 threads - replace 8 with number of threads you want to use./zcutil/build.sh -j8#This can take some time.


After the installation completes we need to run and sync the komodo daemon


cd ~/komodo/src./komodod -daemon


Installing Litecoin


Install the following dependencies to build Litecoin:


sudo apt-get install autotools-dev libssl-dev libevent-dev libboost-all-dev libdb++-dev


Then clone the repository


cd ~/git clone https://github.com/litecoin-project/litecoin


Once you clone the litecoin source code, you need to build it:


cd ~/litecoin./autogen.sh./configure --with-incompatible-bdb --with-gui=nomakesudo make install


Create the litecoin.conf file so that the daemon can interact with BarterDEX:


mkdir ~/.litecoinnano ~/.litecoin/litecoin.conf


Add to the litecoin.conf file:


rpcuser=<username>rpcpassword=<password>listen=1server=1txindex=1prune=4096


Start litecoin daemon;


cd ~/litecoin/src
./litecoind -daemon


Install BarterDEX


Install Nanomsg


cd ~
git clone https://github.com/nanomsg/nanomsg
cd nanomsg
cmake . -DNN_TESTS=OFF -DNN_ENABLE_DOC=OFF
make -j2
sudo make install
sudo ldconfig


Clone the SuperNET repo from github & Install:


cd ~
git clone https://github.com/jl777/SuperNET
cd ~/SuperNET/iguana/exchanges
git checkout dev
./install


Copy the passphrase file & using seed passphrase

From the same dir in terminal type the following commands to copy the passphrase file to ~/SuperNET/iguana/dexscripts dir and add a strong 24 words seed passphrase in between "". Save your passphrase properly without changing any word or space. Same seed passphrase will always show you the same smartaddress.


cp passphrase ../dexscripts/passphrase
cp setpassphrase ../dexscripts/setpassphrase
cd ../dexscripts
nano passphrase


Enter your passphrase:




export passphrase="<put a very strong passphrase here>"



Press CTRL+X then Y then ENTER to save the file and exit from Nano editor.


Getting the userpass value


All these scripts are expecting a userpass file, which contains the definition of the $userpass variable (found inside scripts) to authenticate API access. This avoids evil webpages that try to issue port 7783 calls to steal your money. At first you may not know the value of userpass. To find out, just run the client script first (as instructed below) and then run ./setpassphrase. You will notice your userpass value at the top of output and you can copy that value and put it into ~/SuperNET/iguana/dexscripts/userpass file. If you don't, all subsequent API calls will get authorisation error.


Open a new terminal and type the following:


cd ~/SuperNET/iguana/dexscripts
./client &
./setpassphrase
pkill -15 marketmaker


Edit the userpass file

Now copy the userpass example file to ~/SuperNET/iguana/dexscripts dir and edit the file to save the userpass you got from the ./setpassphrase script output.


cd ~/SuperNET/iguana/exchanges
cp userpass ../dexscripts/userpass
cd ../dexscripts
nano userpass


Once done press CTRL+X then Y then ENTER to save the file and exit from Nano editor.

barterDEX is now installed in your system.

Set canbind:1

Open the ./client script with nano and add canbind:1 mode


cd ~/SuperNET/iguana/dexscripts
nano client
 
# Now inside the file edit the last line to look like this
 
./marketmaker "{\"gui\":\"nogui\",\"client\":1,\"canbind\":1,\"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}" &


Once done press CTRL+X then Y then ENTER to save the file and exit from Nano editor.

Running barterDEX

Every time you want to run barterDEX open a new terminal window and type the following:


cd ~/SuperNET/iguana/dexscripts
./client &


And, don't close it. Open a new terminal window to issue all other scripts/API calls from next. Get all available api list by typing ./help inside ~/SuperNET/iguana/dexscripts dir. You can see all scripts available for you to modify, test and use.

Activating coins

 Edit the enable script with coin names and run ./enable in terminal window to activate native coins for trading in barterDEX.


nano enable
# and paste the following line into the file
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"LTC\"}"


Once done press CTRL+X then Y then ENTER to save the file and exit from Nano editor.


Setting LTC/KMD orders


To set LTC/KMD orders with out price set by Coinmarketcap you  need to edit the ./autoprice file:

cd ~/SuperNET/iguana/dexscripts
nano autoprice


Now inside the file add the following line:


curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"autoprice\",\"base\":\"KMD\",\"rel\":\"LTC\",\"margin\":0.04,\"refbase\":\"komodo\",\"refrel\":\"coinmarketcap\"}"


Depending on how much margin on the orderbook spread is desired, you need to edit the \"margin\" option. For example, \"margin\":0.05 will have 5% margin on the spread of the orderbook.

Once done press CTRL+X then Y then ENTER to save the file and exit from Nano editor.


Now that everything is set....


Run the ./client & wait for it to load, execute ./enable, then execute ./autoprice and you are ready to go. Your orders should show up.