mirror of
https://github.com/nahuhh/basicswap-bash.git
synced 2025-04-21 13:38:12 +00:00
Compare commits
19 commits
Author | SHA1 | Date | |
---|---|---|---|
|
22d860d677 | ||
|
f64bdca623 | ||
|
2e8bf1d46a | ||
|
574fbb2ee7 | ||
|
82d495b12d | ||
|
175b55fbe3 | ||
|
519c0b5ce5 | ||
|
a3b7271fb3 | ||
|
6cd8be6926 | ||
|
954e293043 | ||
|
3d51d62b49 | ||
|
4b52312f8f | ||
|
c31fb46387 | ||
|
d665889123 | ||
|
02a72d77c4 | ||
|
7f8b90fea4 | ||
|
b52b7e8c92 | ||
![]() |
7ddc595edd | ||
|
00c16d3857 |
12 changed files with 104 additions and 114 deletions
12
README.md
12
README.md
|
@ -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
|
||||
```
|
||||
|
|
|
@ -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
25
bsx-clientauth
Executable 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
|
|
@ -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
|
||||
|
|
18
bsx-update
18
bsx-update
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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
35
bsx/clientauth.sh
Executable 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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
|
@ -1,4 +1,4 @@
|
|||
#/bin/bash
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
export SWAP_DATADIR=$HOME/coinswaps
|
||||
if [[ $USER == amnesia ]]; then
|
||||
|
|
Loading…
Reference in a new issue