# Joinmarket support

JoinMarket is software to create a special kind of bitcoin transaction called a CoinJoin transaction. Its aim is to improve the confidentiality and privacy of bitcoin transactions.

You will be able to use your bitcoin to help other protect their privacy, while earning a yield for this service.

See the documentation of the joinmarket project (opens new window) for more details.

This is a very advanced functionality, and there is no easy way to recover if something goes wrong.

For hardcore bitcoiners only.

# How to use

BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-add-joinmarket"
. btcpay-setup.sh -i

Then you need to setup your default joinmarket wallet:

jm.sh wallet-tool-generate
jm.sh set-wallet <wallet_file_name> <password>

Once done, you will need to send some money to the joinmarket wallet:

jm.sh wallet-tool

# How to change joinmarket configuration?

Connect to your container, and edit your configuration:

jm.sh bash
vim $CONFIG

# Managing your wallet

By running jm.sh without parameter, you will get a bunch of command that you can run such as:

Usage:
------

Tooling to setup your joinmarket yield generator

    wallet-tool: Run wallet-tools.py on the wallet
    wallet-tool-generate: Generate a new wallet
    set-wallet: Set the wallet that the yield generator need to use
    bash: Open an interactive bash session in the joinmarket container
    receive-payjoin: Receive a payjoin payment
    sendpayment: Send a payjoin through coinjoin (password needed)

Example:
    * jm.sh wallet-tool-generate
    * jm.sh set-wallet wallet.jmdat mypassword
    * jm.sh wallet-tool
    * jm.sh receive-payjoin <amount>
    * jm.sh sendpayment <amount> <address>
    * jm.sh wallet-tool history
    * jm.sh bash

Note jm.sh commands are wrapper around joinmarket scripts. Those are just convenience command, you can always directly connect to the container via jm.sh bash and achieve the same result with the joinmarket python scripts.

# Getting command prompt into the container

You can connect to the container and have direct access to joinmarket scripts such as:

jm.sh bash
sendpayment.py wallet.jmdat ...

# Managing the services such as yield generators

First connect to the container's bash

jm.sh bash

You can list available services to run:

supervisorctl status

Which might show you

root> supervisorctl status
ob-watcher                       STOPPED   Not started
yg-privacyenhanced               STOPPED   Not started
yield-generator-basic            STOPPED   Not started

You can start a yield generator with:

supervisorctl start yg-privacyenhanced

*** Note that services will NOT be restarted automatically if the container restart. ***

If you want to automatically restart the service when the container restart,

vim $AUTO_START

Then remove the comment # in front of the service name you want to automatically restart.

# OB-Watcher

The ob-watcher service allows you to see an order book (opens new window).

You can activate it:

supervisorctl start ob-watcher

Then you can browse it by browsing https://<your-server>.com/obwatch/

# Troubleshooting

# Error: Failed to load wallet, you need to remove the lock file

You might sometimes get the following error when running a python script for joinmarket:

Failed to load wallet, error message: RetryableStorageError('File is currently in use (locked by pid 12822). If this is a leftover from a crashed instance you need to remove the lock file `/root/.joinmarket/wallets/.wallet.jmdat.lock` manually.')

This is because a service using the wallet is running, so you need to shut it down before running the command.

Check which service is running:

supervisorctl status

And stop it

supervisorctl stop yg-privacyenhanced

# Read the logs of services

You can use the supervisorctl tail command:

supervisorctl tail yg-privacyenhanced

You can also check the logs in the $DATADIR/logs folder.