diff --git a/README.md b/README.md index 6009ed2..6835d26 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,7 @@ Available `BTCPAYGEN_ADDITIONAL_FRAGMENTS` currently are: * [opt-add-zammad](docker-compose-generator/docker-fragments/opt-add-zammad.yml) for [Zammad](https://zammad.com/features), a web based open source helpdesk/customer support system with many features to manage customer communication via several channels like telephone, facebook, twitter, chat and e-mails * [opt-monero-expose](docker-compose-generator/docker-fragments/opt-monero-expose.yml) to expose monero node's RPC port at 127.0.0.1:18081 to connect your own wallet. Use f.e. ssh port forwarding to forward to your own computer. * [opt-add-fireflyiii](docker-compose-generator/docker-fragments/opt-add-fireflyiii.yml) ([See the documentation](docs/fireflyiii.md)) +* [opt-add-joinmarket](docker-compose-generator/docker-fragments/opt-add-joinmarket.yml) ([See the documentation](docs/joinmarket.md)) You can also create your own [custom fragments](#how-can-i-customize-the-generated-docker-compose-file). @@ -347,10 +348,11 @@ We are trying to update our dependencies to run on `arm32v7` and `x64` boards. H | btcpayserver/btctransmuter | 0.0.57 | [✔️](https://raw.githubusercontent.com/btcpayserver/btctransmuter/v0.0.57/Dockerfiles/amd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/btctransmuter/v0.0.57/Dockerfiles/arm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/btctransmuter/v0.0.57/Dockerfiles/arm64v8.Dockerfile) | [Github](https://github.com/btcpayserver/btctransmuter) - [DockerHub](https://hub.docker.com/r/btcpayserver/btctransmuter) | | btcpayserver/btcpayserver-configurator | 0.0.21 | [✔️](https://raw.githubusercontent.com/btcpayserver/btcpayserver-configurator/v0.0.21/Dockerfiles/amd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/btcpayserver-configurator/v0.0.21/Dockerfiles/arm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/btcpayserver-configurator/v0.0.21/Dockerfiles/arm64v8.Dockerfile) | [Github](https://github.com/btcpayserver/btcpayserver-configurator) - [DockerHub](https://hub.docker.com/r/btcpayserver/btcpayserver-configurator) | | btcpayserver/eps | 0.2.1.1 | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/EPS/0.2.1.1/EPS/0.2.1.1/linuxamd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/EPS/0.2.1.1/EPS/0.2.1.1/linuxarm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/EPS/0.2.1.1/EPS/0.2.1.1/linuxarm64v8.Dockerfile) | [Github](https://github.com/btcpayserver/dockerfile-deps) - [DockerHub](https://hub.docker.com/r/btcpayserver/eps) | +| btcpayserver/joinmarket | 0.9.1 | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/JoinMarket/0.9.1/JoinMarket/0.9.1/linuxamd64.Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/btcpayserver/dockerfile-deps) - [DockerHub](https://hub.docker.com/r/btcpayserver/joinmarket) | | nicolasdorier/ndlc-cli | 1.0.1 | [✔️](https://raw.githubusercontent.com/dgarage/ndlc/releases/1.0.1/amd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/dgarage/ndlc/releases/1.0.1/arm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/dgarage/ndlc/releases/1.0.1/arm64v8.Dockerfile) | [Github](https://github.com/dgarage/ndlc) - [DockerHub](https://hub.docker.com/r/nicolasdorier/ndlc-cli) | | pihole/pihole | v5.7 | [✔️](https://raw.githubusercontent.com/pi-hole/docker-pi-hole/v5.7/Dockerfile) | [✔️](https://raw.githubusercontent.com/pi-hole/docker-pi-hole/v5.7/Dockerfile) | [✔️](https://raw.githubusercontent.com/pi-hole/docker-pi-hole/v5.7/Dockerfile) | [Github](https://github.com/pi-hole/docker-pi-hole) - [DockerHub](https://hub.docker.com/r/pihole/pihole) | | btcpayserver/tor | 0.4.4.7 | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Tor/0.4.4.7/Tor/0.4.4.7/linuxamd64.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Tor/0.4.4.7/Tor/0.4.4.7/linuxarm32v7.Dockerfile) | [✔️](https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Tor/0.4.4.7/Tor/0.4.4.7/linuxarm64v8.Dockerfile) | [Github](https://github.com/btcpayserver/dockerfile-deps) - [DockerHub](https://hub.docker.com/r/btcpayserver/tor) | -| postgres | 13.3 | [✔️](https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile) | [✔️](https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile) | [✔️](https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile) | [Github](https://github.com/docker-library/postgres) - [DockerHub](https://hub.docker.com/_/postgres) | +| postgres | 9.6.20 | [✔️](https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile) | [✔️](https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile) | [✔️](https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile) | [Github](https://github.com/docker-library/postgres) - [DockerHub](https://hub.docker.com/_/postgres) | | kamigawabul/docker-bitcoingold | 0.15.2 | [✔️](https://raw.githubusercontent.com/Vutov/docker-bitcoin/master/bitcoingold/0.15.2/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/Vutov/docker-bitcoin) - [DockerHub](https://hub.docker.com/r/kamigawabul/docker-bitcoingold) | | kamigawabul/btglnd | latest | [✔️](https://raw.githubusercontent.com/vutov/lnd/master/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/vutov/lnd) - [DockerHub](https://hub.docker.com/r/kamigawabul/btglnd) | | acinq/eclair | release-0.4.1 | [✔️](https://raw.githubusercontent.com/ACINQ/eclair/v0.4.1/Dockerfile) | ️❌ | ️❌ | [Github](https://github.com/ACINQ/eclair) - [DockerHub](https://hub.docker.com/r/acinq/eclair) | diff --git a/contrib/DockerFileBuildHelper/Program.cs b/contrib/DockerFileBuildHelper/Program.cs index 647a5f8..005fb72 100644 --- a/contrib/DockerFileBuildHelper/Program.cs +++ b/contrib/DockerFileBuildHelper/Program.cs @@ -246,6 +246,12 @@ namespace DockerFileBuildHelper dockerInfo.GitRef = $"EPS/{image.Tag}"; dockerInfo.SupportedByUs = true; break; + case "joinmarket": + dockerInfo.DockerFilePath = $"JoinMarket/{NoRevision(image.Tag)}/linuxamd64.Dockerfile"; + dockerInfo.GitLink = "https://github.com/btcpayserver/dockerfile-deps"; + dockerInfo.GitRef = $"JoinMarket/{image.Tag}"; + dockerInfo.SupportedByUs = true; + break; case "btglnd": dockerInfo.DockerFilePath = "Dockerfile"; dockerInfo.GitLink = "https://github.com/vutov/lnd"; diff --git a/contrib/build-all-images.sh b/contrib/build-all-images.sh index fcc9dc5..4e39c64 100644 --- a/contrib/build-all-images.sh +++ b/contrib/build-all-images.sh @@ -689,6 +689,18 @@ docker build -f "$DOCKERFILE" -t "fireflyiii/core:latest" . cd - && cd .. +# Build joinmarket +# https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/JoinMarket/0.9.1/JoinMarket/0.9.1/linuxamd64.Dockerfile +DOCKERFILE="JoinMarket/0.9.1/linuxamd64.Dockerfile" +echo "Building btcpayserver/joinmarket:0.9.1" +git clone https://github.com/btcpayserver/dockerfile-deps joinmarket +cd joinmarket +git checkout JoinMarket/0.9.1 +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "btcpayserver/joinmarket:0.9.1" . +cd - && cd .. + + # Build librepatron # https://raw.githubusercontent.com/JeffVandrewJr/patron/v0.7.39/Dockerfile DOCKERFILE="Dockerfile" @@ -994,12 +1006,12 @@ DOCKERFILE="9.6/Dockerfile" [[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="9.6/Dockerfile" # https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile [[ "$(uname -m)" == "aarch64" ]] && DOCKERFILE="9.6/Dockerfile" -echo "Building postgres:13.3" +echo "Building postgres:9.6.20" git clone https://github.com/docker-library/postgres postgres cd postgres git checkout b7cb3c6eacea93be2259381033be3cc435649369 cd "$(dirname $DOCKERFILE)" -docker build -f "$DOCKERFILE" -t "postgres:13.3" . +docker build -f "$DOCKERFILE" -t "postgres:9.6.20" . cd - && cd .. diff --git a/docker-compose-generator/docker-fragments/opt-add-joinmarket.yml b/docker-compose-generator/docker-fragments/opt-add-joinmarket.yml new file mode 100644 index 0000000..df46fbf --- /dev/null +++ b/docker-compose-generator/docker-fragments/opt-add-joinmarket.yml @@ -0,0 +1,43 @@ +version: "3" + +services: + joinmarket: + container_name: joinmarket + image: btcpayserver/joinmarket:0.9.1 + restart: 'no' + environment: + READY_FILE: /root/.nbxplorer/btc_fully_synched + ENSURE_WALLET: 1 + jm_gaplimit: 2000 + jm_tor_control_host: tor + jm_tor_control_port: 9051 + jm_onion_socks5_host: tor + jm_onion_socks5_port: 9050 + jm_socks5_host: tor + jm_socks5_port: 9050 + jm_network: ${NBITCOIN_NETWORK:-regtest} + jm_rpc_host: bitcoind + jm_rpc_port: 43782 + jm_rpc_user: joinmarket + jm_rpc_password: afixedpasswordforjoinmarket + volumes: + - "joinmarket_datadir:/root/.joinmarket" + - "nbxplorer_datadir:/root/.nbxplorer" + - "tor_datadir:/home/tor/.tor" + links: + - bitcoind + + bitcoind: + environment: + BITCOIN_EXTRA_ARGS: | + # rpcuser=joinmarket + # rpcpassword=afixedpasswordforjoinmarket + # We need to use rpcauth because we also need cookieauth. rpcpassword disabled cookie file auth. + # Be careful if you copy the line below from the docker-compose.yml! A dollar sign is escaped. + rpcauth=joinmarket:4b4dbcb712557eb8c8bfd56a2b6a7707$$6497d80877f10dc375829724f369f546b070fc706121a361438a4a1e51025bea + +volumes: + joinmarket_datadir: + +required: + - "opt-add-tor" diff --git a/docs/joinmarket.md b/docs/joinmarket.md new file mode 100644 index 0000000..05ecb14 --- /dev/null +++ b/docs/joinmarket.md @@ -0,0 +1,117 @@ +# 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](https://github.com/JoinMarket-Org/JoinMarket-Docs/blob/master/High-level-design.md) 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 + +```bash +BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-add-joinmarket" +. btcpay-setup.sh -i +``` + +Then you need to setup your joinmarket wallet: + +```bash +jm.sh wallet-tool-generate +jm.sh set-wallet +``` + +Once done, you will need to send some money to the joinmarket wallet: + +```bash +jm.sh wallet-tool +``` + +## How to fine tune? + +In the [README](../README.md), follow the instruction in `How can I customize the generated docker-compose file?`. +Then pass as environment variable the attribute you want to modify, prefixed by `jm_`. + +Our system is using the default configuration of joinmarket, then replace the values your specify like this. + +Example: + +```yml +services: + joinmarket: + environment: + jm_gaplimit: 3000 + jm_txfee: 300 + jm_cjfee_a: 500 +``` + +## Managing your wallet + +By running `jm.sh` without parameter, you will get a bunch of command that you can run such as: + +For example: +``` +Usage: +------ + +Tooling to setup your joinmarket yield generator + + exec: Run the specified joinmarket script + 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 + logs: See logs of the yield generator (add -f to follow the logs) + bash: Open an interactive bash session in the joinmarket container + receive-payjoin: Receive a payjoin payment (this will stop the yield generator until the payment is received) + sendpayment: Send a payjoin through coinjoin (password needed, this will stop the yield generator until the payment is received) + start: Start the yield generator (started by default) + stop: Stop the yield generator + +Example: + * jm.sh wallet-tool-generate + * jm.sh set-wallet wallet.jmdat mypassword + * jm.sh wallet-tool + * jm.sh receive-payjoin + * jm.sh sendpayment
+ * jm.sh wallet-tool history + * jm.sh logs -f + * jm.sh bash + * jm.sh start + * jm.sh stop +``` + +Note `jm.sh` commands are wrapper around joinmarket scripts. Those wrapper makes your life easier by: +1. Avoiding, when it can, that you enter wallet file name/ wallet password +2. Stop and Start the yield generator for the duration of the operation + +In some cases you might want to get access to the raw scripts of joinmarket, in which case, you need to get the command prompt into the container. + +## Getting command prompt into the container + +You can connect to the container and have direct access to joinmarket scripts such as: + +```bash +jm.sh bash +sendpayment.py wallet.jmdat ... +``` + +However, you might get the following error: + +``` +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 the yield generator is running. + +You can stop and start the yield generator with the helper scripts in the container `stop.sh` and `start.sh`. + + +## Troubleshooting + +Run `jm.sh logs` to get the logs of the yield generator. + +A common issue is that a lock file is present, preventing it to restart. +In which case, connect directly into the container with `jm.sh bash` and delete the problematic file. \ No newline at end of file diff --git a/helpers.sh b/helpers.sh index f175f2d..c0f55ee 100755 --- a/helpers.sh +++ b/helpers.sh @@ -18,6 +18,7 @@ install_tooling() { "btcpayserver_trezarcoind" "trezarcoin-cli.sh" "Command line for your Trezar instance" \ "btcpayserver_viacoind" "viacoin-cli.sh" "Command line for your Viacoin instance" \ "btcpayserver_elementsd" "elements-cli.sh" "Command line for your Elements/Liquid instance" \ + "joinmarket" "jm.sh" "Command line for your joinmarket instance" \ "ndlci_cli" "ndlc-cli.sh" "Command line for NDLC-CLI" \ "pihole" "pihole.sh" "Command line for running pihole commands" \ "*" "btcpay-clean.sh" "Command line for deleting old unused docker images" \ diff --git a/jm.sh b/jm.sh new file mode 100755 index 0000000..8fa4e5e --- /dev/null +++ b/jm.sh @@ -0,0 +1,132 @@ +#!/bin/bash + +function display_help () { +cat <<-END +Usage: +------ + +Tooling to setup your joinmarket yield generator + + exec: Run the specified joinmarket script + 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 + logs: See logs of the yield generator (add -f to follow the logs) + bash: Open an interactive bash session in the joinmarket container + receive-payjoin: Receive a payjoin payment (this will stop the yield generator until the payment is received) + sendpayment: Send a payjoin through coinjoin (password needed, this will stop the yield generator until the payment is received) + start: Start the yield generator (started by default) + stop: Stop the yield generator + +Example: + * jm.sh wallet-tool-generate + * jm.sh set-wallet wallet.jmdat mypassword + * jm.sh wallet-tool + * jm.sh receive-payjoin + * jm.sh sendpayment
+ * jm.sh wallet-tool history + * jm.sh logs -f + * jm.sh bash + * jm.sh start + * jm.sh stop + +See https://github.com/btcpayserver/btcpayserver-docker/tree/master/docs/joinmarket.md for more information. +END +} + +while (( "$#" )); do + case "$1" in + exec) + CMD="$1" + shift 1 + break; + ;; + logs) + CMD="$1" + shift 1 + break; + ;; + bash) + CMD="$1" + shift 1 + break; + ;; + wallet-tool) + CMD="$1" + shift 1 + break; + ;; + set-wallet) + CMD="$1" + shift 1 + break; + ;; + receive-payjoin) + CMD="$1" + shift 1 + break; + ;; + sendpayment) + CMD="$1" + shift 1 + break; + ;; + start) + CMD="$1" + shift 1 + break; + ;; + stop) + CMD="$1" + shift 1 + break; + ;; + wallet-tool-generate) + CMD="$1" + shift 1 + break; + ;; + --) # end argument parsing + shift + break + ;; + -*|--*=) # unsupported flags + echo "Error: Unsupported flag $1" >&2 + display_help + return + ;; + *) # preserve positional arguments + PARAMS="$PARAMS $1" + shift + ;; + esac +done + +if ! [[ "$CMD" ]]; then + display_help +else + if [[ "$CMD" == "wallet-tool" ]]; then + docker exec joinmarket wallet-tool.sh "$@" + elif [[ "$CMD" == "wallet-tool-generate" ]]; then + docker exec -ti joinmarket exec-wrapper.sh wallet-tool.py generate "$@" + elif [[ "$CMD" == "sendpayment" ]]; then + docker exec -ti joinmarket exec-wrapper.sh sendpayment.sh "$@" + elif [[ "$CMD" == "receive-payjoin" ]]; then + docker exec -ti joinmarket exec-wrapper.sh receive-payjoin.sh "$@" + elif [[ "$CMD" == "set-wallet" ]]; then + docker exec joinmarket set-wallet.sh "$@" + docker restart joinmarket + elif [[ "$CMD" == "exec" ]]; then + docker exec joinmarket exec-wrapper.sh "$@" + elif [[ "$CMD" == "logs" ]]; then + docker logs "$@" joinmarket + elif [[ "$CMD" == "bash" ]]; then + docker exec -ti joinmarket exec-wrapper.sh bash "$@" + elif [[ "$CMD" == "stop" ]]; then + docker exec joinmarket exec-wrapper.sh stop.sh + elif [[ "$CMD" == "start" ]]; then + docker exec joinmarket exec-wrapper.sh start.sh + else + display_help + fi +fi