JoinMarket on the RaspiBlitz
A long standing coinjoin implementation with decentralised coordination and incentive structure.
Tested on:
- RPi4 4GB with RaspiBlitz v1.4
- Odroid HC1 with RaspiBlitz v1.3
Check the current offers in the order book: https://joinmarket.me/ob/
One can coinjoin any amount within the offer limits by default with 5-7 random participants at a time. The taker fees are maximised, then the offers within the limits are randomly chosen to participate. Most parameters can be easily customized.
Installation
Now you can use the automated install script which will be the part of the RaspiBlitz v1.5 release and can be installed form SERVICES menu.
What the script does:
- sets up a separate user:
joinmarketwith sudo access. Uses the PASSWORD_B as the user password - the data directory is on the disk at
/mnt/hdd/app-data/.joinmarket, symlinked to/home/joinmarket/.joinmarketand will be kept during the SD-card updates - if joinmarket was set up already using a previous version of this tutorial the the wallet(s) will be copied to the new data directory automatically
- will be compatible with GUI being worked on here: https://github.com/openoms/joininbox
To install JoinMarket on RaspiBlitz v1.4 (earlier versions are not supported):
#download:
wget https://raw.githubusercontent.com/rootzoll/raspiblitz/v1.5/home.admin/config.scripts/bonus.joinmarket.sh
#run:
sudo bash bonus.joinmarket.sh on
Start by logging in with the joinmarket user:
sudo su - joinmarket
Generate a wallet
-
Using the JoinMarket wallet: https://github.com/JoinMarket-Org/joinmarket/wiki/Using-the-JoinMarket-internal-wallet
(jmvenv) $ python wallet-tool.py generate- JoinMarket uses a hot wallet sitting on your Raspberry Pi. Keep it safe.
- Backup your seed and store safely. Best to not keep the seed and the passphrase together.
- The wallet encryption password will be needed every time when there is interaction with the wallet. Store it somewhere accessible, best if encrypted.
-
Display the addresses of the mixdepth zero to fund:
(jmvenv) $ python wallet-tool.py -m 0 wallet.jmdatWill display after the first run:
[INFO] Detected new wallet, performing initial import restart Bitcoin Core with -rescan or use `bitcoin-cli rescanblockchain` if you're recovering an existing wallet from backup seed Otherwise just restart this joinmarket application.Run again to see the addresses of the mixdepth zero (fund the first one):
(jmvenv) $ python wallet-tool.py -m 0 wallet.jmdat
Send payments with a coinjoin with the sendpayment.py
You can pay or withdraw to an external address with (or without) a CoinJoin using the sendpayment.py.
-
Described in: https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/USAGE.md#try-out-a-coinjoin-using-sendpaymentpy
-
How to keep fees to minimum:
- Edit the joinmarket.cfg:
$ sudo nano /home/joinmarket/.joinmarket/joinmarket.cfg - Look for:
tx_fees = 3and change totxfees = 1200to pay 1.2 sats/byte (+/-20%) mining fee for transactions. Note that in times of high mempool usage it can take a long time to have transactions confirmed with this low fee. - Set
#max_cj_fee_abs = xtomax_cj_fee_abs = 100to pay max 100 sats per maker when coinjoining. - Set
#max_cj_fee_rel = xtomax_cj_fee_rel = 0.0001to pay max 0.01% per relative offer when coinjoining. These settings might make it difficult to find counterparties to coinjoin with, see the offerbook for the market and increase limit if offers are scarce or running into errors. - press CTRL + o, ENTER to save and CTRL + X to exit.
- Edit the joinmarket.cfg:
Tumbler script
The Tumbler does series of CoinJoins with various amounts and timing between them to break the link between different addresses. The Yield Generator only mixes the coins slowly but close to free (it is even possible to earn some fees). With the Tumbler the CoinJoin process is faster but the miner and maker fees are all paid by the taker running the Tumbler.
Run a Yield Generator
-
Read the basics: https://github.com/JoinMarket-Org/joinmarket/wiki/Running-a-Yield-Generator
-
Edit the settings:
$ nano yg-privacyenhanced.py"""THESE SETTINGS CAN SIMPLY BE EDITED BY HAND IN THIS FILE: """ ordertype = 'swreloffer' # [string, 'swreloffer' or 'swabsoffer'] / which fee type to actually use cjfee_a = 500 # [satoshis, any integer] / absolute offer fee you wish to receive for coinjoins (cj) cjfee_r = '0.00003' # [percent, any str between 0-1] / relative offer fee you wish to receive based on a cj's amount cjfee_factor = 0.1 # [percent, 0-1] / variance around the average fee. Ex: 200 fee, 0.2 var = fee is btw 160-240 txfee = 000 # [satoshis, any integer] / the average transaction fee you're adding to coinjoin transactions txfee_factor = 0.3 # [percent, 0-1] / variance around the average fee. Ex: 1000 fee, 0.2 var = fee is btw 800-1200 minsize = 500000 # [satoshis, any integer] / minimum size of your cj offer. Lower cj amounts will be disregarded size_factor = 0.1 # [percent, 0-1] / variance around all offer sizes. Ex: 500k minsize, 0.1 var = 450k-550k gaplimit = 6 # end of settings customizationordertypesets either a relative (swreloffer) or an absolute (swabsoffer) coinjoin fee modelcjfee_ais the fixed coinjoin fee to be earned when usingswabsoffercjfee_ris the relative fee when usingswreloffer. Specified as the fraction of the used amount.txfeeis the maker's contribution to the miner fees (still paid by the taker). To reduce the minimum offer amount forswrelofferset it to 0.minsizespecifies the minimum offer size in satoshis (this is the minimum size the UTXO will end up to be after participating in coinjoin)
-
Once set up run:
(jmvenv) $ python yg-privacyenhanced.py wallet.jmdat
Check the transaction history
-
use the wallet tool:
(jmvenv) $ python wallet-tool.py wallet.jmdat historyadd
-v 4to the end of the command for a more detailed list. -
View the log of the transactions of the Yield Generator:
$ cat ~/.joinmarket/logs/yigen-statement.csv -
Display as a table in the terminal:
$ column -s, -t < ~/.joinmarket/logs/yigen-statement.csv | less -#2 -N -S
pressqto exit -
Monitor continously with:
$ tail -f -n 100 ~/.joinmarket/logs/yigen-statement.csv
Keep the offers running in the background with Tmux
-
Start:
$ sudo su joinmarket
$ tmux -
Work in the terminal as described above.
Find a basic introduction to Tmux at https://www.ocf.berkeley.edu/~ckuehl/tmux/ -
To detach the Tmux session (and keep the processes running in the background) press
CTRL+b, thend. -
If the terminal is disconnected the processes in Tmux keep running (as it is running on the Blitz) and can be returned to
-
when logged in after a disconnection run:
$ tmux a
to pick up where left off
Remote connection with ssh -X
h/t @coconutanna on the #joinmarket Freenode IRC channel
Use the JoinMarket QT GUI on a desktop, connecting remotely to the node. It needs Xserver running locally so making it work on Mac and Windows requires some more input.
Try the remote QT GUI connection on Linux:
ssh -X joinmarket@RASPIBLITZ_IP joinmarket-clientserver/jmvenv/bin/python joinmarket-clientserver/scripts/joinmarket-qt.py
The password is the PASSWORD_B
Successfully tested to open the JoinMarket QT GUI remotely on a desktop running:
-
Debian Buster
-
Manjaro
-
Windows requires Xming or similar. Xming is likely to be used with Putty - waiting for confimation on this to work.
See the walkthrough for the JoinMarket-Qt GUI to send payments with coinjoin or run multiple coinjoins (tumbler): https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/JOINMARKET-QT-GUIDE.md
Video demonstration of using the JoinMarket-Qt GUI by @AdamISZ: https://youtu.be/hwmvZVQ4C4M
See this review thread about the GUI option: https://twitter.com/zndtoshi/status/1191799199119134720
Run the Offer Book locally
The offer book is usually available at https://joinmarket.me/ob. The page being down does not affect the functionality of JoinMarket. Communication between the nodes is encrypted and passing through IRC servers.
- Any JoinMarket instance can build the offer book itself:
Run in Tmux (as described above) to keep running when the terminal is closed.cd ~/joinmarket-clientserver/scripts/obwatch # install the matplotlib dependency first sudo apt install matplotlib python ob-watcher.py - Create a Hidden service:
Use the RaspiBlitz scriptinternet.hiddenservice.sh/home/admin/config.scripts/internet.hiddenservice.sh ob-watcher 80 62601 - visit the displayed
.onionhidden service address in the Tor Browser for the local offer book.
Export a private key of an individual UTXO-s to Electrum Wallet (advanced)
-
Example syntax to obtain the private keys (WIF format):
using the derivation path (m/...) as specified in thewallet-tool.pyoutput; note the need to use double quotes around it.(jmvenv)$python wallet-tool.py -H "m/49'/0'/4'/0/0" wallet.jmdat dumpprivkey Enter wallet decryption passphrase: L1YPrEGNMwwfnvzBfAiPiPC4zb5s6Urpqnk88zNHgsYLHrq2Umss -
Open Electrum Wallet and start to create a new wallet.
-
Select
Import Bitcoin Addresses or private keys -
paste the private key you want to use as:
p2wpkh-p2sh:WIF_FORMAT_PRIV_KEY
Resources
-
Notes on usage:
https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/USAGE.md https://github.com/JoinMarket-Org/joinmarket/wiki -
Latest codebase:
https://github.com/JoinMarket-Org/joinmarket-clientserver -
Bitcoin privacy wiki:
https://en.bitcoin.it/Privacy -
More links and info in 6102bitcoin/CoinJoin-Research:
https://github.com/6102bitcoin/CoinJoin-Research/blob/master/CoinJoin_Implementations/11_JoinMarket-JoinMarket-Org/summary.md -
Check the guide for the RaspiBolt by @kristapsk:
https://github.com/kristapsk/raspibolt-extras/blob/master/joinmarket.md
Forums
- IRC: #joinmarket on Freenode https://webchat.freenode.net/?channels=%23joinmarket
- IRC on tor:
#joinmarketon the networks AgoraIRC and Darkscience. These channels are bridged to the above freenode channel. - Reddit: https://www.reddit.com/r/joinmarket/
- Telegram: https://t.me/joinmarketorg
- Keybase: https://keybase.io/team/raspiblitz#joinmarket
- Bitcointalk thread: https://bitcointalk.org/index.php?topic=919116.msg10096563
- Twitter: https://twitter.com/joinmarket

