mirror of
https://github.com/nahuhh/basicswap-bash.git
synced 2024-12-23 03:59:21 +00:00
Compare commits
1 commit
c319bcfcd3
...
91447cf5ec
Author | SHA1 | Date | |
---|---|---|---|
|
91447cf5ec |
26 changed files with 201 additions and 962 deletions
29
README.md
29
README.md
|
@ -1,30 +1,21 @@
|
||||||
# basicswap-bash
|
# basicswap-bash
|
||||||
A suite of bash scripts to install and manage
|
A BasicSwapDEX bash installer for Debian/Ubuntu/Arch/Fedora
|
||||||
BasicSwapDEX on Windows(WSL)/Debian/Ubuntu/Arch/Fedora
|
User account must have sudo privileges
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
### New Installation
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/nahuhh/basicswap-bash
|
git clone https://github.com/nahuhh/basicswap-bash -b dev
|
||||||
cd basicswap-bash && ./install.sh
|
cd basicswap-bash && ./install.sh
|
||||||
cd .. && rm -rf basicswap-bash
|
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 and Coin cores
|
#### Update BSX core
|
||||||
```
|
```
|
||||||
bsx-update
|
bsx-update
|
||||||
```
|
```
|
||||||
|
@ -45,12 +36,12 @@ bsx-addcoin
|
||||||
bsx-removecoin
|
bsx-removecoin
|
||||||
```
|
```
|
||||||
|
|
||||||
### BONUS placeorders
|
#### Update blockchains
|
||||||
This is a POC for placing new orders. YMMV
|
|
||||||
```
|
```
|
||||||
bsx-placeorder
|
bsx-upgradecoins
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
A small donation goes a long way. Thanks
|
A small donation goes a long way. Thanks
|
||||||
- ofrnxmr
|
- ofrnxmr
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,21 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
|
python3 -m venv "$SWAP_DATADIR/venv"
|
||||||
# Colors
|
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||||
red="echo -e -n \e[31;1m"
|
/usr/local/bin/bsx/startup.sh
|
||||||
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
|
|
||||||
$HOME/.local/bin/bsx/startup.sh
|
|
||||||
|
|
46
bsx-addcoin
46
bsx-addcoin
|
@ -1,46 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
|
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||||
# Colors
|
/usr/local/bin/bsx/addcoin.sh
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
. $SWAP_DATADIR/venv/bin/activate
|
|
||||||
$HOME/.local/bin/bsx/addcoin.sh
|
|
||||||
|
|
|
@ -1,46 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
|
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||||
# Colors
|
/usr/local/bin/bsx/disabletor.sh
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
. $SWAP_DATADIR/venv/bin/activate
|
|
||||||
$HOME/.local/bin/bsx/disabletor.sh
|
|
||||||
|
|
|
@ -1,46 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
|
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||||
# Colors
|
/usr/local/bin/bsx/enabletor.sh
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
. $SWAP_DATADIR/venv/bin/activate
|
|
||||||
$HOME/.local/bin/bsx/enabletor.sh
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
|
||||||
|
|
||||||
# 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)
|
|
||||||
bsx_run=$(pgrep particld | grep $bsx_pid)
|
|
||||||
if ! [[ $bsx_run ]]; then
|
|
||||||
$red"\nError: BasicSwapDEX must be running.\n"; $nocolor
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
$red"\nError: BasicSwapDEX must be running.\n"; $nocolor
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp $HOME/.local/bin/bsx/placeorders/* $SWAP_DATADIR/basicswap/scripts/.
|
|
||||||
cd $SWAP_DATADIR/basicswap/scripts/
|
|
||||||
|
|
||||||
./placeorders.sh
|
|
|
@ -1,46 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
|
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||||
# Colors
|
/usr/local/bin/bsx/removecoin.sh
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
. $SWAP_DATADIR/venv/bin/activate
|
|
||||||
$HOME/.local/bin/bsx/removecoin.sh
|
|
||||||
|
|
44
bsx-update
44
bsx-update
|
@ -1,44 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
|
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||||
# Colors
|
/usr/local/bin/bsx/update.sh
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
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
|
|
||||||
|
|
||||||
# Update BasicSwap, coincurve and coin cores
|
|
||||||
$HOME/.local/bin/bsx/update.sh
|
|
||||||
fi
|
|
||||||
|
|
4
bsx-upgrade-coins
Executable file
4
bsx-upgrade-coins
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
|
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||||
|
/usr/local/bin/bsx/upgradecoins.sh
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
. $SWAP_DATADIR/venv/bin/activate
|
. $SWAP_DATADIR/venv/bin/activate && python -V
|
||||||
if [[ $TAILS ]]; then
|
if [[ $TAILS ]]; then
|
||||||
$HOME/.local/bin/bsx/tails_setup.sh
|
/usr/local/bin/bsx/tails_setup.sh
|
||||||
else
|
else
|
||||||
$HOME/.local/bin/bsx/setup.sh
|
/usr/local/bin/bsx/setup.sh
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
## Prompt for user input
|
## Prompt for user input
|
||||||
printf "\n\nThe following coins can be added (case sensitive)\nbitcoin\ndash\ndecred\nfiro\nlitecoin\npivx\nwownero\n\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
|
||||||
read -p $'\nAdd '$addcoin' to your BasicSwap install, correct? Press ENTER to continue. CTRL-C to exit'
|
read -p $'\nAdd '$addcoin' to your BasicSwap install, correct? Press ENTER to continue. CTRL-C to exit'
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#set -x
|
|
||||||
SWAP_DATADIR=$HOME/coinswaps
|
|
||||||
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
|
|
|
@ -1,58 +1,36 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
red="printf \e[31;1m"
|
red="echo -e -n \e[31;1m"
|
||||||
green="printf \e[32;1m"
|
green="echo -e -n \e[32;1m"
|
||||||
nocolor="printf \e[0m"
|
nocolor="echo -e -n \e[0m"
|
||||||
|
|
||||||
# Detect Operating system
|
# Detect Operating system
|
||||||
INSTALL=""
|
INSTALL=""
|
||||||
UPDATE=""
|
UPDATE=""
|
||||||
INIT_TOR=""
|
INIT_TOR="sudo systemctl restart tor"
|
||||||
SYSTEMD_TOR="sudo systemctl restart tor"
|
|
||||||
|
|
||||||
check_tails() {
|
|
||||||
if [[ $USER == amnesia ]]; then
|
|
||||||
$green"\n\nDetected Tails";$nocolor
|
|
||||||
TAILS=1
|
|
||||||
else
|
|
||||||
$green"\n\nDetected Debian";$nocolor
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
detect_os_arch() {
|
detect_os_arch() {
|
||||||
if [[ $(uname -s) = "Darwin" ]]; then
|
if type -P apt > /dev/null; then
|
||||||
# MacOS
|
|
||||||
export MACOS=1
|
|
||||||
if type -p brew > /dev/null; then
|
|
||||||
$green"Homebrew is installed\n";$nc
|
|
||||||
INSTALL="brew install"
|
|
||||||
else
|
|
||||||
$green"Installing Homebrew\n";$nc
|
|
||||||
INSTALL="curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | /bin/bash && brew install"
|
|
||||||
fi
|
|
||||||
INIT_TOR="pkill tor && tor"
|
|
||||||
$green"\n\nDetected MacOS";$nocolor
|
|
||||||
elif type -p apt > /dev/null; then
|
|
||||||
check_tails
|
|
||||||
# Debian / Ubuntu / Mint
|
# Debian / Ubuntu / Mint
|
||||||
INSTALL="sudo apt install"
|
INSTALL="sudo apt install -y"
|
||||||
UPDATE="sudo apt update"
|
UPDATE="sudo apt update"
|
||||||
INIT_TOR=$SYSTEMD_TOR
|
$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 -y"
|
||||||
UPDATE="sudo dnf check-update"
|
UPDATE="sudo dnf check-update"
|
||||||
INIT_TOR=$SYSTEMD_TOR
|
$green"\nDetected Fedora\n";$nocolor
|
||||||
$green"\n\nDetected Fedora";$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"
|
||||||
INIT_TOR=$SYSTEMD_TOR
|
$green"\nDetected Arch Linux\n";$nocolor
|
||||||
$green"\n\nDetected Arch Linux";$nocolor
|
elif type -P brew > /dev/null; then
|
||||||
|
# MacOS
|
||||||
|
INSTALL="brew install"
|
||||||
|
$green"\nDetected MacOS\n";$nocolor
|
||||||
else
|
else
|
||||||
$red"\nFailed to detect OS. Unsupported or unknown distribution.\nInstall Failed.\n";$nocolor
|
$red"Failed to detect OS. Unsupported or unknown distribution.\nInstall Failed.";$nocolor
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -60,8 +38,8 @@ detect_os_arch() {
|
||||||
detect_os_arch
|
detect_os_arch
|
||||||
|
|
||||||
# Check for Tor installation
|
# Check for Tor installation
|
||||||
if type -p tor > /dev/null; then
|
if type -P tor > /dev/null; then
|
||||||
printf "\nTor is already installed :)\n"
|
echo -e "\nTor is already installed :)"
|
||||||
else
|
else
|
||||||
# Install and configure tor
|
# Install and configure tor
|
||||||
echo "Installing Tor..."
|
echo "Installing Tor..."
|
||||||
|
@ -69,19 +47,18 @@ else
|
||||||
$INSTALL tor
|
$INSTALL tor
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create HashedControlPassword
|
# Create HashesControlPassword
|
||||||
printf "In the next step you'll choose a password. NOTE: It will be saved in PLAIN TEXT.\n"
|
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=$(sudo grep -x "$enabledcontrol" /etc/tor/torrc)
|
skipcontrol=$(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
|
||||||
printf "# Added by basicswap-bash\nHashedControlPassword $torhashedpass\n" | sudo tee -a /etc/tor/torrc
|
echo -e "# Added by basicswap-bash\nHashedControlPassword $torhashedpass" | sudo tee -a /etc/tor/torrc
|
||||||
else
|
else
|
||||||
printf "# Added by basicswap-bash\n$enabledcontrol\nHashedControlPassword $torhashedpass\n" | sudo tee -a /etc/tor/torrc
|
echo -e "# Added by basicswap-bash\n$enabledcontrol\nHashedControlPassword $torhashedpass" | sudo tee -a /etc/tor/torrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restart tor to apply
|
# Restart tor to apply
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"offers": [],
|
|
||||||
"bids": [
|
|
||||||
{
|
|
||||||
"coin_from": "COIN_TO_BUY",
|
|
||||||
"coin_to": "COIN_TO_SELL",
|
|
||||||
"amount": AMOUNT,
|
|
||||||
"maxrate": RATE,
|
|
||||||
"address": "-1",
|
|
||||||
"min_swap_amount": MIN_SWAP,
|
|
||||||
"max_coin_from_balance": -1,
|
|
||||||
"min_coin_to_balance": 0,
|
|
||||||
"max_concurrent": MAXBIDS,
|
|
||||||
"name": "GUI Bid"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"stealthex": [],
|
|
||||||
"min_seconds_between_offers": 5,
|
|
||||||
"max_seconds_between_offers": 5,
|
|
||||||
"min_seconds_between_bids": 10,
|
|
||||||
"max_seconds_between_bids": 10,
|
|
||||||
"num_enabled_offers": 0,
|
|
||||||
"num_enabled_bids": 1,
|
|
||||||
"num_enabled_swaps": 0
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
{
|
|
||||||
"offers": [
|
|
||||||
{
|
|
||||||
"enabled": true,
|
|
||||||
"coin_from": "COIN_TO_SELL",
|
|
||||||
"coin_to": "COIN_TO_BUY",
|
|
||||||
"amount": AMOUNT,
|
|
||||||
"amount_step": INCREMENT,
|
|
||||||
"minrate": RATE,
|
|
||||||
"ratetweakpercent": PERCENT,
|
|
||||||
"amount_variable": true,
|
|
||||||
"address": "-1",
|
|
||||||
"name": "GUI Offer",
|
|
||||||
"min_coin_from_amt": -1,
|
|
||||||
"min_swap_amount": MIN_SWAP,
|
|
||||||
"offer_valid_seconds": 14400
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"bids": [],
|
|
||||||
"stealthex": [],
|
|
||||||
"min_seconds_between_offers": 10,
|
|
||||||
"max_seconds_between_offers": 10,
|
|
||||||
"min_seconds_between_bids": 10,
|
|
||||||
"max_seconds_between_bids": 10,
|
|
||||||
"num_enabled_offers": 1,
|
|
||||||
"num_enabled_bids": 0,
|
|
||||||
"num_enabled_swaps": 0
|
|
||||||
}
|
|
|
@ -1,346 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
############################
|
|
||||||
###########################
|
|
||||||
#set -x
|
|
||||||
PORT=12700 # BasicSwapDex http port
|
|
||||||
|
|
||||||
# config file location
|
|
||||||
taker=placebid.json
|
|
||||||
maker=placeoffer.json
|
|
||||||
state=placeorders_state.json
|
|
||||||
|
|
||||||
# Defaults
|
|
||||||
ALLOW_SPLIT_ORDERS=true # Sane default TODO
|
|
||||||
MAXBIDS=10 # TODO
|
|
||||||
PERCENT=2.5 # Max slippage for "Market" order types
|
|
||||||
|
|
||||||
# FUNC - dont touch
|
|
||||||
BUYORSELL=""
|
|
||||||
AMOUNT=""
|
|
||||||
TAKER_RATE=""
|
|
||||||
MAKER_RATE=""
|
|
||||||
OB_MIN=""
|
|
||||||
MIN_MAKER=""
|
|
||||||
MIN_TAKER=""
|
|
||||||
###########################
|
|
||||||
############################
|
|
||||||
|
|
||||||
# Colors
|
|
||||||
cy="printf \e[36;1m"
|
|
||||||
cy2="\e[36;1m"
|
|
||||||
red="printf \e[31;1m"
|
|
||||||
red2="\e[31;1m"
|
|
||||||
grn="printf \e[32;1m"
|
|
||||||
grn2="\e[32;1m"
|
|
||||||
nc="printf \e[0m"
|
|
||||||
nc2="\e[0m"
|
|
||||||
|
|
||||||
# Choose Coins
|
|
||||||
coin_prompt_buy() {
|
|
||||||
THEIR_COIN=$COIN
|
|
||||||
theircoin=$coinsymbol
|
|
||||||
theircapital=$coinname
|
|
||||||
}
|
|
||||||
coin_prompt_sell() {
|
|
||||||
YOUR_COIN=$COIN
|
|
||||||
yourcoin=$coinsymbol
|
|
||||||
yourcapital=$coinname
|
|
||||||
}
|
|
||||||
coin() {
|
|
||||||
coin=""
|
|
||||||
printf "\n[1] Bitcoin\n[2] Monero\n[3] Litecoin\n[4] Firo\n[5] Dash\n[6] Decred\n[7] PIVX\n[8] Particl\n[9] Wownero\n\n"
|
|
||||||
until [[ $coin =~ ^[1-9]$ ]]; do
|
|
||||||
read -p 'Select an option: ' coin
|
|
||||||
case $coin in
|
|
||||||
1) COIN="bitcoin"
|
|
||||||
coinname="Bitcoin"
|
|
||||||
coinsymbol="BTC"
|
|
||||||
;;
|
|
||||||
2) COIN="monero"
|
|
||||||
coinname="Monero"
|
|
||||||
coinsymbol="XMR"
|
|
||||||
;;
|
|
||||||
3) COIN="litecoin"
|
|
||||||
coinname="Litecoin"
|
|
||||||
coinsymbol="LTC"
|
|
||||||
;;
|
|
||||||
4) COIN="zcoin"
|
|
||||||
coinname="Firo"
|
|
||||||
coinsymbol="FIRO"
|
|
||||||
;;
|
|
||||||
5) COIN="dash"
|
|
||||||
coinname="Dash"
|
|
||||||
coinsymbol="DASH"
|
|
||||||
;;
|
|
||||||
6) COIN="dcr"
|
|
||||||
coinname="Decred"
|
|
||||||
coinsymbol="DCR"
|
|
||||||
;;
|
|
||||||
7) COIN="pivx"
|
|
||||||
coinname="PIVX"
|
|
||||||
coinsymbol="PIVX"
|
|
||||||
;;
|
|
||||||
8) COIN="particl"
|
|
||||||
coinname="Particl"
|
|
||||||
coinsymbol="PART"
|
|
||||||
;;
|
|
||||||
9) COIN="wownero"
|
|
||||||
coinname="Wownero"
|
|
||||||
coinsymbol="WOW"
|
|
||||||
;;
|
|
||||||
*) $red"\nYou must answer 1-9\n"; $nc
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
book_min() {
|
|
||||||
if [[ $coin = 1 ]]; then # BITCOIN
|
|
||||||
OB_MIN=0.0050
|
|
||||||
MIN_SWAP=0.0010
|
|
||||||
elif [[ $coin = 2 ]]; then # MONERO
|
|
||||||
OB_MIN=0.2000
|
|
||||||
MIN_SWAP=0.0300
|
|
||||||
elif [[ $coin = 3 ]]; then # LITECOIN
|
|
||||||
OB_MIN=0.4000
|
|
||||||
MIN_SWAP=0.0600
|
|
||||||
elif [[ $coin = 4 ]]; then # FIRO
|
|
||||||
OB_MIN=20.0000
|
|
||||||
MIN_SWAP=8.0000
|
|
||||||
elif [[ $coin = 5 ]]; then # DASH
|
|
||||||
OB_MIN=1.0000
|
|
||||||
MIN_SWAP=0.2000
|
|
||||||
elif [[ $coin = 6 ]]; then # DECRED
|
|
||||||
OB_MIN=1.0000
|
|
||||||
MIN_SWAP=0.2000
|
|
||||||
elif [[ $coin = 7 ]]; then # PIVX
|
|
||||||
OB_MIN=50.0000
|
|
||||||
MIN_SWAP=10.0000
|
|
||||||
elif [[ $coin = 8 ]]; then # PARTICL
|
|
||||||
OB_MIN=50.0000
|
|
||||||
MIN_SWAP=10.0000
|
|
||||||
elif [[ $coin = 9 ]]; then # WOWNERO
|
|
||||||
OB_MIN=50.0000
|
|
||||||
MIN_SWAP=10.0000
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set_fiat() {
|
|
||||||
printf "[1] USD [default]\n[2] EUR\n[3] CAD\n[4] AUD\n[5] CUSTOM\n\n"
|
|
||||||
read -p 'Select an option: ' fiat_select
|
|
||||||
case $fiat_select in
|
|
||||||
1) FIAT=USD
|
|
||||||
fiat=usd
|
|
||||||
echo "USD"
|
|
||||||
;;
|
|
||||||
2) FIAT=EUR
|
|
||||||
fiat=eur
|
|
||||||
echo "EUR"
|
|
||||||
;;
|
|
||||||
3) FIAT=CAD
|
|
||||||
fiat=cad
|
|
||||||
echo "CAD"
|
|
||||||
;;
|
|
||||||
4) FIAT=AUD
|
|
||||||
fiat=aud
|
|
||||||
echo "AUD"
|
|
||||||
;;
|
|
||||||
5) read -p 'Please enter the lowecase 3 character currency code [example: jpy] ' FIAT
|
|
||||||
fiat=$FIAT
|
|
||||||
;;
|
|
||||||
*) FIAT=USD
|
|
||||||
fiat=usd
|
|
||||||
echo "USD"
|
|
||||||
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
coin_price() {
|
|
||||||
printf "\n\nCurrent Market Rates are..\n"
|
|
||||||
curl -s "https://api.coingecko.com/api/v3/simple/price?ids=$THEIR_COIN,$YOUR_COIN&vs_currencies=$fiat" > rates.txt
|
|
||||||
YOUR_FIAT=$(cat rates.txt | jq -r ".$YOUR_COIN.$fiat")
|
|
||||||
THEIR_FIAT=$(cat rates.txt | jq -r ".$THEIR_COIN.$fiat")
|
|
||||||
TAKER_RATE=$(echo $THEIR_FIAT $YOUR_FIAT | awk '{ printf "%.8f\n", $1 / $2 }' )
|
|
||||||
MAKER_RATE=$(echo $TAKER_RATE | awk '{ printf "%.8f\n", 1 / $1 }')
|
|
||||||
$cy"$THEIR_FIAT $FIAT$nc2/$grn2$theircoin$nc2 which is $red2$TAKER_RATE $yourcoin$nc2/$grn2$theircoin$nc2\n"
|
|
||||||
$cy"$YOUR_FIAT $FIAT$nc2/$red2$yourcoin$nc2 which is $grn2$MAKER_RATE $theircoin$nc2/$red2$yourcoin$nc2\n"
|
|
||||||
rm rates.txt
|
|
||||||
}
|
|
||||||
|
|
||||||
buy_sell() {
|
|
||||||
printf "\n\n[1] BUY a specific amount of $grn2$theircapital$nc2\n[2] SELL a specific amount of your $red2$yourcapital$nc2\n\n"
|
|
||||||
until [[ $BUYORSELL =~ ^[12]$ ]]; do
|
|
||||||
read -p 'Select an option: ' BUYORSELL
|
|
||||||
case $BUYORSELL in
|
|
||||||
1) read -p $'\nHow much '"$theircapital"' do you want to BUY? [example: 1] ' AMOUNT
|
|
||||||
$cy"\nRate you will pay:\n";$nc
|
|
||||||
printf "\n[1] CUSTOM: Specific Crypto Rate $red2$yourcoin$nc2/$grn2$theircoin$nc2\n[2] CUSTOM: $red2$TAKER_RATE $yourcoin$nc2/$grn2$theircoin $cy2+/- CUSTOM Percent$nc2\n[3] PRESET: $red2$TAKER_RATE $yourcoin$nc2/$grn2$theircoin$nc2\n[4] PRESET: $red2$TAKER_RATE $yourcoin$nc2/$grn2$theircoin $cy2+ $PERCENT%%$nc2\n[ENTER] FIAT: Enter a $cy2$FIAT$nc2 rate to pay\n\n"
|
|
||||||
read -p 'Select an option: ' RATESEL
|
|
||||||
case $RATESEL in
|
|
||||||
1) read -p $"At what rate would you like to Pay? [example: $TAKER_RATE] " RATE
|
|
||||||
PRICE=$(echo $YOUR_FIAT $RATE | awk '{ printf "%.2f\n", $1 * $2 }')
|
|
||||||
PERCENT=0
|
|
||||||
;;
|
|
||||||
2) read -p 'Pay this much % above or below market [example: [0.5|-0.5] ' PERCENT
|
|
||||||
RATE=$(echo $TAKER_RATE $PERCENT | awk '{ printf "%.8f\n", ( $1 * ( $2 / 100 + 1 ))}')
|
|
||||||
PRICE=$(echo $YOUR_FIAT * $RATE | awk '{ printf "%.2f\n", $1 * $2 }')
|
|
||||||
;;
|
|
||||||
3) RATE=$TAKER_RATE
|
|
||||||
PRICE=$THEIR_FIAT
|
|
||||||
PERCENT=0
|
|
||||||
;;
|
|
||||||
4) RATE=$(echo $TAKER_RATE $PERCENT | awk '{ printf "%.8f\n", ( $1 * ( $2 / 100 + 1 ))}')
|
|
||||||
PRICE=$(echo $YOUR_FIAT $RATE | awk '{ printf "%.2f\n", $1 * $2 }')
|
|
||||||
;;
|
|
||||||
*) read -p $"Enter specific price in $FIAT to PAY? [example: "$THEIR_FIAT"] " PRICE
|
|
||||||
RATE=$(echo $PRICE $YOUR_FIAT | awk '{ printf "%.8f\n", $1 / $2 }')
|
|
||||||
PERCENT=0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
MAKER_RATE=$(echo $RATE | awk '{ printf "%.8f\n", 1 / $1 }')
|
|
||||||
printf "\nPaying: $red2 $PRICE$FIAT$nc2 which is $red2($RATE $yourcoin$nc2/$grn2$theircoin$nc2)\n"
|
|
||||||
printf "Rate to be paid: $grn2$MAKER_RATE $theircoin$nc2/$red2$yourcoin$nc2\n\n"
|
|
||||||
;;
|
|
||||||
2) read -p $'\nHow much YOUR '"$yourcapital"' do you want to SELL [example: 1] ' AMOUNT
|
|
||||||
$cy"\nRate to charge:\n";$nc
|
|
||||||
printf "\n[1] CUSTOM: Specific Crypto Rate $grn2$theircoin$nc2/$red2$yourcoin$nc2\n[2] CUSTOM: $grn2$MAKER_RATE $theircoin$nc2/$red2$yourcoin $cy2+/- CUSTOM Percent$nc2\n[3] PRESET: $grn2$MAKER_RATE $theircoin$nc2/$red2$yourcoin$nc2\n[4] PRESET: $grn2$MAKER_RATE $theircoin$nc2/$red2$yourcoin $cy2+ $PERCENT%%$nc2\n[ENTER] FIAT: Enter a $cy2$FIAT$nc2 rate to charge\n\n"
|
|
||||||
read -p 'Select an option: ' RATESEL
|
|
||||||
case $RATESEL in
|
|
||||||
1) read -p $"Enter specific rate to Charge? [example: $MAKER_RATE] " RATE
|
|
||||||
PRICE=$(echo $THEIR_FIAT $RATE | awk '{ printf "%.2f\n", $1 * $2 }')
|
|
||||||
PERCENT=0
|
|
||||||
;;
|
|
||||||
2) read -p 'Charge this much percent above market [example: [0.5 or -0.5] ] ' PERCENT
|
|
||||||
RATE=$(echo $MAKER_RATE $PERCENT | awk '{ printf "%.8f\n", ( $1 * ( $2 / 100 + 1 ))}')
|
|
||||||
PRICE=$(echo $THEIR_FIAT $RATE | awk '{ printf "%.2f\n", $1 * $2 }')
|
|
||||||
;;
|
|
||||||
3) RATE=$MAKER_RATE
|
|
||||||
PRICE=$(echo $THEIR_FIAT $RATE | awk '{ printf "%.2f\n", $1 * $2 }')
|
|
||||||
PERCENT=0
|
|
||||||
;;
|
|
||||||
4) RATE=$(echo $MAKER_RATE $PERCENT | awk '{ printf "%.8f\n", ( $1 * ( $2 / 100 + 1 ))}')
|
|
||||||
PRICE=$(echo $THEIR_FIAT $RATE | awk '{ printf "%.2f\n", $1 * $2 }')
|
|
||||||
;;
|
|
||||||
*) read -p $"Enter specific price in $FIAT to Charge? [example: "$YOUR_FIAT"] " PRICE
|
|
||||||
RATE=$(echo $PRICE $THEIR_FIAT | awk '{ printf "%.8f\n", $1 / $2 }')
|
|
||||||
PERCENT=0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
TAKER_RATE=$(echo $RATE | awk '{ printf "%.8f\n", 1 / $1 }')
|
|
||||||
printf "Selling at $PRICE$FIAT which is a rate of $grn2$RATE $theircoin$nc2/$red2$yourcoin$nc2\n"
|
|
||||||
;;
|
|
||||||
*) $red"\nYou must answer 1 or 2\n"; $nc
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# TODO // ENABLE SPLIT ORDERS
|
|
||||||
split_orders() {
|
|
||||||
if [ $ALLOW_SPLIT_ORDERS = true ]; then
|
|
||||||
MIN_SWAP=$(echo $AMOUNT $MAXBIDS | awk '{ printf "%.0f\n", $1 / $2 }')
|
|
||||||
printf "$cy2#TODO$nc2 Splitting into multiple bids if necessary. $red2$MAXBIDS$nc2 tx at most\n"
|
|
||||||
else
|
|
||||||
MIN_SWAP=$AMOUNT
|
|
||||||
$red"One order only. Not Recommended";$nc
|
|
||||||
echo "$MIN_SWAP"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
apply_config() {
|
|
||||||
# Convert amount
|
|
||||||
MIN_TAKER=$(echo $MIN_SWAP $MAKER_RATE | awk '{ printf "%.8f\n", $1 * $2 }')
|
|
||||||
sed -i -z "s/MIN_SWAP/$MIN_TAKER/" $taker
|
|
||||||
sed -i -z "s/MIN_SWAP/$MIN_SWAP/" $maker
|
|
||||||
sed -i -z "s/COIN_TO_SELL/$yourcapital/" $taker $maker
|
|
||||||
sed -i -z "s/COIN_TO_BUY/$theircapital/" $taker $maker
|
|
||||||
sed -i -z "s/PERCENT/$PERCENT/" $maker
|
|
||||||
sed -i -z "s/MAXBIDS/$MAXBIDS/" $taker
|
|
||||||
printf "\nMinumum amt per swap = $grn2$MIN_TAKER $theircoin$nc2\n"
|
|
||||||
printf " = $red2$MIN_SWAP $yourcoin$nc2\n\n"
|
|
||||||
if [[ $BUYORSELL = 1 ]]; then
|
|
||||||
MAKERAMOUNT=$(echo $AMOUNT $MAKER_RATE | awk '{ printf "%.8f\n", $1 / $2 }')
|
|
||||||
OB_AMOUNT=$MAKERAMOUNT
|
|
||||||
INCREMENT=$(echo $OB_AMOUNT | awk '{ printf "%.4f", $1 / 10 }')
|
|
||||||
printf "Outgoing: $red2$MAKERAMOUNT $yourcoin$nc2\n"
|
|
||||||
printf "Incoming: $grn2~$AMOUNT $theircoin$nc2\n"
|
|
||||||
sed -i -z "s/AMOUNT/$MAKERAMOUNT/g" $maker
|
|
||||||
sed -i -z "s/RATE/$MAKER_RATE/" $maker
|
|
||||||
sed -i -z "s/RATE/$RATE/" $taker
|
|
||||||
sed -i -z "s/AMOUNT/$AMOUNT/g" $taker
|
|
||||||
sed -i -z "s/INCREMENT/$INCREMENT/" $maker
|
|
||||||
else
|
|
||||||
TAKERAMOUNT=$(echo $AMOUNT $MAKER_RATE | awk '{ printf "%.8f\n", $1 * $2 }')
|
|
||||||
OB_AMOUNT=$AMOUNT
|
|
||||||
INCREMENT=$(echo $OB_AMOUNT | awk '{ printf "%.4f", $1 / 10 }')
|
|
||||||
printf "Outgoing: $red2$AMOUNT $yourcoin$nc2\n"
|
|
||||||
printf "Incoming: $grn2~$TAKERAMOUNT $theircoin$nc2\n"
|
|
||||||
sed -i -z "s/AMOUNT/$TAKERAMOUNT/g" $taker
|
|
||||||
sed -i -z "s/RATE/$TAKER_RATE/" $taker
|
|
||||||
sed -i -z "s/RATE/$RATE/" $maker
|
|
||||||
sed -i -z "s/AMOUNT/$AMOUNT/g" $maker
|
|
||||||
sed -i -z "s/INCREMENT/$INCREMENT/" $maker
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
revert_config() {
|
|
||||||
cp placeorders_state.json.template $state
|
|
||||||
cp placeoffer.json.template $maker
|
|
||||||
cp placebid.json.template $taker
|
|
||||||
}
|
|
||||||
|
|
||||||
check_bids() {
|
|
||||||
# oneshot. Check for matching offers before posting one
|
|
||||||
revert_config
|
|
||||||
apply_config
|
|
||||||
FOUNDBID=$(python3 createoffers.py --configfile $taker --statefile $state --port=$PORT --oneshot --debug | grep "New bid")
|
|
||||||
if [[ $FOUNDBID ]]; then
|
|
||||||
$grn"Placed bid successfully! Check BasicSwapDEX to confirm\n";$nc
|
|
||||||
elif [[ $OB_AMOUNT < $OB_MIN && -z $FOUNDBID ]]; then
|
|
||||||
printf "Checking for a matching offer\n"
|
|
||||||
printf "No matching offers found $red2:@ !!!$nc2\nBid quantity too$red2 low$nc2 to post to order book.\nTrying again in 30 seconds\n"
|
|
||||||
sleep 30
|
|
||||||
$cy"Rechecking bids\n";$nc
|
|
||||||
recheck_bids
|
|
||||||
else
|
|
||||||
# Post as limit order on the book
|
|
||||||
$cy"No matching offers found. Posting to the orderbook\n";$nc
|
|
||||||
ORDERPLACED=$(python3 createoffers.py --configfile $maker --statefile $state --port=$PORT --oneshot | grep "New offer")
|
|
||||||
if [[ $ORDERPLACED ]]; then
|
|
||||||
$grn"OFFER POSTED! Please check BasicSwapDEX to confirm\nOffer expires in 4hrs\n";$nc
|
|
||||||
else
|
|
||||||
$red"Placing Order failed. Try again$nc2\n"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
recheck_bids() {
|
|
||||||
check_bids
|
|
||||||
echo rechecking
|
|
||||||
}
|
|
||||||
|
|
||||||
# 1. Choose coins
|
|
||||||
revert_config
|
|
||||||
set_fiat
|
|
||||||
|
|
||||||
$grn"\n\nName of coin to buy";$nc
|
|
||||||
coin
|
|
||||||
coin_prompt_buy
|
|
||||||
|
|
||||||
$red"\n\nName of coin to sell";$nc
|
|
||||||
coin
|
|
||||||
coin_prompt_sell
|
|
||||||
|
|
||||||
printf "\nBuying: $grn2$theircapital$nc2"
|
|
||||||
printf "\nSelling: $red2$yourcapital$nc2\n"
|
|
||||||
|
|
||||||
#2. Set rates
|
|
||||||
# Pull Market rate
|
|
||||||
coin_price
|
|
||||||
buy_sell
|
|
||||||
split_orders
|
|
||||||
book_min
|
|
||||||
|
|
||||||
#3. Attempt bid / Post offer
|
|
||||||
check_bids
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"offers": {
|
|
||||||
},
|
|
||||||
"bids": {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
## Prompt for user input
|
## Prompt for user input
|
||||||
printf "\n\nThe following coins can be disabled (case sensitive)\nbitcoin\ndash\ndecred\nfiro\nlitecoin\nmonero\npivx\nwownero\n\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: wownero] ' disablecoin
|
read -p 'Full name of coin to disable [example: wownero] ' disablecoin
|
||||||
## Confirm
|
## Confirm
|
||||||
printf "\nDisable $disablecoin on your BasicSwap install, correct? Press any key to continue. CTRL-C to exit\n"
|
echo -e "\nDisable $disablecoin on your BasicSwap install, correct? Press any key to continue. CTRL-C to exit"
|
||||||
read
|
read
|
||||||
## Disable the coin
|
## Disable the coin
|
||||||
basicswap-prepare --datadir=$SWAP_DATADIR --disablecoin=$disablecoin
|
basicswap-prepare --datadir=$SWAP_DATADIR --disablecoin=$disablecoin
|
||||||
|
|
48
bsx/setup.sh
48
bsx/setup.sh
|
@ -1,23 +1,24 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
red="printf \e[31;1m"
|
red="echo -e -n \e[31;1m"
|
||||||
green="printf \e[32;1m"
|
green="echo -e -n \e[32;1m"
|
||||||
nocolor="printf \e[0m"
|
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
|
||||||
|
$SWAP_DATADIR/venv/bin/pip install .
|
||||||
|
|
||||||
## Clone basicswap git
|
## Clone basicswap git
|
||||||
cd $SWAP_DATADIR
|
cd $SWAP_DATADIR
|
||||||
git clone https://github.com/basicswap/basicswap
|
git clone https://github.com/tecnovert/basicswap.git
|
||||||
cd $SWAP_DATADIR/basicswap
|
cd $SWAP_DATADIR/basicswap
|
||||||
|
## Install basicswap
|
||||||
## Macos
|
$SWAP_DATADIR/venv/bin/pip install .
|
||||||
if [[ $MACOS ]]; then
|
|
||||||
$SWAP_DATADIR/venv/bin/pip3 install certifi
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Install basicswap, coincurve, and pip dependencies
|
|
||||||
$SWAP_DATADIR/venv/bin/pip3 install -r requirements.txt --require-hashes
|
|
||||||
$SWAP_DATADIR/venv/bin/pip3 install .
|
|
||||||
|
|
||||||
## Decide a source for Monero's restore height
|
## Decide a source for Monero's restore height
|
||||||
if [[ "$xmrrestoreheight" ]]; then
|
if [[ "$xmrrestoreheight" ]]; then
|
||||||
|
@ -33,7 +34,7 @@ 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
|
||||||
$HOME/.local/bin/bsx-enabletor
|
/usr/local/bin/bsx-enabletor
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,26 +42,29 @@ enable_tor() {
|
||||||
if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
|
if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
|
||||||
# Restore seed
|
# Restore seed
|
||||||
PARTICL_MNEMONIC=$particl_mnemonic
|
PARTICL_MNEMONIC=$particl_mnemonic
|
||||||
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
|
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"
|
# 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
|
enable_tor
|
||||||
elif [[ "$particl_mnemonic" ]]; then
|
elif [[ "$particl_mnemonic" ]]; then
|
||||||
# Restore seed
|
# Restore seed
|
||||||
PARTICL_MNEMONIC=$particl_mnemonic
|
PARTICL_MNEMONIC=$particl_mnemonic
|
||||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --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
|
enable_tor
|
||||||
elif [[ "$monerod_addr" ]]; then
|
elif [[ "$monerod_addr" ]]; then
|
||||||
# Setup new install and use a remote monero node
|
# Setup new install and use a remote monero node
|
||||||
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
|
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
|
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||||
$red"\n\nMake note of your seed above\n\n"; $nocolor
|
$red"\n\nMake note of your seed above\n"; $nocolor
|
||||||
enable_tor
|
enable_tor
|
||||||
else
|
else
|
||||||
# Setup new install using local nodes
|
# Setup new install using local nodes
|
||||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||||
$red"\n\nMake note of your seed above\n\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\n";$nocolor
|
$green"Install complete.\n\nUse 'basicswap-bash' to run, 'bsx-update' to update, and 'bsx-addcoin' to add a coin\n"; $nocolor
|
||||||
$red"You may have to logout / login or open a new terminal window for the commands to be detected\n";$nocolor
|
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
red="printf \e[31;1m"
|
red="echo -e -n \e[31;1m"
|
||||||
green="printf \e[32;1m"
|
green="echo -e -n \e[32;1m"
|
||||||
nocolor="printf \e[0m"
|
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
|
## Clone basicswap git
|
||||||
cd $SWAP_DATADIR
|
cd $SWAP_DATADIR
|
||||||
git clone https://github.com/basicswap/basicswap
|
git clone https://github.com/tecnovert/basicswap.git
|
||||||
cd $SWAP_DATADIR/basicswap
|
cd $SWAP_DATADIR/basicswap
|
||||||
|
## Install basicswap
|
||||||
## Macos
|
torsocks $SWAP_DATADIR/venv/bin/pip install . # Tails requires torsocks for pip
|
||||||
if [[ $MACOS ]]; then
|
|
||||||
$SWAP_DATADIR/venv/bin/pip3 install certifi
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Install basicswap, coincurve, and pip dependencies
|
|
||||||
torsocks $SWAP_DATADIR/venv/bin/pip3 install -r requirements.txt --require-hashes
|
|
||||||
torsocks $SWAP_DATADIR/venv/bin/pip3 install .
|
|
||||||
|
|
||||||
## Decide a source for Monero's restore height
|
## Decide a source for Monero's restore height
|
||||||
if [[ "$xmrrestoreheight" ]]; then
|
if [[ "$xmrrestoreheight" ]]; then
|
||||||
|
@ -33,7 +34,7 @@ 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
|
||||||
$HOME/.local/bin/bsx-enabletor
|
/usr/local/bin/bsx-enabletor
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,26 +42,32 @@ enable_tor() {
|
||||||
if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
|
if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
|
||||||
# Restore seed
|
# Restore seed
|
||||||
PARTICL_MNEMONIC=$particl_mnemonic
|
PARTICL_MNEMONIC=$particl_mnemonic
|
||||||
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
|
basicswap-prepare --datadir=$SWAP_DATADIR --particl_mnemonic="$PARTICL_MNEMONIC"
|
||||||
torsocks basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --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
|
enable_tor
|
||||||
|
|
||||||
elif [[ "$particl_mnemonic" ]]; then
|
elif [[ "$particl_mnemonic" ]]; then
|
||||||
# Restore seed
|
# Restore seed
|
||||||
PARTICL_MNEMONIC=$particl_mnemonic
|
PARTICL_MNEMONIC=$particl_mnemonic
|
||||||
torsocks basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --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
|
enable_tor
|
||||||
|
|
||||||
elif [[ "$monerod_addr" ]]; then
|
elif [[ "$monerod_addr" ]]; then
|
||||||
# Setup new install and use a remote monero node
|
# Setup new install and use a remote monero node
|
||||||
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
|
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port \
|
||||||
torsocks basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||||
$red"\n\nMake note of your seed above\n\n"; $nocolor
|
$red"\n\nMake note of your seed above\n"; $nocolor
|
||||||
enable_tor
|
enable_tor
|
||||||
|
|
||||||
else
|
else
|
||||||
# Setup new install using local nodes
|
# Setup new install using local nodes
|
||||||
torsocks basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
||||||
$red"\n\nMake note of your seed above\n\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\n";$nocolor
|
$green"Install complete.\n\nUse 'basicswap-bash' to run, 'bsx-update' to update, and 'bsx-addcoin' to add a coin\n"; $nocolor
|
||||||
$red"You may have to logout / login or open a new terminal window for the commands to be detected\n";$nocolor
|
|
||||||
|
|
|
@ -1,26 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "Updating BasicSwapDEX" && sleep 1
|
|
||||||
# Delete dangling build folder. Same as --no-cache for docker
|
|
||||||
rm -rf $SWAP_DATADIR/basicswap/build
|
|
||||||
|
|
||||||
# BasicSwap, coincurve, and dependencies
|
|
||||||
# Switch to new repo: basicswap/basicswap
|
|
||||||
cd $SWAP_DATADIR/basicswap
|
cd $SWAP_DATADIR/basicswap
|
||||||
git remote set-url origin https://github.com/basicswap/basicswap
|
|
||||||
|
|
||||||
# Conflicting messages_pb2.py from v0.12.7
|
# Delete dangling build folder. Same as --no-cache for docker
|
||||||
if [[ -f basicswap/messages_pb2.py ]]; then
|
rm -rf ~/coinswaps/basicswap/build
|
||||||
git restore basicswap/messages_pb2.py
|
# Fix any conflicts from potential force-pushes
|
||||||
fi
|
git reset HEAD~5 --hard
|
||||||
|
# Pull repo
|
||||||
#git checkout master
|
|
||||||
git pull
|
git pull
|
||||||
$SWAP_DATADIR/venv/bin/pip3 install -r requirements.txt --require-hashes
|
# Install
|
||||||
$SWAP_DATADIR/venv/bin/pip3 install .
|
$SWAP_DATADIR/venv/bin/pip install .
|
||||||
|
|
||||||
# Update Coin Cores
|
|
||||||
$HOME/.local/bin/bsx/auto_coinupd8.sh
|
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
rm -rf basicswap-bash
|
|
||||||
|
|
13
bsx/upgradecoins.sh
Executable file
13
bsx/upgradecoins.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
## Prompt for user input
|
||||||
|
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\ndecred\nfiro\nlitecoin\nmonero\nparticl\npivx\nwownero\n"
|
||||||
|
read -p 'Full name of coin to upgrade [example: litecoin] ' upgradecoin
|
||||||
|
|
||||||
|
## Confirm
|
||||||
|
read -p $'\nUpgrade '$upgradecoin', correct? Press any key to continue. CTRL-C to exit'
|
||||||
|
|
||||||
|
## Upgrade the coin
|
||||||
|
basicswap-prepare --datadir=$SWAP_DATADIR -preparebinonly --withcoins=$upgradecoin
|
||||||
|
echo "Upgraded $upgradecoin"
|
|
@ -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)
|
|
145
install.sh
145
install.sh
|
@ -1,22 +1,9 @@
|
||||||
#/bin/bash
|
#/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
red="printf \e[31;1m"
|
red="echo -e -n \e[31;1m"
|
||||||
green="printf \e[32;1m"
|
green="echo -e -n \e[32;1m"
|
||||||
nocolor="printf \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"
|
||||||
|
@ -24,9 +11,9 @@ title="BasicSwapDEX Installer"
|
||||||
COLUMNS=$(tput cols)
|
COLUMNS=$(tput cols)
|
||||||
title_size=${#title}
|
title_size=${#title}
|
||||||
span=$(((COLUMNS + title_size) / 2))
|
span=$(((COLUMNS + title_size) / 2))
|
||||||
printf "%${COLUMNS}s" " " | tr " " "#"
|
printf "%${COLUMNS}s" " " | tr " " "*"
|
||||||
printf "%${span}s\n" "$title"
|
printf "%${span}s\n" "$title"
|
||||||
printf "%${COLUMNS}s" " " | tr " " "#"
|
printf "%${COLUMNS}s" " " | tr " " "*"
|
||||||
$nocolor
|
$nocolor
|
||||||
|
|
||||||
# Detect Operating system
|
# Detect Operating system
|
||||||
|
@ -36,69 +23,56 @@ DEPENDENCY=""
|
||||||
TAILS=""
|
TAILS=""
|
||||||
|
|
||||||
check_tails() {
|
check_tails() {
|
||||||
if [[ $USER == amnesia ]]; then
|
if [ $USER == amnesia ]; then
|
||||||
$green"\n\nDetected Tails";$nocolor
|
$green"\nDetected Tails\n";$nocolor
|
||||||
TAILS=1
|
TAILS=1
|
||||||
else
|
else
|
||||||
$green"\n\nDetected Debian";$nocolor
|
$green"\nDetected Debian\n";$nocolor
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
detect_os_arch() {
|
detect_os_arch() {
|
||||||
if [[ $(uname -s) = "Darwin" ]]; then
|
if type -P apt > /dev/null; then
|
||||||
# MacOS
|
|
||||||
export MACOS=1
|
|
||||||
if type -p brew > /dev/null; then
|
|
||||||
$green"Homebrew is installed\n";$nc
|
|
||||||
INSTALL="brew install"
|
|
||||||
else
|
|
||||||
$green"Installing Homebrew\n";$nc
|
|
||||||
INSTALL="curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | /bin/bash && brew install"
|
|
||||||
fi
|
|
||||||
DEPENDENCY="python gnupg pkg-config"
|
|
||||||
$green"\n\nDetected MacOS";$nocolor
|
|
||||||
elif type -p apt > /dev/null; then
|
|
||||||
check_tails
|
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="python3-pip python3-venv libpython3-dev gnupg pkg-config"
|
DEPENDENCY="python-is-python3 python3-pip python3-venv gnupg pkg-config"
|
||||||
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"
|
DEPENDENCY="python3-virtualenv python3-pip python3-devel gnupg2 pkgconf"
|
||||||
$green"\n\nDetected Fedora";$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="curl python-pipenv gnupg pkgconf base-devel"
|
DEPENDENCY="python-pipenv gnupg pkgconf base-devel"
|
||||||
$green"\n\nDetected Arch Linux";$nocolor
|
$green"\nDetected Arch Linux\n";$nocolor
|
||||||
|
elif type -P brew > /dev/null; then
|
||||||
|
# MacOS
|
||||||
|
INSTALL="brew install"
|
||||||
|
DEPENDENCY="python gnupg pkg-config"
|
||||||
|
$green"\nDetected MacOS\n";$nocolor
|
||||||
else
|
else
|
||||||
$red"\nFailed to detect OS. Unsupported or unknown distribution.\nInstall Failed.\n";$nocolor
|
$red"Failed to detect OS. Unsupported or unknown distribution.\nInstall Failed.";$nocolor
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
detect_os_arch
|
detect_os_arch
|
||||||
|
|
||||||
## Update & Install dependencies
|
|
||||||
printf "\n\nInstalling dependencies\nPress CTRL-C at password prompt(s) to skip. If skipped, you must install the dependencies manually before proceeding\n\n"
|
|
||||||
$green"$UPDATE\n$INSTALL $DEPENDENCY curl automake libtool jq\n"; $nocolor
|
|
||||||
$UPDATE
|
|
||||||
$INSTALL $DEPENDENCY automake libtool jq
|
|
||||||
|
|
||||||
# Enable tor
|
# Enable tor
|
||||||
printf "\n[1] Tor ON (requires sudo)\n[2] Tor OFF\n"
|
echo -e "\n\n[1] Tor ON\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
|
||||||
1)
|
1)
|
||||||
$green"BasicSwapDEX will use Tor\n";$nocolor
|
$green"\nBasicSwapDEX will use Tor";$nocolor
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
$red"BasicSwapDEX will NOT use Tor\n";$nocolor
|
$red"\nBasicSwapDEX will NOT use Tor";$nocolor
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$red"You must answer 1 or 2\n";$nocolor
|
$red"You must answer 1 or 2\n";$nocolor
|
||||||
|
@ -107,22 +81,22 @@ read -p 'Select an option: [1|2] ' tor_on
|
||||||
done
|
done
|
||||||
|
|
||||||
## Particl restore Seed
|
## Particl restore Seed
|
||||||
printf "\n[1] New Install (default)\n[2] Restore from Particl Seed\n"
|
echo -e "\n\n[1] New Install (default)\n[2] Restore from Particl Seed\n"
|
||||||
until [[ "$restore" =~ ^[12]$ ]]; do
|
until [[ "$restore" =~ ^[12]$ ]]; do
|
||||||
read -p 'Select an option: [1|2] ' restore
|
read -p 'Select an option: [1|2] ' restore
|
||||||
case $restore in
|
case $restore in
|
||||||
1)
|
1)
|
||||||
$green"Installing BasicSwapDEX\n"; $nocolor
|
$green"\nInstalling BasicSwapDEX\n"; $nocolor
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
until [[ "$wordcount" = "24" ]]; do
|
until [[ "$wordcount" = "24" ]]; do
|
||||||
read -p $'\nEnter your Particl Seed\n[example: word word word word word...] ' particl_mnemonic
|
read -p $'\nEnter your Particl Seed\n[example: word word word word word...] ' particl_mnemonic
|
||||||
wordcount=$(echo $particl_mnemonic | wc -w)
|
wordcount=$(echo $particl_mnemonic | wc -w)
|
||||||
if [[ $wordcount = 24 ]]; then
|
if [[ $wordcount = 24 ]]; then
|
||||||
printf "Restoring BasicSwapDEX\n"
|
echo -e "Restoring BasicSwapDEX"
|
||||||
$green"$particl_mnemonic\n";$nocolor
|
$green"$particl_mnemonic\n";$nocolor
|
||||||
else
|
else
|
||||||
$red"Try again. Seed must be 24 words\n"; $nocolor
|
$red"Try again. Seed must be 24 words"; $nocolor
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
@ -137,13 +111,13 @@ if [[ $particl_mnemonic ]]; then
|
||||||
read -p $'\nEnter a restore height for your BasicSwap XMR wallet? [Y/n] ' height
|
read -p $'\nEnter a restore height for your BasicSwap XMR wallet? [Y/n] ' height
|
||||||
case $height in
|
case $height in
|
||||||
n|N)
|
n|N)
|
||||||
$red"Not using a custom XMR Restore height\n";$nocolor
|
$red"\nNot using a custom XMR Restore height";$nocolor
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
until [[ "$xmrrestoreheight" =~ ^[0-9]{1,7}$ ]]; do
|
until [[ "$xmrrestoreheight" =~ ^[0-9]{1,7}$ ]]; do
|
||||||
read -p $'Enter your Monero Restore Height [example: 2548568] ' xmrrestoreheight
|
read -p $'Enter your Monero Restore Height [example: 2548568] ' xmrrestoreheight
|
||||||
if [[ $xmrrestoreheight =~ ^[0-9]{7}$ ]]; then
|
if [[ $xmrrestoreheight =~ ^[0-9]{7}$ ]]; then
|
||||||
$green"Your XMR Restore height: $xmrrestoreheight\n"; $nocolor
|
$green"\nYour XMR Restore height: $xmrrestoreheight"; $nocolor
|
||||||
else
|
else
|
||||||
$red"Try again. Must be 1-7 digits\n"; $nocolor
|
$red"Try again. Must be 1-7 digits\n"; $nocolor
|
||||||
fi
|
fi
|
||||||
|
@ -153,24 +127,17 @@ if [[ $particl_mnemonic ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Configure Monero
|
## Configure Monero
|
||||||
printf "\n[1] Connect to a Monero node\n[2] Allow BasicSwapDEX to run a Monero node (+70GB)\n"
|
echo -e "\n[1] Connect to a Monero node\n[2] Allow BasicSwapDEX to run a Monero node (+70GB)\n"
|
||||||
until [[ "$l" =~ ^[12]$ ]]; do
|
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)
|
||||||
until [[ $checknode ]]; do
|
|
||||||
read -p 'Enter Address of Monero node [example: 192.168.1.123] ' monerod_addr
|
read -p 'Enter Address of Monero node [example: 192.168.1.123] ' monerod_addr
|
||||||
read -p 'Enter RPC Port for the Monero node [example: 18081] ' monerod_port
|
read -p 'Enter RPC Port for the Monero node [example: 18081] ' monerod_port
|
||||||
checknode=$(curl -sk http://$monerod_addr:$monerod_port/get_info | jq .height)
|
$green"\nLook good? $monerod_addr:$monerod_port"; $nocolor
|
||||||
if [[ $checknode ]]; then
|
|
||||||
$green"Successfully connected to the XMR node @ $monerod_addr:$monerod_port\n"; $nocolor
|
|
||||||
else
|
|
||||||
$red"The node at $monerod_addr:$monerod_port is not accessible. Try again\n"; $nocolor
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
$green"BasicSwapDEX will run the Monero node for you.\n"; $nocolor
|
$green"\nBasicSwapDEX will run the Monero node for you."; $nocolor
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$red"You must answer 1 or 2\n"; $nocolor
|
$red"You must answer 1 or 2\n"; $nocolor
|
||||||
|
@ -179,47 +146,23 @@ read -p 'Select an option [1|2]: ' l
|
||||||
done
|
done
|
||||||
|
|
||||||
## Begin Install
|
## Begin Install
|
||||||
printf "\nInstalling BasicSwapDEX\n"
|
echo -e "\n\nInstalling dependencies"
|
||||||
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
|
||||||
# Quest to make trasher happy
|
$UPDATE
|
||||||
addpath='PATH="$HOME/.local/bin:$PATH"'
|
$INSTALL $DEPENDENCY git wget unzip automake libtool jq
|
||||||
trasherdk=$(echo $PATH | grep -F '.local/bin')
|
# Move scripts to /usr/local/bin
|
||||||
|
sudo rm -r /usr/local/bin/bsx* /usr/local/bin/basicswap-bash
|
||||||
if [[ ! -d $HOME/.local/bin ]]; then
|
sudo mv -f -t /usr/local/bin/ basicswap-bash bsx*
|
||||||
mkdir -p $HOME/.local/bin
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z $trasherdk ]]; then
|
|
||||||
|
|
||||||
# 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
|
|
||||||
cp -r basicswap-bash bsx* $HOME/.local/bin/
|
|
||||||
|
|
||||||
## 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
|
||||||
export TAILS=$TAILS
|
export TAILS=$TAILS
|
||||||
python3 -m venv "$SWAP_DATADIR/venv"
|
mkdir -p "$SWAP_DATADIR/venv"
|
||||||
|
python -m venv "$SWAP_DATADIR/venv"
|
||||||
## Activate venv
|
## Activate venv
|
||||||
$HOME/.local/bin/bsx/activate_venv.sh
|
/usr/local/bin/bsx/activate_venv.sh
|
||||||
|
|
10
scriptinstall.sh
Executable file
10
scriptinstall.sh
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#/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
|
11
scriptupdate.sh
Executable file
11
scriptupdate.sh
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#/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
|
Loading…
Reference in a new issue