diff --git a/rootfs/standard/usr/bin/mynode-joininbox b/rootfs/standard/usr/bin/mynode-joininbox new file mode 100755 index 00000000..ff6a5c4c --- /dev/null +++ b/rootfs/standard/usr/bin/mynode-joininbox @@ -0,0 +1,6 @@ +#!/bin/bash + +# mynode-joininbox +# This script needs to be run with sudo so it can run as the joinmarket user + +sudo -u joinmarket bash -c "cd /home/joinmarket/; ./menu.sh" \ No newline at end of file diff --git a/rootfs/standard/usr/bin/mynode-joinmarket b/rootfs/standard/usr/bin/mynode-joinmarket new file mode 100755 index 00000000..3e913216 --- /dev/null +++ b/rootfs/standard/usr/bin/mynode-joinmarket @@ -0,0 +1,6 @@ +#!/bin/bash + +# mynode-joinmarket +# This script needs to be run with sudo so it can run as the joinmarket user + +sudo -u joinmarket bash -c "cd /home/joinmarket/; ./menu.sh" \ No newline at end of file diff --git a/rootfs/standard/usr/bin/mynode_post_bitcoin.sh b/rootfs/standard/usr/bin/mynode_post_bitcoin.sh index 6794df90..e2bf315b 100755 --- a/rootfs/standard/usr/bin/mynode_post_bitcoin.sh +++ b/rootfs/standard/usr/bin/mynode_post_bitcoin.sh @@ -10,5 +10,9 @@ sleep 60s cp -f /mnt/hdd/mynode/bitcoin/.cookie /home/admin/.bitcoin/.cookie chown admin:admin /home/admin/.bitcoin/.cookie +# Make default wallets +bitcoin-cli createwallet joinmarket_wallet.dat > /dev/null 2>&1 || true +bitcoin-cli loadwallet joinmarket_wallet.dat > /dev/null 2>&1 || true + # Sync FS sync \ No newline at end of file diff --git a/rootfs/standard/usr/bin/mynode_post_upgrade.sh b/rootfs/standard/usr/bin/mynode_post_upgrade.sh index 1b232bee..3c350fd8 100755 --- a/rootfs/standard/usr/bin/mynode_post_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_post_upgrade.sh @@ -24,7 +24,10 @@ if [ $IS_RASPI = 1 ]; then fi # Create any necessary users +useradd -m -s /bin/bash joinmarket || true +# User updates and settings +grep "joinmarket" /etc/sudoers || (echo 'joinmarket ALL=(ALL) NOPASSWD:ALL' | EDITOR='tee -a' visudo) # Check if upgrades use tor TORIFY="" @@ -95,7 +98,7 @@ $TORIFY apt-get -y -qq install apt-transport-https ca-certificates $TORIFY apt-get -y install libgmp-dev automake libtool libltdl-dev libltdl7 $TORIFY apt-get -y install xorg chromium openbox lightdm openjdk-11-jre libevent-dev ncurses-dev $TORIFY apt-get -y install libudev-dev libusb-1.0-0-dev python3-venv gunicorn sqlite3 libsqlite3-dev -$TORIFY apt-get -y install torsocks python3-requests libsystemd-dev libjpeg-dev zlib1g-dev +$TORIFY apt-get -y install torsocks python3-requests libsystemd-dev libjpeg-dev zlib1g-dev psmisc # Make sure some software is removed apt-get -y purge ntp # (conflicts with systemd-timedatectl) @@ -441,42 +444,79 @@ if [ ! -f /usr/include/secp256k1_ecdh.h ]; then fi # Upgrade JoinMarket -echo "Upgrading JoinMarket..." +# echo "Upgrading JoinMarket..." +# if [ $IS_RASPI = 1 ] || [ $IS_X86 = 1 ]; then +# JOINMARKET_UPGRADE_URL=https://github.com/JoinMarket-Org/joinmarket-clientserver/archive/$JOINMARKET_VERSION.tar.gz +# CURRENT="" +# if [ -f $JOINMARKET_VERSION_FILE ]; then +# CURRENT=$(cat $JOINMARKET_VERSION_FILE) +# fi +# if [ "$CURRENT" != "$JOINMARKET_VERSION" ]; then +# # Download and build JoinMarket +# cd /opt/mynode + +# # Backup old version in case config / wallet was stored within folder +# if [ ! -d /opt/mynode/jm_backup ] && [ -d /opt/mynode/joinmarket-clientserver ]; then +# cp -R /opt/mynode/joinmarket-clientserver /opt/mynode/jm_backup +# chown -R bitcoin:bitcoin /opt/mynode/jm_backup +# fi + +# rm -rf joinmarket-clientserver + +# sudo -u joinmarket wget $JOINMARKET_UPGRADE_URL -O joinmarket.tar.gz +# sudo -u joinmarket tar -xvf joinmarket.tar.gz +# sudo -u joinmarket rm joinmarket.tar.gz +# mv joinmarket-clientserver-* joinmarket-clientserver + +# cd joinmarket-clientserver + +# # Apply Patch to fix cryptography dependency +# sed -i "s/'txtorcon', 'pyopenssl'/'txtorcon', 'cryptography==3.3.2', 'pyopenssl'/g" jmdaemon/setup.py || true + +# # Install +# yes | ./install.sh --without-qt + +# echo $JOINMARKET_VERSION > $JOINMARKET_VERSION_FILE +# fi +# fi + +echo "Upgrading JoinInBox..." if [ $IS_RASPI = 1 ] || [ $IS_X86 = 1 ]; then - JOINMARKET_UPGRADE_URL=https://github.com/JoinMarket-Org/joinmarket-clientserver/archive/$JOINMARKET_VERSION.tar.gz + JOININBOX_UPGRADE_URL=https://github.com/openoms/joininbox/archive/$JOININBOX_VERSION.tar.gz CURRENT="" - if [ -f $JOINMARKET_VERSION_FILE ]; then - CURRENT=$(cat $JOINMARKET_VERSION_FILE) + if [ -f $JOININBOX_VERSION_FILE ]; then + CURRENT=$(cat $JOININBOX_VERSION_FILE) fi - if [ "$CURRENT" != "$JOINMARKET_VERSION" ]; then - # Download and build JoinMarket - cd /opt/mynode + if [ "$CURRENT" != "$JOININBOX_VERSION" ]; then + # Download and build JoinInBox + cd /home/joinmarket + + # Delete all non-hidden files + rm -rf * + rm -rf joininbox-* - # Backup old version in case config / wallet was stored within folder - if [ ! -d /opt/mynode/jm_backup ] && [ -d /opt/mynode/joinmarket-clientserver ]; then - cp -R /opt/mynode/joinmarket-clientserver /opt/mynode/jm_backup - chown -R bitcoin:bitcoin /opt/mynode/jm_backup - fi + sudo -u joinmarket wget $JOININBOX_UPGRADE_URL -O joininbox.tar.gz + sudo -u joinmarket tar -xvf joininbox.tar.gz + sudo -u joinmarket rm joininbox.tar.gz + mv joininbox-* joininbox - rm -rf joinmarket-clientserver + chmod -R +x ./joininbox/ + sudo -u joinmarket cp -rf ./joininbox/scripts/* . - sudo -u bitcoin wget $JOINMARKET_UPGRADE_URL -O joinmarket.tar.gz - sudo -u bitcoin tar -xvf joinmarket.tar.gz - sudo -u bitcoin rm joinmarket.tar.gz - mv joinmarket-clientserver-* joinmarket-clientserver - - cd joinmarket-clientserver - - # Apply Patch to fix cryptography dependency - sed -i "s/'txtorcon', 'pyopenssl'/'txtorcon', 'cryptography==3.3.2', 'pyopenssl'/g" jmdaemon/setup.py || true + # Apply patches + echo "" > set.password.sh + echo "" > standalone/expand.rootfs.sh + sudo -u joinmarket cp /usr/share/joininbox/menu.update.sh /home/joinmarket/menu.update.sh + sudo -u joinmarket sed -i "s|/home/joinmarket/menu.config.sh|echo 'mynode skip config'|g" /home/joinmarket/start.joininbox.sh # Install - yes | ./install.sh --without-qt + sudo -u joinmarket bash -c "cd /home/joinmarket/; ./install.joinmarket.sh install" || true - echo $JOINMARKET_VERSION > $JOINMARKET_VERSION_FILE + echo $JOININBOX_VERSION > $JOININBOX_VERSION_FILE fi fi + # Install Whirlpool WHIRLPOOL_UPGRADE_URL=https://code.samourai.io/whirlpool/whirlpool-client-cli/uploads/$WHIRLPOOL_UPLOAD_FILE_ID/whirlpool-client-cli-$WHIRLPOOL_VERSION-run.jar WHIRLPOOL_SIG_URL=https://code.samourai.io/whirlpool/whirlpool-client-cli/uploads/$WHIRLPOOL_UPLOAD_SIG_ID/whirlpool-client-cli-$WHIRLPOOL_VERSION-run.jar.sig.asc @@ -713,7 +753,7 @@ fi if [ "$CURRENT" != "$SPHINXRELAY_VERSION" ]; then cd /opt/mynode rm -rf sphinxrelay - + sudo -u bitcoin wget $SPHINXRELAY_UPGRADE_URL -O sphinx-relay.tar.gz sudo -u bitcoin tar -xvf sphinx-relay.tar.gz sudo -u bitcoin rm sphinx-relay.tar.gz diff --git a/rootfs/standard/usr/bin/mynode_startup.sh b/rootfs/standard/usr/bin/mynode_startup.sh index 36888fb1..28e42b8f 100755 --- a/rootfs/standard/usr/bin/mynode_startup.sh +++ b/rootfs/standard/usr/bin/mynode_startup.sh @@ -158,6 +158,7 @@ mkdir -p /mnt/hdd/mynode/lnbits mkdir -p /mnt/hdd/mynode/specter mkdir -p /mnt/hdd/mynode/ckbunker mkdir -p /mnt/hdd/mynode/sphinxrelay +mkdir -p /mnt/hdd/mynode/joinmarket mkdir -p /tmp/flask_uploads echo "drive_mounted" > $MYNODE_STATUS_FILE chmod 777 $MYNODE_STATUS_FILE @@ -178,6 +179,10 @@ cp -f /mnt/hdd/mynode/settings/.product_key* home/bitcoin/.mynode/ || true # Make any users we need to useradd -m -s /bin/bash pivpn || true +useradd -m -s /bin/bash joinmarket || true + +# User updates and settings +grep "joinmarket" /etc/sudoers || (echo 'joinmarket ALL=(ALL) NOPASSWD:ALL' | EDITOR='tee -a' visudo) # Regen SSH keys (check if force regen or keys are missing / empty) while [ ! -f /home/bitcoin/.mynode/.gensshkeys ] || @@ -382,6 +387,25 @@ if [ -d /opt/mynode/sphinxrelay/config ]; then fi fi +# Setup JoinMarket +if [ ! -L /home/joinmarket/.joinmarket ]; then + rm -rf /home/joinmarket/.joinmarket + sudo -u joinmarket ln -s /mnt/hdd/mynode/joinmarket /home/joinmarket/.joinmarket +fi +# Migrate data from bitcoin user? - Might be confusing later if an old copy of wallet is used +# if [ -f /home/bitcoin/.joinmarket/joinmarket.cfg ] && [ ! -f /mnt/hdd/mynode/joinmarket/joinmarket.cfg ]; then +# cp /home/bitcoin/.joinmarket/joinmarket.cfg /mnt/hdd/mynode/joinmarket/joinmarket.cfg +# fi +# for f in wallets logs cmtdata; do +# if [ -d /home/bitcoin/.joinmarket/$f ] && [ ! -d /mnt/hdd/mynode/joinmarket/$f ]; then +# cp -r /home/bitcoin/.joinmarket/$f /home/joinmarket/.joinmarket/ +# fi +# done +if [ ! -f /mnt/hdd/mynode/joinmarket/joinmarket.cfg ]; then + cp /usr/share/mynode/joinmarket.cfg /mnt/hdd/mynode/joinmarket/joinmarket.cfg +fi +chown -R joinmarket:joinmarket /mnt/hdd/mynode/joinmarket + # Setup udev chown root:root /etc/udev/rules.d/* || true udevadm trigger @@ -399,6 +423,9 @@ fi if [ -f /opt/mynode/btc-rpc-explorer/.env ]; then sed -i "s/BTCEXP_BITCOIND_PASS=.*/BTCEXP_BITCOIND_PASS=$BTCRPCPW/g" /opt/mynode/btc-rpc-explorer/.env fi +if [ -f /mnt/hdd/mynode/joinmarket/joinmarket.cfg ]; then + sed -i "s/rpc_password = .*/rpc_password = $BTCRPCPW/g" /mnt/hdd/mynode/joinmarket/joinmarket.cfg +fi echo "BTC_RPC_PASSWORD=$BTCRPCPW" > /mnt/hdd/mynode/settings/.btcrpc_environment chown bitcoin:bitcoin /mnt/hdd/mynode/settings/.btcrpc_environment if [ -f /mnt/hdd/mynode/bitcoin/bitcoin.conf ]; then @@ -473,6 +500,10 @@ USER=$(stat -c '%U' /mnt/hdd/mynode/sphinxrelay) if [ "$USER" != "bitcoin" ]; then chown -R bitcoin:bitcoin /mnt/hdd/mynode/sphinxrelay fi +USER=$(stat -c '%U' /mnt/hdd/mynode/joinmarket) +if [ "$USER" != "joinmarket" ]; then + chown -R joinmarket:joinmarket /mnt/hdd/mynode/joinmarket +fi USER=$(stat -c '%U' /mnt/hdd/mynode/redis) if [ "$USER" != "redis" ]; then chown -R redis:redis /mnt/hdd/mynode/redis @@ -583,6 +614,7 @@ echo $LNDHUB_VERSION > $LNDHUB_LATEST_VERSION_FILE echo $CARAVAN_VERSION > $CARAVAN_LATEST_VERSION_FILE echo $CORSPROXY_VERSION > $CORSPROXY_LATEST_VERSION_FILE echo $JOINMARKET_VERSION > $JOINMARKET_LATEST_VERSION_FILE +echo $JOININBOX_VERSION > $JOININBOX_LATEST_VERSION_FILE echo $WHIRLPOOL_VERSION > $WHIRLPOOL_LATEST_VERSION_FILE echo $RTL_VERSION > $RTL_LATEST_VERSION_FILE echo $BTCRPCEXPLORER_VERSION > $BTCRPCEXPLORER_LATEST_VERSION_FILE diff --git a/rootfs/standard/usr/bin/mynode_stop_critical_services.sh b/rootfs/standard/usr/bin/mynode_stop_critical_services.sh index e292c85d..fc59ddc3 100755 --- a/rootfs/standard/usr/bin/mynode_stop_critical_services.sh +++ b/rootfs/standard/usr/bin/mynode_stop_critical_services.sh @@ -25,7 +25,10 @@ fi # Stop core services date -systemctl stop electrs loopd lnd quicksync bitcoind +systemctl stop electrs loopd lnd quicksync +date +killall bitcoind || true +systemctl stop bitcoind date diff --git a/rootfs/standard/usr/share/joininbox/menu.update.sh b/rootfs/standard/usr/share/joininbox/menu.update.sh new file mode 100644 index 00000000..1a57a109 --- /dev/null +++ b/rootfs/standard/usr/share/joininbox/menu.update.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +source /home/joinmarket/_functions.sh + +# BASIC MENU INFO +HEIGHT=12 +WIDTH=56 +CHOICE_HEIGHT=1 +TITLE="Update options" +MENU="Updates managed by myNode" +OPTIONS=() +BACKTITLE="JoininBox GUI" + +# Basic Options +OPTIONS+=(\ + RETURN "Back to main menu" \ +) + +CHOICE=$(dialog --clear \ + --backtitle "$BACKTITLE" \ + --title "$TITLE" \ + --menu "$MENU" \ + $HEIGHT $WIDTH $CHOICE_HEIGHT \ + "${OPTIONS[@]}" \ + 2>&1 >/dev/tty) + +case $CHOICE in + RETURN) + echo "" + ;; +esac \ No newline at end of file diff --git a/rootfs/standard/usr/share/mynode/bitcoin.conf b/rootfs/standard/usr/share/mynode/bitcoin.conf index eeaeb869..3a981f4f 100644 --- a/rootfs/standard/usr/share/mynode/bitcoin.conf +++ b/rootfs/standard/usr/share/mynode/bitcoin.conf @@ -20,6 +20,7 @@ rpcallowip=192.168.0.0/16 # Set default wallet so some wallet APIs work main.wallet=wallet.dat +wallet=joinmarket_wallet.dat # Enable Bloom filters whitelist=bloomfilter@127.0.0.1 diff --git a/rootfs/standard/usr/share/mynode/joinmarket.cfg b/rootfs/standard/usr/share/mynode/joinmarket.cfg new file mode 100644 index 00000000..be9b0946 --- /dev/null +++ b/rootfs/standard/usr/share/mynode/joinmarket.cfg @@ -0,0 +1,304 @@ +[DAEMON] +#set to 1 to run the daemon service within this process; +#set to 0 if the daemon is run separately (using script joinmarketd.py) +no_daemon = 1 +#port on which daemon serves; note that communication still +#occurs over this port even if no_daemon = 1 +daemon_port = 27183 +#currently, running the daemon on a remote host is +#*NOT* supported, so don't change this variable +daemon_host = localhost +#by default the client-daemon connection is plaintext, set to 'true' to use TLS; +#for this, you need to have a valid (self-signed) certificate installed +use_ssl = false + +[BLOCKCHAIN] +# options: bitcoin-rpc, regtest, bitcoin-rpc-no-history, no-blockchain +# When using bitcoin-rpc-no-history remember to increase the gap limit to scan for more addresses, try -g 5000 +# Use 'no-blockchain' to run the ob-watcher.py script in scripts/obwatch without current access +# to Bitcoin Core; note that use of this option for any other purpose is currently unsupported. +blockchain_source = bitcoin-rpc +# options: signet, testnet, mainnet +# Note: for regtest, use network = testnet +network = mainnet +rpc_host = localhost +# default ports are 8332 for mainnet, 18443 for regtest, 18332 for testnet, 38332 for signet +rpc_port = 8332 +rpc_user = mynode +rpc_password = password +rpc_wallet_file = joinmarket_wallet.dat + +[MESSAGING:server1] +#host = irc.darkscience.net +channel = joinmarket-pit +port = 6697 +usessl = true +#socks5 = false +socks5_host = localhost +socks5_port = 9050 + +#for tor +host = darksci3bfoka7tw.onion +socks5 = true + +[MESSAGING:server2] +#host = irc.hackint.org +channel = joinmarket-pit +port = 6697 +usessl = true +#socks5 = false +socks5_host = localhost +socks5_port = 9050 + +#for tor +host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion +port = 6667 +usessl = false +socks5 = true + +#Agora sometimes seems to be unreliable. Not active by default for that reason. +#[MESSAGING:server3] +#host = agora.anarplex.net +#channel = joinmarket-pit +#port = 14716 +#usessl = true +#socks5 = false +#socks5_host = localhost +#socks5_port = 9050 +# +##for tor +##host = cfyfz6afpgfeirst.onion +##port = 6667 +##usessl = false +##socks5 = true + +[LOGGING] +# Set the log level for the output to the terminal/console +# Possible choices: DEBUG / INFO / WARNING / ERROR +# Log level for the files in the logs-folder will always be DEBUG +console_log_level = INFO + +# Use color-coded log messages to help distinguish log levels?: +color = true + +[TIMEOUT] +maker_timeout_sec = 60 +unconfirm_timeout_sec = 180 +confirm_timeout_hours = 6 + +[POLICY] +# Use segwit style wallets and transactions +# Only set to false for old wallets, Joinmarket is now segwit only. +segwit = true + +# Use native segwit (bech32) wallet. If set to false, p2sh-p2wkh +# will be used when generating the addresses for this wallet. +# Notes: 1. The default joinmarket pit is native segwit. +# 2. You cannot change the type of a pre-existing wallet. +native = true + +# for dust sweeping, try merge_algorithm = gradual +# for more rapid dust sweeping, try merge_algorithm = greedy +# for most rapid dust sweeping, try merge_algorithm = greediest +# but don't forget to bump your miner fees! +merge_algorithm = default + +# The fee estimate is based on a projection of how many satoshis +# per kB are needed to get in one of the next N blocks, N set here +# as the value of 'tx_fees'. This cost estimate is high if you set +# N=1, so we choose 3 for a more reasonable figure, as our default. +# You can also set your own fee/kb: any number higher than 1000 will +# be interpreted as the fee in satoshi per kB that you wish to use +# example: N=30000 will use 30000 sat/kB as a fee, while N=5 +# will use the estimate from your selected blockchain source +# Note that there will be a 20% variation around any manually chosen +# values, so if you set N=10000, it might use any value between +# 8000 and 12000 for your transactions. +tx_fees = 3 + +# For users getting transaction fee estimates over an API, +# place a sanity check limit on the satoshis-per-kB to be paid. +# This limit is also applied to users using Core, even though +# Core has its own sanity check limit, which is currently +# 1,000,000 satoshis. +absurd_fee_per_kb = 350000 + +# In decimal, the maximum allowable change either lower or +# higher, that the fee rate used for coinjoin sweeps is +# allowed to be. +# (note: coinjoin sweeps *must estimate* fee rates; +# they cannot be exact due to the lack of change output.) +# +# Example: max_sweep_fee_change = 0.4, with tx_fees = 10000, +# means actual fee rate achieved in the sweep can be as low +# as 6000 sats/kilo-vbyte up to 14000 sats/kilo-vbyte. +# +# If this is not achieved, the transaction is aborted. For tumbler, +# it will then be retried until successful. +# WARNING: too-strict setting may result in using up a lot +# of PoDLE commitments, hence the default 0.8 (80%). +max_sweep_fee_change = 0.8 + +# Maximum absolute coinjoin fee in satoshi to pay to a single +# market maker for a transaction. Both the limits given in +# max_cj_fee_abs and max_cj_fee_rel must be exceeded in order +# to not consider a certain offer. +#max_cj_fee_abs = x + +# Maximum relative coinjoin fee, in fractions of the coinjoin value +# e.g. if your coinjoin amount is 2 btc (200000000 satoshi) and +# max_cj_fee_rel = 0.001 (0.1%), the maximum fee allowed would +# be 0.002 btc (200000 satoshi) +#max_cj_fee_rel = x + +# the range of confirmations passed to the `listunspent` bitcoind RPC call +# 1st value is the inclusive minimum, defaults to one confirmation +# 2nd value is the exclusive maximum, defaults to most-positive-bignum (Google Me!) +# leaving it unset or empty defers to bitcoind's default values, ie [1, 9999999] +#listunspent_args = [] +# that's what you should do, unless you have a specific reason, eg: +# !!! WARNING !!! CONFIGURING THIS WHILE TAKING LIQUIDITY FROM +# !!! WARNING !!! THE PUBLIC ORDERBOOK LEAKS YOUR INPUT MERGES +# spend from unconfirmed transactions: listunspent_args = [0] +# display only unconfirmed transactions: listunspent_args = [0, 1] +# defend against small reorganizations: listunspent_args = [3] +# who is at risk of reorganization?: listunspent_args = [0, 2] +# NB: using 0 for the 1st value with scripts other than wallet-tool could cause +# spends from unconfirmed inputs, which may then get malleated or double-spent! +# other counterparties are likely to reject unconfirmed inputs... don't do it. + +# tx_broadcast: options: self, random-peer, not-self. +# +# self = broadcast transaction with your own bitcoin node. +# +# random-peer = everyone who took part in the coinjoin has a chance of broadcasting +# note: if your counterparties do not support it, you will fall back +# to broadcasting via your own node. +# +# not-self = never broadcast with your own bitcoin node. +# note: in this case if your counterparties do not broadcast for you, you +# will have to broadcast the tx manually (you can take the tx hex from the log +# or terminal) via some other channel. It is not recommended to choose this +# option when running schedules/tumbler. + +tx_broadcast = self + +# If makers do not respond while creating a coinjoin transaction, +# the non-responding ones will be ignored. This is the minimum +# amount of makers which we are content with for the coinjoin to +# succceed. Less makers means that the whole process will restart +# after a timeout. +minimum_makers = 4 + +# Threshold number of satoshis below which an incoming utxo +# to a reused address in the wallet will be AUTOMATICALLY frozen. +# This avoids forced address reuse attacks; see: +# https://en.bitcoin.it/wiki/Privacy#Forced_address_reuse +# +# The default is to ALWAYS freeze a utxo to an already used address, +# whatever the value of it, and this is set with the value -1. +max_sats_freeze_reuse = -1 + +############################## +#THE FOLLOWING SETTINGS ARE REQUIRED TO DEFEND AGAINST SNOOPERS. +#DON'T ALTER THEM UNLESS YOU UNDERSTAND THE IMPLICATIONS. +############################## + +# number of retries allowed for a specific utxo, to prevent DOS/snooping. +# Lower settings make snooping more expensive, but also prevent honest users +# from retrying if an error occurs. +taker_utxo_retries = 3 + +# number of confirmations required for the commitment utxo mentioned above. +# this effectively rate-limits a snooper. +taker_utxo_age = 5 + +# percentage of coinjoin amount that the commitment utxo must have +# as a minimum BTC amount. Thus 20 means a 1BTC coinjoin requires the +# utxo to be at least 0.2 btc. +taker_utxo_amtpercent = 20 + +#Set to 1 to accept broadcast PoDLE commitments from other bots, and +#add them to your blacklist (only relevant for Makers). +#There is no way to spoof these values, so the only "risk" is that +#someone fills your blacklist file with a lot of data. +accept_commitment_broadcasts = 1 + +#Location of your commitments.json file (stores commitments you've used +#and those you want to use in future), relative to the scripts directory. +commit_file_location = cmtdata/commitments.json + +############################## +# END OF ANTI-SNOOPING SETTINGS +############################## + +[PAYJOIN] +# for the majority of situations, the defaults +# need not be altered - they will ensure you don't pay +# a significantly higher fee. +# MODIFICATION OF THESE SETTINGS IS DISADVISED. + +# Payjoin protocol version; currently only '1' is supported. +payjoin_version = 1 + +# servers can change their destination address by default (0). +# if '1', they cannot. Note that servers can explicitly request +# that this is activated, in which case we respect that choice. +disable_output_substitution = 0 + +# "default" here indicates that we will allow the receiver to +# increase the fee we pay by: +# 1.2 * (our_fee_rate_per_vbyte * vsize_of_our_input_type) +# (see https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki#span_idfeeoutputspanFee_output) +# (and 1.2 to give breathing room) +# which indicates we are allowing roughly one extra input's fee. +# If it is instead set to an integer, then that many satoshis are allowed. +# Additionally, note that we will also set the parameter additionafeeoutputindex +# to that of our change output, unless there is none in which case this is disabled. +max_additional_fee_contribution = default + +# this is the minimum satoshis per vbyte we allow in the payjoin +# transaction; note it is decimal, not integer. +min_fee_rate = 1.1 + +# for payjoins to hidden service endpoints, the socks5 configuration: +onion_socks5_host = localhost +onion_socks5_port = 9050 + +# for payjoin onion service creation, the tor control configuration: +tor_control_host = localhost +# or, to use a UNIX socket +# control_host = unix:/var/run/tor/control +tor_control_port = 9051 + +# in some exceptional case the HS may be SSL configured, +# this feature is not yet implemented in code, but here for the +# future: +hidden_service_ssl = false + +[YIELDGENERATOR] +# [string, 'reloffer' or 'absoffer'], which fee type to actually use +ordertype = reloffer + +# [satoshis, any integer] / absolute offer fee you wish to receive for coinjoins (cj) +cjfee_a = 500 + +# [fraction, any str between 0-1] / relative offer fee you wish to receive based on a cj's amount +cjfee_r = 0.00002 + +# [fraction, 0-1] / variance around the average fee. Ex: 200 fee, 0.2 var = fee is btw 160-240 +cjfee_factor = 0.1 + +# [satoshis, any integer] / the average transaction fee you're adding to coinjoin transactions +txfee = 100 + +# [fraction, 0-1] / variance around the average fee. Ex: 1000 fee, 0.2 var = fee is btw 800-1200 +txfee_factor = 0.3 + +# [satoshis, any integer] / minimum size of your cj offer. Lower cj amounts will be disregarded +minsize = 100000 + +# [fraction, 0-1] / variance around all offer sizes. Ex: 500k minsize, 0.1 var = 450k-550k +size_factor = 0.1 + +gaplimit = 6 diff --git a/rootfs/standard/usr/share/mynode/mynode_app_versions.sh b/rootfs/standard/usr/share/mynode/mynode_app_versions.sh index 37b75a8a..e1b06fd9 100644 --- a/rootfs/standard/usr/share/mynode/mynode_app_versions.sh +++ b/rootfs/standard/usr/share/mynode/mynode_app_versions.sh @@ -36,6 +36,10 @@ JOINMARKET_VERSION="v0.8.1" JOINMARKET_VERSION_FILE=/home/bitcoin/.mynode/joinmarket_version JOINMARKET_LATEST_VERSION_FILE=/home/bitcoin/.mynode/joinmarket_version_latest +JOININBOX_VERSION="v0.2.0" +JOININBOX_VERSION_FILE=/home/bitcoin/.mynode/joininbox_version +JOININBOX_LATEST_VERSION_FILE=/home/bitcoin/.mynode/joininbox_version_latest + WHIRLPOOL_VERSION="0.10.9" WHIRLPOOL_UPLOAD_FILE_ID="602666c59f95ce72f1466f72d9c853e3" WHIRLPOOL_UPLOAD_SIG_ID="b072f024fad9609f3c659cd7620f51fa" diff --git a/setup/setup_device.sh b/setup/setup_device.sh index b535aa3b..4a576d33 100755 --- a/setup/setup_device.sh +++ b/setup/setup_device.sh @@ -100,7 +100,7 @@ source /tmp/mynode_app_versions.sh # Create any necessary users - +useradd -m -s /bin/bash joinmarket || true # Update sources apt-get -y update @@ -161,7 +161,7 @@ apt -y -qq install apt-transport-https ca-certificates apt-get -y install xorg chromium openbox lightdm openjdk-11-jre libevent-dev ncurses-dev apt-get -y install zlib1g-dev libudev-dev libusb-1.0-0-dev python3-venv gunicorn apt-get -y install sqlite3 libsqlite3-dev torsocks python3-requests libsystemd-dev -apt-get -y install libjpeg-dev zlib1g-dev +apt-get -y install libjpeg-dev zlib1g-dev psmisc # Make sure some software is removed @@ -540,28 +540,36 @@ if [ ! -f /usr/include/secp256k1_ecdh.h ]; then cp -f include/* /usr/include/ fi -# Install JoinMarket -echo "Install JoinMarket..." +echo "Installing JoinInBox..." if [ $IS_RASPI = 1 ] || [ $IS_X86 = 1 ]; then - JOINMARKET_UPGRADE_URL=https://github.com/JoinMarket-Org/joinmarket-clientserver/archive/$JOINMARKET_VERSION.tar.gz + JOININBOX_UPGRADE_URL=https://github.com/openoms/joininbox/archive/$JOININBOX_VERSION.tar.gz CURRENT="" - if [ -f $JOINMARKET_VERSION_FILE ]; then - CURRENT=$(cat $JOINMARKET_VERSION_FILE) + if [ -f $JOININBOX_VERSION_FILE ]; then + CURRENT=$(cat $JOININBOX_VERSION_FILE) fi - if [ "$CURRENT" != "$JOINMARKET_VERSION" ]; then - # Download and build JoinMarket - cd /opt/mynode - rm -rf joinmarket-clientserver + if [ "$CURRENT" != "$JOININBOX_VERSION" ]; then + # Download and build JoinInBox + cd /home/joinmarket + + # Delete all non-hidden files + rm -rf * + rm -rf joininbox-* - sudo -u bitcoin wget $JOINMARKET_UPGRADE_URL -O joinmarket.tar.gz - sudo -u bitcoin tar -xvf joinmarket.tar.gz - sudo -u bitcoin rm joinmarket.tar.gz - mv joinmarket-clientserver-* joinmarket-clientserver + sudo -u joinmarket wget $JOININBOX_UPGRADE_URL -O joininbox.tar.gz + sudo -u joinmarket tar -xvf joininbox.tar.gz + sudo -u joinmarket rm joininbox.tar.gz + mv joininbox-* joininbox - cd joinmarket-clientserver - yes | ./install.sh --without-qt + chmod -R +x ./joininbox/ + sudo -u joinmarket cp -rf ./joininbox/scripts/* . - echo $JOINMARKET_VERSION > $JOINMARKET_VERSION_FILE + # Apply patches + echo "" > set.password.sh + echo "" > standalone/expand.rootfs.sh + sudo -u joinmarket cp /usr/share/joininbox/menu.update.sh /home/joinmarket/menu.update.sh + sudo -u joinmarket sed -i "s|/home/joinmarket/menu.config.sh|echo 'mynode skip config'|g" /home/joinmarket/start.joininbox.sh + + echo $JOININBOX_VERSION > $JOININBOX_VERSION_FILE fi fi