Compare commits

...

19 commits

Author SHA1 Message Date
nahuhh
22d860d677 auth: add bsx-clientauth 2025-04-15 01:12:40 +00:00
nahuhh
f64bdca623 removecoin: doesnt require password 2025-04-09 23:40:36 +01:00
nahuhh
2e8bf1d46a addcoin: use if w/ regex instead of case 2025-04-09 23:40:30 +01:00
nahuhh
574fbb2ee7 addcoin: fix variable 2025-02-24 09:10:04 +00:00
nahuhh
82d495b12d addcoin: small cleanup 2025-02-15 15:34:28 +00:00
nahuhh
175b55fbe3 build: add curl and git 2025-02-15 15:29:49 +00:00
nahuhh
519c0b5ce5 tor: use upstream changes 2025-01-14 00:01:54 +00:00
nahuhh
a3b7271fb3 cores: use new updater 2025-01-13 23:42:08 +00:00
nahuhh
6cd8be6926 cores: add doge, update ltc,btc,dash 2025-01-12 22:21:42 +00:00
nahuhh
954e293043 add/remove: allow variable 2025-01-12 22:21:33 +00:00
nahuhh
3d51d62b49 update: avoid broken state if cancelling update 2025-01-04 22:59:11 +00:00
nahuhh
4b52312f8f update: pull if baasicswap-bash repo exists 2024-12-27 00:28:37 +00:00
nahuhh
c31fb46387 update: don't update cores unnecessarily 2024-12-27 00:21:09 +00:00
nahuhh
d665889123 update: wownero v0.11.3.0 2024-12-25 11:07:27 +00:00
nahuhh
02a72d77c4 tor: autogenerate passwd 2024-11-30 16:25:40 +00:00
nahuhh
7f8b90fea4 coins: add bitcoincash 2024-11-30 13:10:50 +00:00
nahuhh
b52b7e8c92
Merge pull request from CrynTox/master
Fix shebang in the install script
2024-11-25 15:52:43 +00:00
CrynTox
7ddc595edd fix: fix shebang 2024-11-25 17:30:29 +02:00
nahuhh
00c16d3857 update: cancel update if repo errors 2024-11-19 14:51:11 +00:00
12 changed files with 104 additions and 114 deletions

View file

@ -2,6 +2,14 @@
A suite of bash scripts to install and manage
BasicSwapDEX on Windows(WSL)/Debian/Ubuntu/Arch/Fedora
### Dependencies
You will need::
- curl
- git
`sudo apt install curl git`
Other dependencies vary by distribution and are handled by the installer.
### New Installation
```bash
git clone https://github.com/nahuhh/basicswap-bash
@ -15,7 +23,7 @@ git clone https://github.com/nahuhh/basicswap-bash
cd basicswap-bash
mkdir -p $HOME/.local/bin
rm -r $HOME/.local/bin/bsx
mv -f basic* bsx* $HOME/.local/bin/
cp -r basic* bsx* $HOME/.local/bin/
cd .. && rm -rf basicswap-bash
bsx-update
```
@ -37,7 +45,7 @@ bsx-enabletor
bsx-disabletor
```
#### Add/remove coins
#### Add/disable coins
```
bsx-addcoin
```

View file

@ -45,5 +45,6 @@ read -p 'Select an option [1|2]: ' l
esac
done
export addcoin="$1"
. $SWAP_DATADIR/venv/bin/activate
$HOME/.local/bin/bsx/addcoin.sh

25
bsx-clientauth Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
# Colors
red="printf \e[31;1m"
green="printf \e[32;1m"
nocolor="printf \e[0m"
# Check if basicswap is running
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then
bsx_run=$(pgrep particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
. $SWAP_DATADIR/venv/bin/activate
$HOME/.local/bin/bsx/clientauth.sh

View file

@ -21,29 +21,6 @@ if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
fi
fi
printf "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\n\n"
until [[ "$l" =~ ^[12]$ ]]; do
read -p 'Select an option [1|2]: ' l
case $l in
1)
until [[ $pass1 ]] && [[ $pass1 == $pass2 ]]; do
read -sp 'Enter your BasicSwap password: ' pass1
read -sp $'\nRe-enter your BasicSwap password: ' pass2
if [[ $pass1 == $pass2 ]]; then
export WALLET_ENCRYPTION_PWD=$pass1
else
$red"\nThe passwords entered don't match. Try again\n\n"; $nocolor
fi
done
;;
2)
$nocolor"\nProceeding without a password\n"
;;
*)
$red"You must answer 1 or 2\n"; $nocolor
;;
esac
done
export disablecoin="$1"
. $SWAP_DATADIR/venv/bin/activate
$HOME/.local/bin/bsx/removecoin.sh

View file

@ -32,16 +32,18 @@ else
# Download updated scripts
echo "Updating basicswap-bash scripts" && sleep 1
git clone https://github.com/nahuhh/basicswap-bash
cd basicswap-bash
if [[ -d basicswap-bash ]]; then
cd basicswap-bash
git pull || { $red"Failed to update repo. Cancelling update.\n"; exit; }
else
git clone https://github.com/nahuhh/basicswap-bash || { $red"Failed to clone repo. Cancelling update.\n"; exit; }
cd basicswap-bash
fi
# Move scripts
rm -rf $HOME/.local/bin/bsx
mv -f basic* bsx* $HOME/.local/bin/
# Copy core_versions to basicswap folder
mv core_versions $SWAP_DATADIR/basicswap/core_versions
rm -rf $HOME/.local/bin/bsx $HOME/.local/bin/basicswap-bash
cp -r basic* bsx* $HOME/.local/bin/
# Update BasicSwap, coincurve and coin cores
$HOME/.local/bin/bsx/update.sh
./bsx/update.sh
fi

View file

@ -1,27 +1,23 @@
#!/bin/bash
## Prompt for user input
printf "\n\nThe following coins can be added (case sensitive)\nbitcoin\ndash\ndecred\nfiro\nlitecoin\npivx\nwownero\n\n"
read -p 'Full name of coin to add [example: litecoin] ' addcoin
if [[ -z $addcoin ]]; then
printf "\n\nThe following coins can be added (case sensitive)\nbitcoin\nbitcoincash\ndash\ndecred\ndogecoin\nfiro\nlitecoin\npivx\nwownero\n\n"
read -p 'Full name of coin to add [example: litecoin] ' addcoin
fi
## Confirm
read -p $'\nAdd '$addcoin' to your BasicSwap install, correct? Press ENTER to continue. CTRL-C to exit'
## Add the coin
fastsync=""
if [ $addcoin = bitcoin ]; then
read -p 'Use --usebtcfastsync for bitcoin? [Y/n] ' btcfastsync
case $btcfastsync in
n | N) confirmed=no;;
*) confirmed=yes;;
esac
if [ $confirmed = yes ]; then
echo "Using btcfastsync"
basicswap-prepare --usebtcfastsync --datadir=$SWAP_DATADIR --addcoin=$addcoin
else
if [[ "${btcfastsync}" =~ ^[nN]$ ]]; then
echo "Not using btcfastsync"
basicswap-prepare --datadir=$SWAP_DATADIR --addcoin=$addcoin
else
echo "Using btcfastsync"
fastsync="--usebtcfastsync"
fi
else
basicswap-prepare --datadir=$SWAP_DATADIR --addcoin=$addcoin
fi
basicswap-prepare --datadir=$SWAP_DATADIR --addcoin=$addcoin ${fastsync:+$fastsync}

View file

@ -1,46 +1,3 @@
#!/bin/bash
#set -x
export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then
export SWAP_DATADIR=$HOME/Persistent/coinswaps
fi
BINDIR=$SWAP_DATADIR/bin
echo "Checking for Coin updates" && sleep 1
chain=(
bitcoin
dash
decred
firo
litecoin
particl
pivx
monero
wownero
)
list=""
select=""
for coin in "${chain[@]}"; do
if [[ -d $BINDIR/$coin ]]; then
if [[ $coin == decred ]]; then
UPDATE=$($BINDIR/$coin/dcrd --version | head -n 1 | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
else
UPDATE=$($BINDIR/$coin/"$coin"d --version | head -n 1 | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
fi
if [[ -z $UPDATE ]]; then
select+="$coin,"
list=${select%,}
fi
fi
done
echo "Updating $list"
if [[ -n $select ]]; then
. $SWAP_DATADIR/venv/bin/activate
basicswap-prepare --datadir=$SWAP_DATADIR --preparebinonly --withcoins=$list
else
echo "Coin Cores are up to date"
fi
basicswap-prepare --datadir=$SWAP_DATADIR --upgradecores

35
bsx/clientauth.sh Executable file
View file

@ -0,0 +1,35 @@
#!/bin/bash
# Colors
red="printf \e[31;1m"
green="printf \e[32;1m"
nocolor="printf \e[0m"
printf "[1] Enable client auth\n[2] Disable client auth\n\n"
$red"NOTE: this a different password than your Wallet Emcryption\n"; $nocolor
until [[ "$l" =~ ^[12]$ ]]; do
read -p 'Select an option [1|2]: ' l
case $l in
1)
until [[ $pass1 ]] && [[ $pass1 == $pass2 ]]; do
read -sp 'New Client password: ' pass1
read -sp $'\nRe-enter Client password: ' pass2
if [[ $pass1 == $pass2 ]]; then
CLIENT_AUTH=$pass1
basicswap-prepare --datadir=$SWAP_DATADIR --client-auth-password="${CLIENT_AUTH}"
printf "\nThe auth is: ";$green'"admin:<password>"\n\n';$nocolor
printf "For the AMM, add: "; $green'"auth": "admin:<password>"';$nocolor" to your createoffers.json\n\n"
else
$red"\nThe passwords entered don't match. Try again\n\n"; $nocolor
fi
done
;;
2)
$nocolor"\Disabling client auth\n"
basicswap-prepare --datadir=$SWAP_DATADIR --disable-client-auth
;;
*)
$red"You must answer 1 or 2\n"; $nocolor
;;
esac
done

View file

@ -70,8 +70,7 @@ else
fi
# Create HashedControlPassword
printf "In the next step you'll choose a password. NOTE: It will be saved in PLAIN TEXT.\n"
read -p "Enter a (new) tor control password [example: 123123] " torcontrolpass
torcontrolpass=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
# Edit /etc/tor/torrc
torhashedpass=$(tor --hash-password $torcontrolpass)
enabledcontrol=$(echo "ControlPort 9051")
@ -86,14 +85,9 @@ fi
# Restart tor to apply
$INIT_TOR
echo "Waiting for Tor... 5sec" && sleep 5
# lol are we there yet?
TOR_PROXY_HOST=127.0.0.1
basicswap-prepare --datadir=$SWAP_DATADIR --enabletor
BSX_LOCAL_TOR=true basicswap-prepare --datadir=$SWAP_DATADIR --enabletor
# Workaround: Replace torpassword in various config files
oldtorpass=$(cat $SWAP_DATADIR/basicswap.json | jq -r .tor_control_password)
sed -i "s/$oldtorpass/$torcontrolpass/" $SWAP_DATADIR/*/*.conf $SWAP_DATADIR/basicswap.json
# Fix: localhost binding for btc/ltc/part (etc) configs
sed -i -z "s/\nbind=0.0.0.0/\nbind=127.0.0.1/" $SWAP_DATADIR/*/*.conf

View file

@ -1,10 +1,14 @@
#!/bin/bash
## Prompt for user input
printf "\n\nThe following coins can be disabled (case sensitive)\nbitcoin\ndash\ndecred\nfiro\nlitecoin\nmonero\npivx\nwownero\n\n"
read -p 'Full name of coin to disable [example: wownero] ' disablecoin
if [[ -z "$disablecoin" ]]; then
printf "\n\nThe following coins can be disabled (case sensitive)\nbitcoin\nbitcoincash\ndash\ndecred\ndogecoin\nfiro\nlitecoin\nmonero\npivx\nwownero\n\n"
read -p 'Full name of coin to disable [example: wownero] ' disablecoin
fi
## Confirm
printf "\nDisable $disablecoin on your BasicSwap install, correct? Press any key to continue. CTRL-C to exit\n"
read
## Disable the coin
basicswap-prepare --datadir=$SWAP_DATADIR --disablecoin=$disablecoin

View file

@ -1,9 +0,0 @@
Bitcoin Core version v26.0.0
dcrd version 1.8.1+release (Go version go1.21.1 linux/amd64)
Dash Core version v21.1.0
Firo Core Daemon version v0.14.14.0-ge0c423805
Litecoin Core version v0.21.3
Particl Core version v23.2.7.0
PIVX Core Daemon version v5.6.1.0-af60f19642
Monero 'Fluorine Fermi' (v0.18.3.4-release)
Wownero 'Kunty Karen' (v0.11.1.0-release)

View file

@ -1,4 +1,4 @@
#/bin/bash
#!/bin/bash
#set -x
export SWAP_DATADIR=$HOME/coinswaps
if [[ $USER == amnesia ]]; then