Compare commits

...

16 commits

Author SHA1 Message Date
nahuhh
1ec1dd4e4a add PATH to zshrc 2024-10-09 12:34:42 +00:00
nahuhh
41ae85ee08 use coincurve tags 2024-09-21 14:16:20 +00:00
nahuhh
a4720f834b dont delete coin_versions 2024-09-21 14:15:04 +00:00
nahuhh
5c491184ff Check for running instance 2024-09-21 14:14:58 +00:00
nahuhh
e8f3a7d964 hide xfce err 2024-09-16 19:17:57 +00:00
nahuhh
acc3702c50 fix restore from seed 2024-09-16 18:38:10 +00:00
nahuhh
4d46146657 update cores 2024-09-16 01:18:26 +00:00
nahuhh
e9a84cf72f install: xfce .profile use in .xsessionrc 2024-09-05 22:07:40 +00:00
nahuhh
1531ba9034 wownero master 2024-06-21 21:04:21 -05:00
nahuhh
32d5003c43 fix upgrade paths 2024-06-12 12:33:16 -05:00
nahuhh
48ee19de36 switch to basicswap/basicswap repo 2024-06-11 15:32:34 -05:00
nahuhh
116a5a68c7 add curl dependency, reword password prompt 2024-06-06 07:34:49 -05:00
nahuhh
07cc24b204 use $HOME/.local/bin 2024-06-05 17:33:11 -05:00
nahuhh
96fad3fcdd support password protected installs 2024-06-04 21:14:17 -05:00
nahuhh
d3b442b7f7 check that remote node actually works 2024-06-04 19:31:08 -05:00
nahuhh
7ae1eb55b2 remove protobuf, update README 2024-06-04 08:59:33 -05:00
21 changed files with 598 additions and 90 deletions

View file

@ -1,16 +1,33 @@
# basicswap-bash # basicswap-bash
A BasicSwapDEX bash installer for Debian/Ubuntu A suite of bash scripts to install and manage
BasicSwapDEX on Windows(WSL)/Debian/Ubuntu/Arch/Fedora
### Installation ### New Installation
```bash ```bash
wget https://github.com/nahuhh/basicswap-bash/releases/latest/download/basicswap-bash.tar.gz git clone https://github.com/nahuhh/basicswap-bash
tar xvf basicswap-bash.tar.gz
cd basicswap-bash && ./install.sh cd basicswap-bash && ./install.sh
cd .. && rm -rf basicswap-bash
``` ```
### Update scripts from older versions
``` bash
cd ~/coinswaps/basicswap
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/
cd .. && rm -rf basicswap-bash
bsx-update
```
### Running BasicSwapDEX ### Running BasicSwapDEX
``` ```
basicswap-bash basicswap-bash
``` ```
#### Update BSX core
```
bsx-update
```
#### Enable/Disable Tor [post install] #### Enable/Disable Tor [post install]
``` ```
@ -20,18 +37,18 @@ bsx-enabletor
bsx-disabletor bsx-disabletor
``` ```
#### Add coins #### Add/remove coins
``` ```
bsx-addcoin bsx-addcoin
``` ```
```
bsx-removecoin
```
#### Update blockchains #### Update blockchains
``` ```
bsx-upgrade-coins bsx-upgrade-coins
``` ```
#### Update BSX core
```
bsx-update
```
A small donation goes a long way. Thanks A small donation goes a long way. Thanks

View file

@ -1,5 +1,21 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
python3 -m venv "$SWAP_DATADIR/venv"
# Colors
red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m"
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
if [[ $bsx_pid ]]; then
bsx_run=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is already running.\n"; $nocolor
exit
fi
fi
fi
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
/usr/local/bin/bsx/startup.sh $HOME/.local/bin/bsx/startup.sh

View file

@ -1,4 +1,46 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
# Colors
red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
nocolor="echo -e -n \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=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\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
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
/usr/local/bin/bsx/addcoin.sh $HOME/.local/bin/bsx/addcoin.sh

View file

@ -1,4 +1,46 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
# Colors
red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
nocolor="echo -e -n \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=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\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
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
/usr/local/bin/bsx/disabletor.sh $HOME/.local/bin/bsx/disabletor.sh

View file

@ -1,4 +1,46 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
# Colors
red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
nocolor="echo -e -n \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=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\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
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
/usr/local/bin/bsx/enabletor.sh $HOME/.local/bin/bsx/enabletor.sh

View file

@ -1,4 +1,46 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
# Colors
red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
nocolor="echo -e -n \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=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\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
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
/usr/local/bin/bsx/disablecoin.sh $HOME/.local/bin/bsx/removecoin.sh

View file

@ -1,4 +1,29 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
# Colors
red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
nocolor="echo -e -n \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=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
/usr/local/bin/bsx/update.sh
if [ -f /usr/local/bin/bsx/update.sh ]; then
/usr/local/bin/bsx/update.sh
cd /usr/local/bin
sudo rm -rf basicswap-bash bsx*
else
$HOME/.local/bin/bsx/update.sh
fi

View file

@ -1,4 +1,46 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
# Colors
red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
nocolor="echo -e -n \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=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
exit
fi
fi
fi
echo -e "BasicSwapDEX is currently:\n[1] Password protected\n[2] NOT password protected\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
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
/usr/local/bin/bsx/upgradecoins.sh $HOME/.local/bin/bsx/upgradecoins.sh

View file

@ -1,3 +1,7 @@
#!/bin/bash #!/bin/bash
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
/usr/local/bin/bsx/setup.sh if [[ $TAILS ]]; then
$HOME/.local/bin/bsx/tails_setup.sh
else
$HOME/.local/bin/bsx/setup.sh
fi

View file

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
## Prompt for user input ## Prompt for user input
echo -e "\n\nThe following coins can be added (case sensitive)\nbitcoin\ndash\nfiro\nlitecoin\npivx\n" echo -e "\n\nThe following coins can be added (case sensitive)\nbitcoin\ndash\ndecred\nfiro\nlitecoin\npivx\nwownero\n"
read -p 'Full name of coin to add [example: litecoin] ' addcoin read -p 'Full name of coin to add [example: litecoin] ' addcoin
## Confirm ## Confirm
echo -e "\nAdd $addcoin to your BasicSwap install, correct? Press any key to continue. CTRL-C to exit" read -p $'\nAdd '$addcoin' to your BasicSwap install, correct? Press ENTER to continue. CTRL-C to exit'
read
## Add the coin ## Add the coin
if [ $addcoin = bitcoin ]; then if [ $addcoin = bitcoin ]; then
read -p 'Use --usebtcfastsync for bitcoin? [Y/n] ' btcfastsync read -p 'Use --usebtcfastsync for bitcoin? [Y/n] ' btcfastsync

85
bsx/auto_coinupd8.sh Executable file
View file

@ -0,0 +1,85 @@
#!/bin/bash
#set -x
SWAP_DATADIR=$HOME/coinswaps
echo "Checking for Coin updates" && sleep 1
if [[ -d $SWAP_DATADIR/bin/bitcoin ]]; then
BTC=$($SWAP_DATADIR/bin/bitcoin/bitcoind --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
if [[ -z $BTC ]]; then
echo "Updating Bitcoin"
Bitcoin="bitcoin,"
fi
fi
if [[ -d $SWAP_DATADIR/bin/dash ]]; then
DASH=$($SWAP_DATADIR/bin/dash/dashd --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
if [[ -z $DASH ]]; then
echo "Updating Dash"
Dash="dash,"
fi
fi
if [[ -d $SWAP_DATADIR/bin/decred ]]; then
DCR=$($SWAP_DATADIR/bin/decred/dcrd --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
if [[ -z $DCR ]]; then
echo "Updating Decred"
Decred="decred,"
fi
fi
if [[ -d $SWAP_DATADIR/bin/firo ]]; then
FIRO=$($SWAP_DATADIR/bin/firo/firod --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
if [[ -z $FIRO ]]; then
echo "Updating Firo"
Firo="firo,"
fi
fi
if [[ -d $SWAP_DATADIR/bin/litecoin ]]; then
LTC=$($SWAP_DATADIR/bin/litecoin/litecoind --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
if [[ -z $LTC ]]; then
echo "Updating Litecoin"
Litecoin="litecoin,"
fi
fi
if [[ -d $SWAP_DATADIR/bin/particl ]]; then
PART=$($SWAP_DATADIR/bin/particl/particld --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
if [[ -z $PART ]]; then
echo "Updating Particl"
fi
fi
if [[ -d $SWAP_DATADIR/bin/pivx ]]; then
PIVX=$($SWAP_DATADIR/bin/pivx/pivxd --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
if [[ -z $PIVX ]]; then
echo "Updating PIVX"
Pivx="pivx,"
fi
fi
if [[ -d $SWAP_DATADIR/bin/monero ]]; then
XMR=$($SWAP_DATADIR/bin/monero/monerod --version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
if [[ -z $XMR ]]; then
echo "Updating Monero"
Monero="monero,"
fi
fi
if [[ -d $SWAP_DATADIR/bin/wownero ]]; then
WOW=$($SWAP_DATADIR/bin/wownero/wownerod --version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
if [[ -z $WOW ]]; then
echo "Updating Wownero"
Wownero="wownero,"
fi
fi
sleep 1
if [[ -n $Bitcoin ]] || [[ -n $Dash ]] || [[ -n $Decred ]] || [[ -n $Firo ]] || [[ -n $Litecoin ]] || [[ -n $Particl ]] || [[ -n $Pivx ]] || [[ -n $Monero ]] || [[ -n $Wownero ]]; then
. $SWAP_DATADIR/venv/bin/activate
basicswap-prepare --datadir=$SWAP_DATADIR --preparebinonly --withcoins="$Bitcoin$Dash$Decred$Firo$Litecoin$Pivx$Monero$Wownero"particl
else
echo "Coin Cores are up to date"
fi

View file

@ -47,13 +47,14 @@ else
$INSTALL tor $INSTALL tor
fi fi
# Create HashesControlPassword # Create HashedControlPassword
echo -e "In the next step you'll choose a password. NOTE: It will be saved in PLAIN TEXT." echo -e "In the next step you'll choose a password. NOTE: It will be saved in PLAIN TEXT."
read -p "Enter a (new) tor control password [example: 123123] " torcontrolpass read -p "Enter a (new) tor control password [example: 123123] " torcontrolpass
# Edit /etc/tor/torrc # Edit /etc/tor/torrc
torhashedpass=$(tor --hash-password $torcontrolpass) torhashedpass=$(tor --hash-password $torcontrolpass)
enabledcontrol=$(echo "ControlPort 9051") enabledcontrol=$(echo "ControlPort 9051")
skipcontrol=$(grep -x "$enabledcontrol" /etc/tor/torrc) skipcontrol=$(sudo grep -x "$enabledcontrol" /etc/tor/torrc)
echo "Check torrc for enabled ControlPort"
if [[ $skipcontrol ]]; then if [[ $skipcontrol ]]; then
# Use Existing enabled ControlPort and append HashedControlPassword # Use Existing enabled ControlPort and append HashedControlPassword
echo -e "# Added by basicswap-bash\nHashedControlPassword $torhashedpass" | sudo tee -a /etc/tor/torrc echo -e "# Added by basicswap-bash\nHashedControlPassword $torhashedpass" | sudo tee -a /etc/tor/torrc

View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
## Prompt for user input ## Prompt for user input
echo -e "\n\nThe following coins can be disabled (case sensitive)\nbitcoin\ndash\nfiro\nlitecoin\nmonero\npivx\n" echo -e "\n\nThe following coins can be disabled (case sensitive)\nbitcoin\ndash\ndecred\nfiro\nlitecoin\nmonero\npivx\nwownero\n"
read -p 'Full name of coin to disable [example: litecoin] ' disablecoin read -p 'Full name of coin to disable [example: wownero] ' disablecoin
## Confirm ## Confirm
echo -e "\nDisable $disablecoin on your BasicSwap install, correct? Press any key to continue. CTRL-C to exit" echo -e "\nDisable $disablecoin on your BasicSwap install, correct? Press any key to continue. CTRL-C to exit"
read read

View file

@ -5,23 +5,18 @@ red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m" green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m" nocolor="echo -e -n \e[0m"
## UBUNTU 22.04 FIX upgrade protobuf inside of venv
python -m pip install --upgrade "protobuf<=3.20.1"
## Download & Install coincurve stuff ## Download & Install coincurve stuff
cd $SWAP_DATADIR cd $SWAP_DATADIR
wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/refs/tags/anonswap_v0.2.zip git clone https://github.com/basicswap/coincurve -b basicswap_v0.2 coincurve-basicswap
unzip -d coincurve-anonswap coincurve-anonswap.zip cd $SWAP_DATADIR/coincurve-basicswap
mv -f ./coincurve-anonswap/*/{.,}* ./coincurve-anonswap || true
cd $SWAP_DATADIR/coincurve-anonswap
$SWAP_DATADIR/venv/bin/pip install . $SWAP_DATADIR/venv/bin/pip install .
## Clone basicswap git ## Clone basicswap git
cd $SWAP_DATADIR cd $SWAP_DATADIR
git clone https://github.com/tecnovert/basicswap.git git clone https://github.com/basicswap/basicswap
cd $SWAP_DATADIR/basicswap cd $SWAP_DATADIR/basicswap
## Install basicswap ## Install basicswap
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto $SWAP_DATADIR/venv/bin/pip install wheel
$SWAP_DATADIR/venv/bin/pip install . $SWAP_DATADIR/venv/bin/pip install .
## Decide a source for Monero's restore height ## Decide a source for Monero's restore height
@ -32,34 +27,40 @@ elif [[ "$monerod_addr" ]]; then
CURRENT_XMR_HEIGHT=$(curl "http://$monerod_addr:$monerod_port/get_info" | jq .height) CURRENT_XMR_HEIGHT=$(curl "http://$monerod_addr:$monerod_port/get_info" | jq .height)
else else
# Use public node # Use public node
CURRENT_XMR_HEIGHT=$(curl https://localmonero.co/blocks/api/get_stats | jq .height) CURRENT_XMR_HEIGHT=$(curl http://node3.monerodevs.org:18089/get_info | jq .height)
fi fi
# Use Tor if we want # Use Tor if we want
enable_tor() { enable_tor() {
if [[ "$tor_on" = 1 ]]; then if [[ "$tor_on" = 1 ]]; then
/usr/local/bin/bsx-enabletor $HOME/.local/bin/bsx-enabletor
fi fi
} }
# Use the custom Monero node # Use the custom Monero node & add wownero because its a small chain
if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
# Restore seed
PARTICL_MNEMONIC=$particl_mnemonic PARTICL_MNEMONIC=$particl_mnemonic
basicswap-prepare --datadir=$SWAP_DATADIR --particl_mnemonic="$PARTICL_MNEMONIC" XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port \
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port basicswap-prepare --datadir=$SWAP_DATADIR --addcoin=monero --xmrrestoreheight=$CURRENT_XMR_HEIGHT basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC"
enable_tor enable_tor
elif [[ "$particl_mnemonic" ]]; then elif [[ "$particl_mnemonic" ]]; then
# Restore seed
PARTICL_MNEMONIC=$particl_mnemonic PARTICL_MNEMONIC=$particl_mnemonic
basicswap-prepare --datadir=$SWAP_DATADIR --particl_mnemonic="$PARTICL_MNEMONIC" basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC"
enable_tor enable_tor
elif [[ "$monerod_addr" ]]; then elif [[ "$monerod_addr" ]]; then
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=$CURRENT_XMR_HEIGHT # Setup new install and use a remote monero node
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port \
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
$red"\n\nMake note of your seed above\n"; $nocolor $red"\n\nMake note of your seed above\n"; $nocolor
enable_tor enable_tor
else else
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=$CURRENT_XMR_HEIGHT # Setup new install using local nodes
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
$red"\n\nMake note of your seed above\n"; $nocolor $red"\n\nMake note of your seed above\n"; $nocolor
enable_tor enable_tor
fi fi
$green"Install complete.\n\nUse 'basicswap-bash' to run, 'bsx-update' to update, and 'bsx-addcoin' to add a coin\n"; $nocolor $green"Install complete.\n\nUse 'basicswap-bash' to run, 'bsx-update' to update, and 'bsx-addcoin' to add a coin\n\nYou'll need to open a new login shell (a new terminal window) for the start scripts to be recognized.\n";$nocolor
$red"XFCE will require you to logout / login";$nocolor

73
bsx/tails_setup.sh Executable file
View file

@ -0,0 +1,73 @@
#!/bin/bash
# Colors
red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m"
## Download & Install coincurve stuff
cd $SWAP_DATADIR
wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/refs/tags/anonswap_v0.2.zip
unzip -d coincurve-anonswap coincurve-anonswap.zip
mv -f ./coincurve-anonswap/*/{.,}* ./coincurve-anonswap || true
cd $SWAP_DATADIR/coincurve-anonswap
torsocks $SWAP_DATADIR/venv/bin/pip install . # Tails requires torsocks for pip
## Clone basicswap git
cd $SWAP_DATADIR
git clone https://github.com/tecnovert/basicswap -b wow
cd $SWAP_DATADIR/basicswap
## Install basicswap
torsocks $SWAP_DATADIR/venv/bin/pip install . # Tails requires torsocks for pip
## Decide a source for Monero's restore height
if [[ "$xmrrestoreheight" ]]; then
CURRENT_XMR_HEIGHT=$xmrrestoreheight
elif [[ "$monerod_addr" ]]; then
# Use custom Monero node
CURRENT_XMR_HEIGHT=$(curl "http://$monerod_addr:$monerod_port/get_info" | jq .height)
else
# Use public node
CURRENT_XMR_HEIGHT=$(curl http://node3.monerodevs.org:18089/get_info | jq .height)
fi
# Use Tor if we want
enable_tor() {
if [[ "$tor_on" = 1 ]]; then
$HOME/.local/bin/bsx-enabletor
fi
}
# Use the custom Monero node & add wownero because its a small chain
if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
# Restore seed
PARTICL_MNEMONIC=$particl_mnemonic
basicswap-prepare --datadir=$SWAP_DATADIR --particl_mnemonic="$PARTICL_MNEMONIC"
# Add coins and use a remote monero node
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port \
basicswap-prepare --datadir=$SWAP_DATADIR --addcoin=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
enable_tor
elif [[ "$particl_mnemonic" ]]; then
# Restore seed
PARTICL_MNEMONIC=$particl_mnemonic
basicswap-prepare --datadir=$SWAP_DATADIR --particl_mnemonic="$PARTICL_MNEMONIC"
# Add coins using local nodes
basicswap-prepare --datadir=$SWAP_DATADIR --addcoin=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
enable_tor
elif [[ "$monerod_addr" ]]; then
# Setup new install and use a remote monero node
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port \
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
$red"\n\nMake note of your seed above\n"; $nocolor
enable_tor
else
# Setup new install using local nodes
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
$red"\n\nMake note of your seed above\n"; $nocolor
enable_tor
fi
$green"Install complete.\n\nUse 'basicswap-bash' to run, 'bsx-update' to update, and 'bsx-addcoin' to add a coin\n"; $nocolor

View file

@ -1,4 +1,33 @@
#!/bin/bash #!/bin/bash
cd $SWAP_DATADIR/basicswap cd $SWAP_DATADIR/basicswap
# Download updated scripts
echo "Updating basicswap-bash scripts" && sleep 1
git clone https://github.com/nahuhh/basicswap-bash
cd basicswap-bash
# 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
echo "Updating BasicSwapDEX" && sleep 1
# Delete dangling build folder. Same as --no-cache for docker
rm -rf $SWAP_DATADIR/basicswap/build
# Switch to new repo: basicswap/basicswap
cd $SWAP_DATADIR/basicswap
git remote set-url origin https://github.com/basicswap/basicswap
# git checkout master
git pull git pull
# Update BasicSwap
$SWAP_DATADIR/venv/bin/pip install . $SWAP_DATADIR/venv/bin/pip install .
# Update Coin Cores
$HOME/.local/bin/bsx/auto_coinupd8.sh
# Cleanup
rm -rf basicswap-bash

View file

@ -1,13 +1,13 @@
#!/bin/bash #!/bin/bash
## Prompt for user input ## Prompt for user input
echo "You can only update coins which you have already added to your install" echo "You can only upgrade coins which you have already added to your install"
echo -e "\n\nList of coins supported by BasicSwapDEX (case sensitive):\nbitcoin\ndash\nfiro\nlitecoin\nmonero\nparticl\npivx\n" echo -e "\n\nList of coins supported by BasicSwapDEX (case sensitive):\nbitcoin\ndash\ndecred\nfiro\nlitecoin\nmonero\nparticl\npivx\nwownero\n"
read -p 'Full name of coin to update [example: litecoin] ' updatecoin read -p 'Full name of coin to upgrade [example: litecoin] ' upgradecoin
## Confirm ## Confirm
read -p $'\nUpdate $updatecoin, correct? Press any key to continue. CTRL-C to exit' read -p $'\nUpgrade '$upgradecoin', correct? Press any key to continue. CTRL-C to exit'
## Update the coin ## Upgrade the coin
basicswap-prepare --datadir=$SWAP_DATADIR -preparebinonly --withcoins=$updatecoin basicswap-prepare --datadir=$SWAP_DATADIR -preparebinonly --withcoins=$upgradecoin
echo "Updated $updatecoin" echo "Upgraded $upgradecoin"

9
core_versions Normal file
View file

@ -0,0 +1,9 @@
Bitcoin Core version v26.0.0
dcrd version 1.8.1+release (Go version go1.21.1 linux/amd64)
Dash Core version v20.0.2
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,10 +1,23 @@
#/bin/bash #/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
# Colors # Colors
red="echo -e -n \e[31;1m" red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m" green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m" nocolor="echo -e -n \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=$(pidof particld | grep $bsx_pid)
if [[ $bsx_run ]]; then
$red"\nError: BasicSwapDEX is already installed.\n"; $nocolor
exit
fi
fi
fi
# Title Bar # Title Bar
$green "\n" $green "\n"
title="BasicSwapDEX Installer" title="BasicSwapDEX Installer"
@ -20,29 +33,40 @@ $nocolor
INSTALL="" INSTALL=""
UPDATE="" UPDATE=""
DEPENDENCY="" DEPENDENCY=""
TAILS=""
check_tails() {
if [ $USER == amnesia ]; then
$green"\nDetected Tails\n";$nocolor
TAILS=1
else
$green"\nDetected Debian\n";$nocolor
fi
}
detect_os_arch() { detect_os_arch() {
if type -P apt > /dev/null; then if type -P apt > /dev/null; then
check_tails
# Debian / Ubuntu / Mint # Debian / Ubuntu / Mint
INSTALL="sudo apt install" INSTALL="sudo apt install"
UPDATE="sudo apt update" UPDATE="sudo apt update"
DEPENDENCY="python-is-python3 python3-pip python3-venv gnupg pkg-config protobuf-compiler" DEPENDENCY="python-is-python3 python3-pip python3-venv gnupg pkg-config"
$green"\nDetected Debian\n";$nocolor
elif type -P dnf > /dev/null; then elif type -P dnf > /dev/null; then
# Fedora # Fedora
INSTALL="sudo dnf install" INSTALL="sudo dnf install"
UPDATE="sudo dnf check-update" UPDATE="sudo dnf check-update"
DEPENDENCY="python3-virtualenv python3-pip python3-devel gnupg2 pkgconf protobuf-compiler" DEPENDENCY="python3-virtualenv python3-pip python3-devel gnupg2 pkgconf"
$green"\nDetected Fedora\n";$nocolor $green"\nDetected Fedora\n";$nocolor
elif type -P pacman > /dev/null; then elif type -P pacman > /dev/null; then
# Arch Linux # Arch Linux
INSTALL="sudo pacman -S" INSTALL="sudo pacman -S"
UPDATE="sudo pacman -Syu" UPDATE="sudo pacman -Syu"
DEPENDENCY="python-pipenv gnupg protobuf pkgconf base-devel" DEPENDENCY="python-pipenv gnupg pkgconf base-devel"
$green"\nDetected Arch Linux\n";$nocolor $green"\nDetected Arch Linux\n";$nocolor
elif type -P brew > /dev/null; then elif type -P brew > /dev/null; then
# MacOS # MacOS
INSTALL="brew install" INSTALL="brew install"
DEPENDENCY="python protobuf gnupg pkg-config" DEPENDENCY="python gnupg pkg-config"
$green"\nDetected MacOS\n";$nocolor $green"\nDetected MacOS\n";$nocolor
else else
$red"Failed to detect OS. Unsupported or unknown distribution.\nInstall Failed.";$nocolor $red"Failed to detect OS. Unsupported or unknown distribution.\nInstall Failed.";$nocolor
@ -50,10 +74,17 @@ detect_os_arch() {
fi fi
} }
detect_os_arch detect_os_arch
## Update & Install dependencies
echo -e "\n\nInstalling dependencies\nPress CTRL-C at password prompt(s) to skip. If skipped, you must install the dependencies manually before proceeding"
$green"$UPDATE\n$INSTALL $DEPENDENCY curl automake libtool jq\n"; $nocolor
$UPDATE
$INSTALL $DEPENDENCY curl automake libtool jq
# Enable tor # Enable tor
echo -e "\n\n[1] Tor ON\n[2] Tor OFF\n" echo -e "\n\n[1] Tor ON (requires sudo)\n[2] Tor OFF\n"
until [[ "$tor_on" =~ ^[12]$ ]]; do until [[ "$tor_on" =~ ^[12]$ ]]; do
read -p 'Select an option: [1|2] ' tor_on read -p 'Select an option: [1|2] ' tor_on
case $tor_on in case $tor_on in
@ -121,9 +152,16 @@ until [[ "$l" =~ ^[12]$ ]]; do
read -p 'Select an option [1|2]: ' l read -p 'Select an option [1|2]: ' l
case $l in case $l in
1) 1)
read -p 'Enter Address of Monero node [example: 192.168.1.123] ' monerod_addr until [[ $checknode ]]; do
read -p 'Enter RPC Port for the Monero node [example: 18081] ' monerod_port read -p 'Enter Address of Monero node [example: 192.168.1.123] ' monerod_addr
$green"\nLook good? $monerod_addr:$monerod_port"; $nocolor read -p 'Enter RPC Port for the Monero node [example: 18081] ' monerod_port
checknode=$(curl -sk http://$monerod_addr:$monerod_port/get_info)
if [[ $checknode ]]; then
$green"\nSuccessfully connected to the XMR node @ $monerod_addr:$monerod_port"; $nocolor
else
$red"\nThe node at $monerod_addr:$monerod_port is not accessible. Try again\n\n"; $nocolor
fi
done
;; ;;
2) 2)
$green"\nBasicSwapDEX will run the Monero node for you."; $nocolor $green"\nBasicSwapDEX will run the Monero node for you."; $nocolor
@ -135,22 +173,43 @@ read -p 'Select an option [1|2]: ' l
done done
## Begin Install ## Begin Install
echo -e "\n\nInstalling dependencies" echo -e "\n\nInstalling BasicSwapDEX"
read -p 'Press Enter to continue, or CTRL-C to exit.' read -p 'Press Enter to continue, or CTRL-C to exit.'
## Update & Install dependencies
$UPDATE # Quest to make trasher happy
$INSTALL $DEPENDENCY git wget unzip automake libtool jq addpath='PATH="$HOME/.local/bin:$PATH"'
# Move scripts to /usr/local/bin trasherdk=$(echo $PATH | grep .local/bin:)
sudo rm -r /usr/local/bin/bsx* /usr/local/bin/basicswap-bash if ! [[ $trasherdk ]]; then
sudo mv -f -t /usr/local/bin/ basicswap-bash bsx* mkdir -p $HOME/.local/bin
# Bash
if [[ -f $HOME/.bashrc ]]; then
echo "export $addpath" | tee -a $HOME/.bashrc
fi
# Zsh
if [[ -f $HOME/.zshrc ]]; then
echo "export $addpath" | tee -a $HOME/.zshrc
fi
# xfce4
if [[ -f $HOME/.xsessionrc ]]; then
echo "export $addpath" | tee -a $HOME/.xsessionrc
fi
fi
# Move scripts to .local/bin
if [[ -d $HOME/.local/bin/bsx ]]; then
rm -r $HOME/.local/bin/bsx* $HOME/.local/bin/basicswap-bash
fi
mv -f -t $HOME/.local/bin/ basicswap-bash bsx*
## Make venv and set variables for install ## Make venv and set variables for install
export SWAP_DATADIR=$HOME/coinswaps
export monerod_addr=$monerod_addr export monerod_addr=$monerod_addr
export monerod_port=$monerod_port export monerod_port=$monerod_port
export particl_mnemonic=$particl_mnemonic export particl_mnemonic=$particl_mnemonic
export xmrrestoreheight=$xmrrestoreheight export xmrrestoreheight=$xmrrestoreheight
export tor_on=$tor_on export tor_on=$tor_on
mkdir -p "$SWAP_DATADIR/venv" export TAILS=$TAILS
python -m venv "$SWAP_DATADIR/venv" python -m venv "$SWAP_DATADIR/venv"
## Activate venv ## Activate venv
/usr/local/bin/bsx/activate_venv.sh $HOME/.local/bin/bsx/activate_venv.sh

View file

@ -1,10 +0,0 @@
#/bin/bash
# Download Scripts
curl -LO https://github.com/nahuhh/basicswap-bash/releases/download/beta/basicswap-beta.tar.gz
tar xvf basicswap-beta.tar.gz
cd basicswap-beta
# Install BasicSwapDEX
./install.sh
# Cleanup
cd ..
rm -rf basicswap-beta

View file

@ -1,11 +0,0 @@
#/bin/bash
# Download updated scripts
curl -LO https://github.com/nahuhh/basicswap-bash/releases/download/beta/basicswap-beta.tar.gz
tar xvf basicswap-beta.tar.gz
cd basicswap-beta
# Move scripts
sudo rm -rf /usr/local/bin/bsx
sudo mv -f basic* bsx* /usr/local/bin/
# Cleanup install
cd ..
rm -rf basicswap-beta