A Good Friday Special, by Blockbar • π • March 30th, 2018



 Become a market maker

using your Raspberry Pi 


Wait, what is this exactly

  • In the year 2018 DEXs will become main stream
  • Using a DEX has many advantages compared to a CEX
    If you own crypto, you want to use a DEX
  • BarterDEX is a good DEX
  • Offer liquidity => Support this DEX & Earn money
  • In this workshop you learn how to be a Liquidity Provider
  • You could use a Raspberry Pi to run BarterDEX 24 / 7

DEXs become main stream

If you are using cryptocurrencies, you know how to trade coins/tokens. You can use centralized services like Binance/Poloniex/Kraken/ShapeShift. Or decentralized services like ...




There are not many decentralized exchanges (DEXs) in use yet. Partly this is because of the lack of liquidity. This will change.


In the year 2018 DEXs will become main stream.

What? #1


Ok, so Decentralized EXchanges will become main stream. This is nice, because it makes life safer, easier & more fun.

  • If you are using a centralized exchange, the exchange owns your money. Even worse: Its software manages your balance in a centralized way. This is a huge risk: This potential single point of failure can lose your money. It could be DDOS'd, therefor unusable. You don't want a few developers managing your money + billions of other people.
  • Centralized exchanges do not always let new users sign up, because too many people want to start using crypto these days.
  • If you want to use a centralized exchange, you have to send in a photo of you holding your full passport & sometimes even your signature. This gives a big risk for identity theft: Your photo/password/sig will end up publicly available.
  • There is a limit on the amount you can withdraw per day. Often you can give away your funds to the business that created a Centralized EXchanges easily. More difficult is it to withdraw from the CEX. Risks.

Using a DEX has many advantages compared to a CEX.

What? #2

BarterDEX is nice

One of the most promising decentralized exchanges is BarterDEX. Partly this is because it swaps coins directly from coin to coin without using a proxy token. It's really just a protocol for swapping of coins using the native blockchains of the two coins you want to swap. BarterDEX is also promising because the development of everything related to it goes extremely fast and is well thought out.


You can already use BarterDEX (beta) for a few months now. It works. Now it has to grow.

BarterDEX is a good DEX, in heavy development.

What? #3

You can be liquidity provider

No one will use a DEX which order book is empty. From the beginning there has to be an order book of asks and bids to make it an interesting platform to use.


You can be the one that fills the order books with coin pairs for others to swap. If you give liquidity to BarterDEX, you can have more profit on trades than you'd have on centralized exchanges. In example: on every trade done by others you might earn 5% of profit. This gives you some easy money, and you support the adoption of the DEX.

Offer liquidity => Support this DEX & Earn money.

What? #4

End of workshop: You = LP

LP stands for Liquidity Provider. At the end of this workshop

  • you know the basic concepts of BarterDEX
  • you have installed BarterDEX
  • you have used BarterDEX
  • you have a LP node running
    by offering trade pairs to others, you'll earn money

In this workshop you learn how to be a liquidity provider.

What? #5

To make it easy to have your LP node online 24/7, you could install BarterDEX on a Raspberry Pi (= cheap computer). Alternatives are running a bigger PC full time or renting a server.

Optional: Use a Raspberry Pi

A Raspberry Pi is a fairly cheap mini computer that can run Linux, Android, Windows and other operating systems. The computer doesn't need a lot of electricity. Because it's small it can easly run next to your router, fulltime. This makes it easy to use as a 'home server'. In example for videos, photos, your website(s), email, home automation. Or Storj / Golem. Or use the Pi for running BarterDEX.

You could use a Raspberry Pi to run BarterDEX 24 / 7.

What? #6

To make it easy to have your LP node online 24/7, you could install BarterDEX on a Raspberry Pi (= cheap computer). Alternatives are running a bigger PC full time or renting a server.

What do I need?


    1  Some knowledge of using cryptocurrencies

    2  Preferably you own at least 2 cryptocurrencies (20+ EUR)
    3  Curiosity (so no fear of using a terminal :)
    4  A computer, preferably running Mac or Linux


If you want to be LP & want to offer liquidity to the network:

    * A Raspberry Pi                            find your shop, i.e. Kiwi Electronics   

    * A 2.5 A micro USB connection  your phone charger, or similar

    * A microSD card, at least 16G    i.e. this one


This is what you'll do

  • Install BarterDEX on your computer or Pi
  • Have a look around
  • Fund your smart addresses
  • Do an decentralized trade
  • Learn how to run BarterDEX from your terminal
  • Define what coins you want to auto trade
  • Run BarterDEX on your Raspberry Pi on startup
  • Learn how to refund once a while


This is a lot of new stuff

If you prepare, it might save time and give some extra understanding.


These are some resources you could check:

    * BarterDEX whitepaper v2

    * BarterDEX section (Part III) in Komodo whitepaper

    * Video showing the BarterDEX graphical user interface

    * Download BarterDEX (you need to use a terminal to use it)


More advanced stuff:

    * BarterDEX FAQ (in docs)

welcome to the future


@The_Hague_Tech  π  2018-03-30


11.00  Introduction by barv

11.15  Komodo & BarterDEX by diesmaster

11.45  Scope of the course by bartwr

12.00  Installing & using BarterDEX

13.00  Lunch! sponsored by

13.45  Become a LP

Mission 1

Do a trade using BarterDEX

0. BarterDEX basics

(talk by barv & diesmaster)

1. Install BarterDEX

1. Install BarterDEX

Git installed?

  1. Go to

  2. Follow the instructions

Easy installation

  1. Go to

  2. Download the ZIP: linux, osx or win
  3. Open your terminal
  4. Navigate to the extracted ZIP folder
  5. In your terminal: npm install

2. Start BarterDEX

2. Start BarterDEX

  1. Have a terminal open
  2. Navigate to the BarterDEX directory
  3. npm start
  4. Click "Generate a new passphrase"

2. Start BarterDEX

2. Start BarterDEX

3. Add coins

          .you want to trade

3. Add coins

  1. Click on the Add coins button
  2. Select the coin you wish
  3. Toggle Native Mode to Electrum Mode
  4. Click Enable
  5. Repeat

4. Fund your addresses

4. Fund your addresses

In your portfolio you, click one of the Receive buttons.

4. Fund your addresses

Send the right type of tokens to your smart address in BarterDEX. If you are unsure: ask someone to double check

check range awkward lazy allow fog business mutual raw loud surface town

4. Fund your addresses

Repeat for other coins.


One of the end results could be:

    * 30 KMD

    * 250 CHIPS


From that moment you can give liquidity for:

    * KMD => CHIPS

    * CHIPS => KMD

5. Optimize portfolio

5. Optimize portfolio

BarterDEX does not use balances but UTXO's while doing trades. It needs small unspent transactions.


To make a better set of UTXO's for use for BarterDEX, you can easily split your balance into small UTXO's.

1. Click on Exchange next to a
    coin you own.

2. Click the Inventory button

3. Click Make Inventory

6. Do a trade

6. Do a trade

Click on Exchange next to a coin you own.

In the order book: Click a sellers row.

6. Do a trade

Optional: Fill in the amount you want to buy.

<= Now click BUY

6. Do a trade

You can follow the realtime status of your trade in the Trade Status tab.

<= Sometimes it takes a while before a
      trade appears here. If > 3 minutes: retry.

your first trade.

Mission 2

 Set up your LP using the GUI

GUI = Graphical User Interface

1. Be LP using the GUI

1. Select a trading pair.


2. Check Enable auto-price market maker mode


3. Define the margin percentage


4. Click Set auto buy margin %


5. Done! You're now a Liquidity Provider (keep your GUI open)


Mission 3

We're going to run BarterDEX from a terminal. Choose:

Mission 4

Prepare your Raspberry Pi

1. Required hardware

1. Required hardware

Before we start configuring your Raspberry Pi, let's check if you have everything. You need:

  • A Raspberry Pi 2 or 3
  • A micro-SD card of 16G (or more)
  • A micro-USB cable, 2.5A
  • Optional: screen, keyboard, mouse

2. Install Rasbian

To use the Raspberry Pi, we need an OS. We can for example use Linux. In this guide we use NOOBS for installing Raspbian.

2. Install Raspbian

On your laptop:

  1. Format & partition your micro SD card
  2. Download NOOBS for R.Pi (direct download)
  3. Extract the ZIP contents to your SD card


On your Pi:

  1. Connect power to the Raspberry Pi
  2. (Set up your WiFi connection)
  3. Check Raspbian & click the Install button


After some time Raspbian will be succesfully installed.

3. Use SSH to connect

If you want to access the Raspberry Pi using SSH, you can do the following.


On your laptop:

  1. Boot your micro SD card
  2. Create the file ssh in the root folder of the SD card
    the filename is literally 'ssh'


3. Use SSH to connect

On your Pi:

  1. Boot your Raspberry Pi  (connect power)
  2. Wait 30 seconds so that the Pi can boot
  3. Open a Terminal, so you can change the ssh passwd
  4. Type passwd
    • Your current password = raspberry
    • Fill in your new password twice

3. Use SSH to connect

From now you can easily connect with your Pi, by executing the following command in your Terminal (or using Putty if you have Windows):


    ssh pi@
                               ^ IP-adres van de Raspberry Pi

4. Use VNC to connect

It's nice if you can use the graphical user interface of the Pi without the need of a keyboard, mouse & screen.


We can have a remote desktop connection with our Pi to interact. For this we need a tool like VNC.


4. Use VNC to connect

With these actions you'll enable VNC on your Pi:


  1. Boot your Pi
  2. Open Menu (raspberry icon in left top corner)
  3. Hover Preferences
  4. Click Raspberry Pi Configuration
  5. Click the Interfaces tab
  6. Enable VNC
  7. Save your changes by clicking OK

4. Use VNC to connect

With these actions you'll start a remote desktop connection from your desktop.


  1. Download & Install VNC Viewer
  2. Open VNC Viewer
  3. Fill in the IP address of the Pi
  4. Click Connect

3. Install things on Pi

3. Install things on Pi

For the first run, it's most easy if you connect a keyboard, mouse, screen.


Connect keyboard/mouse/screen and boot up your Pi.


3. Install things on Pi

Now update all the things

sudo apt update
sudo apt full-upgrade -y

Mission 5

Run BarterDEX from a terminal

on your laptop or pi

1. Install prerequisites

The following slides show parts of this GitHub wiki page.

1. Install prerequisites

Install the following packages:


sudo apt-get update
sudo apt-get install cmake git libcurl4-openssl-dev build-essential

1. Install prerequisites

Then, install nanomsg:





cd ~
git clone https://github.com/nanomsg/nanomsg
cd nanomsg
make -j2
sudo make install
sudo ldconfig



brew install nanomsg

^ You'll need to install homebrew (Google how to do it)

2. Clone DEX software

2. Clone DEX software

Clone the SuperNET repo from github & Install:


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

3. Set your passphrase

3. Set your passphrase

Remember that you generated a seed / passphrase, using the BarterDEX GUI?


We are going to run BarterDEX using the command line. Let's fill in your private passphrase:


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


Enter your passphrase.

Press CTRL+X then Y then ENTER to save the file.

4. Set userpass

           To securely interact with BarterDEX.

4. Set userpass

To interact with BarterDEX securely, you need a userpass. Once this is setup correctly you can start running BarterDEX!


To get your userpass, run BarterDEX:


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



Copy it.

4. Set userpass

Edit the userpass file:


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


Enter your userpass.

Press CTRL+X then Y then ENTER to save the file.

BarterDEX is now installed on your system.

5. Run BarterDEX

5. Run BarterDEX

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


cd ~/SuperNET/iguana/dexscripts
./client &                                               # <- This can take a while



And, don't close it.


Open a new terminal window to issue all other scripts/API calls. You'll learn about them next.

6. Configure coins

6. Configure coins

Almost there. You want to define what coins can be traded by others.


You configure tradable coins by editing the file electrum. If you like the configuration, save the file.


See http://pad.supernet.org/electrum-servers for electrum servers you can add to the electrum file.


Save the file and enable the coins you defined:



6. Start trading

See the contents of ./auto_chipskmd


cat ./auto_chipskmd


Start your auto trade bot:




You can also create other files like this one, for trading other pairs then just chips/kmd.

7. Summary

7. Summary

You run your LP node as follows:


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


You end the process like this:


pkill -15 marketmaker

x. Autostart LP on boot

x. Autostart LP on boot

Now your Raspberry Pi is configured well, you can make the Liquidity Provider process autostart on boot.


When you power up your Raspberry Pi, it will automatically start offering liquidity. You even don't need other cables/hardware than the power cable!


In the next step you will learn how to autostart your script on boot.

x. Autostart LP on boot

# Create a file for the auto start scripts:

sudo touch /etc/init.d/lp


# Make sure the script can be executed:

sudo chmod 755 /etc/init.d/lp


# Activate the auto start scripts:

sudo update-rc.d lp defaults

x. Autostart LP on boot

The file /etc/init.d/lp will contain the script you want to automatically execute everytime the Pi boots.


Let's define what should happen on boot: nano /etc/init.d/lp

pkill -15 marketmaker
cd ~/SuperNET/iguana/dexscripts
./client &
sleep 120
sleep 30
sleep 5

3. Save and exit:   Ctrl+X,   Y,   Enter

x. Autostart LP on boot

If you ever want to start the process manually, run:



this Good Friday Special is brought to you by