A long standing coinjoin implementation with decentralised coordination and incentive structure.
- RPi4 4GB with RaspiBlitz v1.4
- Odroid HC1 with RaspiBlitz v1.3
Check the current offers in a public book: https://nixbitcoin.org/obwatcher/ or run your own.
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.
Check out the JoininBox project for a terminal based menu and helper UI for JoinMarket. Running on the RaspiBlitz or remotely connected to a full node.
Now you can use the automated install script which will be the part of the RaspiBlitz v1.5 release and can be installed from the 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
sudo su - joinmarket
- Can also use the JoinMarket-QT GUI to 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.jmdat
Will 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
You can pay or withdraw to an external address with (or without) a CoinJoin using the
(jmvenv)$ python sendpayment.py -N5 -m1 WALLET.jmdat 100000000 mprGzBA9rQk82Ly41TsmpQGa8UPpZb2w8c
Sends 1BTC (100 million satoshis) from mixing depth 1 (the second!), mixing with five other parties.
- The most importan options (see all with –help):
-N MAKERCOUNT, --makercount=MAKERCOUNT how many makers to coinjoin with, default random from 5 to 7 -m MIXDEPTH, --mixdepth=MIXDEPTH mixing depth to spend from, default=0 (choose one from 0 to 4)
Described in: https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/USAGE.md#try-out-a-coinjoin-using-sendpaymentpy
- Can also use the JoinMarket-QT GUI to send payments.
Edit the joinmarket.cfg:
$ sudo nano /home/joinmarket/.joinmarket/joinmarket.cfg
tx_fees = 3and change to
tx_fees = 3000to pay 3 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.
tx_fee = 10to aim confirmation within 10 blocks.
- Maker (coinjoin) fees:
#max_cj_fee_abs = xto
max_cj_fee_abs = 2000to pay max 2000 sats per maker when coinjoining (more restrictive for higher amounts)
#max_cj_fee_rel = xto
max_cj_fee_rel = 0.001to pay max 0.1% per relative offer when coinjoining.
These settings might make it difficult to find counterparties to coinjoin with, see the order book for the market and increase the limits if the offers are scarce or running into errors.
- press CTRL + o, ENTER to save and CTRL + x to exit.
- List all UTXO-s in the WALLET with:
(jmvenv)$ python wallet-tool.py WALLET.jmdat
- Pick a mixdepth (-m[0-4]) to transfer from:
- Run the
(jmvenv)$ python wallet-tool.py -m0 WALLET.jmdat freeze
- The script will ask which UTXO to freeze or unfreeze - you can keep pressing the numbers to choose.
- Once done use
Sweep the mixdepth with
-N 0to send the NOT FROZEN UTXO-s without a coinjoin:
(jmvenv)$ python sendpayment.py -N 0 WALLET.jmdat 0 DESTINATION_BITCOIN_ADDRESS
- Can also use the JoinMarket-QT GUI for coin control.
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.
Can also use the JoinMarket-QT GUI to run the Tumbler.
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 customization
ordertypesets either a relative (
swreloffer) or an absolute (
swabsoffer) coinjoin fee model
cjfee_ais the fixed coinjoin fee to be earned when using
cjfee_ris the relative fee when using
swreloffer. Specified as the fraction of the used amount.
txfeeis the maker’s contribution to the miner fee. To reduce the minimum offer amount for
swrelofferset 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
Send or receive a payment using PayJoin between two JoinMarket wallets.
see the how-to: https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/PAYJOIN.md#doing-a-payjoin-payment
Video demonstration: https://asciinema.org/a/221153?speed=2
use the wallet tool:
(jmvenv) $ python wallet-tool.py wallet.jmdat history
-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
Monitor continously with:
$ tail -f -n 100 ~/.joinmarket/logs/yigen-statement.csv
Running in the background with Tmux
$ sudo su joinmarket
- 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
- 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
The graphical interface can run on the desktop relayed from the node via an encrypted ssh tunnel.
h/t @coconutanna on the #joinmarket Freenode IRC channel
- Tested on:
- Debian Buster
Use the line in the desktop terminal to connect:
$ ssh -X joinmarket@RASPIBLITZ_IP joinmarket-clientserver/jmvenv/bin/python joinmarket-clientserver/scripts/joinmarket-qt.py
- Use the PASSWORD_B to log in.
- install XQuartz
- Enter the command as above in a Mac terminal, XQuartz will load and show QT GUI.
Thanks to @k3tan172
- Download, install and run XMing with the default settings - https://xming.en.softonic.com/
- Open Putty and fill in:
[x] Enable X11 forwarding
- These settings can be saved in
Load. save or delete stored session->
- Use the
PASSWORD_Bto log in
- In the terminal type:
- The QT GUI will appear on the windows desktop running from your RaspiBlitz.
Thanks for the initial demo by Hamish MacEwan
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
The order book is usually available at https://nixbitcoin.org/obwatcher/. 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 and serve the order book itself:
run in Tmux (as described above) to keep running when the terminal is closed.
(jmvenv)$ cd ~/joinmarket-clientserver/scripts/obwatch (jmvenv)$ python ob-watcher.py
- Create a .onion service:
use the RaspiBlitz script
$ /home/admin/config.scripts/internet.hiddenservice.sh ob-watcher 80 62601
visit the displayed
.onionhidden service address in the Tor Browser for the local order book.
- (optional) to have the graphs show install matplotlib in the virtual environment:
(jmvenv)$ pip install matplotlib
General docs on the order book (including how to run without Bitcoin Core): https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/orderbook.md
Example syntax to obtain the private keys (WIF format):
using the derivation path (m/…) as specified in the
wallet-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.
Import Bitcoin Addresses or private keys
- paste the private key you want to use as:
- Notes on usage:
- Latest codebase:
- Bitcoin privacy wiki:
- More links and info in 6102bitcoin/CoinJoin-Research:
- Check the guide for the RaspiBolt by @kristapsk:
- Default joinmarket.cfg settings: https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/jmclient/jmclient/configure.py#L94
- 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