mirror of
https://github.com/nahuhh/basicswap-bash.git
synced 2024-12-22 19:49:21 +00:00
Compare commits
38 commits
91447cf5ec
...
c319bcfcd3
Author | SHA1 | Date | |
---|---|---|---|
|
c319bcfcd3 | ||
|
e7e55e74ed | ||
|
b25aecc6b9 | ||
|
dacdee2570 | ||
|
e2a574cf9b | ||
|
4b7cbe98b4 | ||
|
b0a83f63a3 | ||
|
82fd60cd3c | ||
|
e9eee1c826 | ||
|
10e81c85d1 | ||
|
a2e989a1ef | ||
|
92bdd39b76 | ||
|
9709cb4ae8 | ||
|
a48c687a60 | ||
|
4364fa99cc | ||
|
6d2ab45cbd | ||
|
9991176e0e | ||
|
97a5d1215e | ||
|
61b8618e90 | ||
|
318cdf7c6a | ||
|
1a85e5b6fe | ||
|
40fecdc214 | ||
|
2eb3465704 | ||
|
41ae85ee08 | ||
|
a4720f834b | ||
|
5c491184ff | ||
|
e8f3a7d964 | ||
|
acc3702c50 | ||
|
4d46146657 | ||
|
e9a84cf72f | ||
|
1531ba9034 | ||
|
32d5003c43 | ||
|
48ee19de36 | ||
|
116a5a68c7 | ||
|
07cc24b204 | ||
|
96fad3fcdd | ||
|
d3b442b7f7 | ||
|
7ae1eb55b2 |
26 changed files with 962 additions and 201 deletions
29
README.md
29
README.md
|
@ -1,21 +1,30 @@
|
||||||
# basicswap-bash
|
# basicswap-bash
|
||||||
A BasicSwapDEX bash installer for Debian/Ubuntu/Arch/Fedora
|
A suite of bash scripts to install and manage
|
||||||
User account must have sudo privileges
|
BasicSwapDEX on Windows(WSL)/Debian/Ubuntu/Arch/Fedora
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
|
### New Installation
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/nahuhh/basicswap-bash -b dev
|
git clone https://github.com/nahuhh/basicswap-bash
|
||||||
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
|
#### Update BSX core and Coin cores
|
||||||
```
|
```
|
||||||
bsx-update
|
bsx-update
|
||||||
```
|
```
|
||||||
|
@ -36,12 +45,12 @@ bsx-addcoin
|
||||||
bsx-removecoin
|
bsx-removecoin
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Update blockchains
|
### BONUS placeorders
|
||||||
|
This is a POC for placing new orders. YMMV
|
||||||
```
|
```
|
||||||
bsx-upgradecoins
|
bsx-placeorder
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
A small donation goes a long way. Thanks
|
A small donation goes a long way. Thanks
|
||||||
- ofrnxmr
|
- ofrnxmr
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,5 +1,21 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
python3 -m venv "$SWAP_DATADIR/venv"
|
|
||||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
# Colors
|
||||||
/usr/local/bin/bsx/startup.sh
|
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
|
||||||
|
$HOME/.local/bin/bsx/startup.sh
|
||||||
|
|
46
bsx-addcoin
46
bsx-addcoin
|
@ -1,4 +1,46 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
|
||||||
/usr/local/bin/bsx/addcoin.sh
|
# Colors
|
||||||
|
red="printf \e[31;1m"
|
||||||
|
green="printf \e[32;1m"
|
||||||
|
nocolor="printf \e[0m"
|
||||||
|
|
||||||
|
# Check if basicswap is running
|
||||||
|
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||||
|
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||||
|
if [[ $bsx_pid ]]; then
|
||||||
|
bsx_run=$(pgrep particld | grep $bsx_pid)
|
||||||
|
if [[ $bsx_run ]]; then
|
||||||
|
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
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,4 +1,46 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
|
||||||
/usr/local/bin/bsx/disabletor.sh
|
# Colors
|
||||||
|
red="printf \e[31;1m"
|
||||||
|
green="printf \e[32;1m"
|
||||||
|
nocolor="printf \e[0m"
|
||||||
|
|
||||||
|
# Check if basicswap is running
|
||||||
|
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||||
|
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||||
|
if [[ $bsx_pid ]]; then
|
||||||
|
bsx_run=$(pgrep particld | grep $bsx_pid)
|
||||||
|
if [[ $bsx_run ]]; then
|
||||||
|
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
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,4 +1,46 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
|
||||||
/usr/local/bin/bsx/enabletor.sh
|
# Colors
|
||||||
|
red="printf \e[31;1m"
|
||||||
|
green="printf \e[32;1m"
|
||||||
|
nocolor="printf \e[0m"
|
||||||
|
|
||||||
|
# Check if basicswap is running
|
||||||
|
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||||
|
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||||
|
if [[ $bsx_pid ]]; then
|
||||||
|
bsx_run=$(pgrep particld | grep $bsx_pid)
|
||||||
|
if [[ $bsx_run ]]; then
|
||||||
|
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
|
25
bsx-placeorder
Executable file
25
bsx-placeorder
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/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,4 +1,46 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
|
||||||
/usr/local/bin/bsx/removecoin.sh
|
# Colors
|
||||||
|
red="printf \e[31;1m"
|
||||||
|
green="printf \e[32;1m"
|
||||||
|
nocolor="printf \e[0m"
|
||||||
|
|
||||||
|
# Check if basicswap is running
|
||||||
|
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||||
|
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||||
|
if [[ $bsx_pid ]]; then
|
||||||
|
bsx_run=$(pgrep particld | grep $bsx_pid)
|
||||||
|
if [[ $bsx_run ]]; then
|
||||||
|
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
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,4 +1,44 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export SWAP_DATADIR=$HOME/coinswaps
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
. $SWAP_DATADIR/venv/bin/activate && python -V
|
|
||||||
/usr/local/bin/bsx/update.sh
|
# Colors
|
||||||
|
red="printf \e[31;1m"
|
||||||
|
green="printf \e[32;1m"
|
||||||
|
nocolor="printf \e[0m"
|
||||||
|
|
||||||
|
# Check if basicswap is running
|
||||||
|
if [[ -f $SWAP_DATADIR/particl/particl.pid ]]; then
|
||||||
|
bsx_pid=$(cat $SWAP_DATADIR/particl/particl.pid)
|
||||||
|
if [[ $bsx_pid ]]; then
|
||||||
|
bsx_run=$(pgrep particld | grep $bsx_pid)
|
||||||
|
if [[ $bsx_run ]]; then
|
||||||
|
$red"\nError: BasicSwapDEX is running.\n"; $nocolor
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
. $SWAP_DATADIR/venv/bin/activate
|
||||||
|
|
||||||
|
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
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/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 && python -V
|
. $SWAP_DATADIR/venv/bin/activate
|
||||||
if [[ $TAILS ]]; then
|
if [[ $TAILS ]]; then
|
||||||
/usr/local/bin/bsx/tails_setup.sh
|
$HOME/.local/bin/bsx/tails_setup.sh
|
||||||
else
|
else
|
||||||
/usr/local/bin/bsx/setup.sh
|
$HOME/.local/bin/bsx/setup.sh
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/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\ndecred\nfiro\nlitecoin\npivx\nwownero\n"
|
printf "\n\nThe following coins can be added (case sensitive)\nbitcoin\ndash\ndecred\nfiro\nlitecoin\npivx\nwownero\n\n"
|
||||||
read -p 'Full name of coin to add [example: litecoin] ' addcoin
|
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'
|
||||||
|
|
43
bsx/auto_coinupd8.sh
Executable file
43
bsx/auto_coinupd8.sh
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/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,36 +1,58 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
red="echo -e -n \e[31;1m"
|
red="printf \e[31;1m"
|
||||||
green="echo -e -n \e[32;1m"
|
green="printf \e[32;1m"
|
||||||
nocolor="echo -e -n \e[0m"
|
nocolor="printf \e[0m"
|
||||||
|
|
||||||
# Detect Operating system
|
# Detect Operating system
|
||||||
INSTALL=""
|
INSTALL=""
|
||||||
UPDATE=""
|
UPDATE=""
|
||||||
INIT_TOR="sudo systemctl restart tor"
|
INIT_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 type -P apt > /dev/null; then
|
if [[ $(uname -s) = "Darwin" ]]; 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 -y"
|
INSTALL="sudo apt install"
|
||||||
UPDATE="sudo apt update"
|
UPDATE="sudo apt update"
|
||||||
$green"\nDetected Debian\n";$nocolor
|
INIT_TOR=$SYSTEMD_TOR
|
||||||
elif type -P dnf > /dev/null; then
|
elif type -p dnf > /dev/null; then
|
||||||
# Fedora
|
# Fedora
|
||||||
INSTALL="sudo dnf install -y"
|
INSTALL="sudo dnf install"
|
||||||
UPDATE="sudo dnf check-update"
|
UPDATE="sudo dnf check-update"
|
||||||
$green"\nDetected Fedora\n";$nocolor
|
INIT_TOR=$SYSTEMD_TOR
|
||||||
elif type -P pacman > /dev/null; then
|
$green"\n\nDetected Fedora";$nocolor
|
||||||
|
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"
|
||||||
$green"\nDetected Arch Linux\n";$nocolor
|
INIT_TOR=$SYSTEMD_TOR
|
||||||
elif type -P brew > /dev/null; then
|
$green"\n\nDetected Arch Linux";$nocolor
|
||||||
# MacOS
|
|
||||||
INSTALL="brew install"
|
|
||||||
$green"\nDetected MacOS\n";$nocolor
|
|
||||||
else
|
else
|
||||||
$red"Failed to detect OS. Unsupported or unknown distribution.\nInstall Failed.";$nocolor
|
$red"\nFailed to detect OS. Unsupported or unknown distribution.\nInstall Failed.\n";$nocolor
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -38,8 +60,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
|
||||||
echo -e "\nTor is already installed :)"
|
printf "\nTor is already installed :)\n"
|
||||||
else
|
else
|
||||||
# Install and configure tor
|
# Install and configure tor
|
||||||
echo "Installing Tor..."
|
echo "Installing Tor..."
|
||||||
|
@ -47,18 +69,19 @@ 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."
|
printf "In the next step you'll choose a password. NOTE: It will be saved in PLAIN TEXT.\n"
|
||||||
read -p "Enter a (new) tor control password [example: 123123] " torcontrolpass
|
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
|
printf "# Added by basicswap-bash\nHashedControlPassword $torhashedpass\n" | sudo tee -a /etc/tor/torrc
|
||||||
else
|
else
|
||||||
echo -e "# Added by basicswap-bash\n$enabledcontrol\nHashedControlPassword $torhashedpass" | sudo tee -a /etc/tor/torrc
|
printf "# Added by basicswap-bash\n$enabledcontrol\nHashedControlPassword $torhashedpass\n" | sudo tee -a /etc/tor/torrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restart tor to apply
|
# Restart tor to apply
|
||||||
|
|
25
bsx/placeorders/placebid.json.template
Normal file
25
bsx/placeorders/placebid.json.template
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
28
bsx/placeorders/placeoffer.json.template
Normal file
28
bsx/placeorders/placeoffer.json.template
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
346
bsx/placeorders/placeorders.sh
Executable file
346
bsx/placeorders/placeorders.sh
Executable file
|
@ -0,0 +1,346 @@
|
||||||
|
#!/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
|
6
bsx/placeorders/placeorders_state.json.template
Normal file
6
bsx/placeorders/placeorders_state.json.template
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"offers": {
|
||||||
|
},
|
||||||
|
"bids": {
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
#!/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\ndecred\nfiro\nlitecoin\nmonero\npivx\nwownero\n"
|
printf "\n\nThe following coins can be disabled (case sensitive)\nbitcoin\ndash\ndecred\nfiro\nlitecoin\nmonero\npivx\nwownero\n\n"
|
||||||
read -p 'Full name of coin to disable [example: wownero] ' disablecoin
|
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"
|
printf "\nDisable $disablecoin on your BasicSwap install, correct? Press any key to continue. CTRL-C to exit\n"
|
||||||
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,24 +1,23 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
red="echo -e -n \e[31;1m"
|
red="printf \e[31;1m"
|
||||||
green="echo -e -n \e[32;1m"
|
green="printf \e[32;1m"
|
||||||
nocolor="echo -e -n \e[0m"
|
nocolor="printf \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/tecnovert/basicswap.git
|
git clone https://github.com/basicswap/basicswap
|
||||||
cd $SWAP_DATADIR/basicswap
|
cd $SWAP_DATADIR/basicswap
|
||||||
## Install basicswap
|
|
||||||
$SWAP_DATADIR/venv/bin/pip install .
|
## Macos
|
||||||
|
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
|
||||||
|
@ -34,7 +33,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
|
||||||
/usr/local/bin/bsx-enabletor
|
$HOME/.local/bin/bsx-enabletor
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,29 +41,26 @@ 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
|
||||||
basicswap-prepare --datadir=$SWAP_DATADIR --particl_mnemonic="$PARTICL_MNEMONIC"
|
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
|
||||||
# Add coins and use a remote monero node
|
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC"
|
||||||
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 --particl_mnemonic="$PARTICL_MNEMONIC"
|
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --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 BASE_XMR_RPC_PORT=$monerod_port \
|
XMR_RPC_HOST=$monerod_addr 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"; $nocolor
|
$red"\n\nMake note of your seed above\n\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"; $nocolor
|
$red"\n\nMake note of your seed above\n\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\n";$nocolor
|
||||||
|
$red"You may have to logout / login or open a new terminal window for the commands to be detected\n";$nocolor
|
||||||
|
|
|
@ -1,24 +1,23 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
red="echo -e -n \e[31;1m"
|
red="printf \e[31;1m"
|
||||||
green="echo -e -n \e[32;1m"
|
green="printf \e[32;1m"
|
||||||
nocolor="echo -e -n \e[0m"
|
nocolor="printf \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/tecnovert/basicswap.git
|
git clone https://github.com/basicswap/basicswap
|
||||||
cd $SWAP_DATADIR/basicswap
|
cd $SWAP_DATADIR/basicswap
|
||||||
## Install basicswap
|
|
||||||
torsocks $SWAP_DATADIR/venv/bin/pip install . # Tails requires torsocks for pip
|
## Macos
|
||||||
|
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
|
||||||
|
@ -34,7 +33,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
|
||||||
/usr/local/bin/bsx-enabletor
|
$HOME/.local/bin/bsx-enabletor
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,32 +41,26 @@ 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
|
||||||
basicswap-prepare --datadir=$SWAP_DATADIR --particl_mnemonic="$PARTICL_MNEMONIC"
|
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
|
||||||
# Add coins and use a remote monero node
|
torsocks basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000 --particl_mnemonic="$PARTICL_MNEMONIC"
|
||||||
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 --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 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 BASE_XMR_RPC_PORT=$monerod_port \
|
XMR_RPC_HOST=$monerod_addr XMR_RPC_PORT=$monerod_port \
|
||||||
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
|
torsocks 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\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
|
torsocks 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\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\n";$nocolor
|
||||||
|
$red"You may have to logout / login or open a new terminal window for the commands to be detected\n";$nocolor
|
||||||
|
|
|
@ -1,11 +1,26 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd $SWAP_DATADIR/basicswap
|
|
||||||
|
|
||||||
|
echo "Updating BasicSwapDEX" && sleep 1
|
||||||
# Delete dangling build folder. Same as --no-cache for docker
|
# Delete dangling build folder. Same as --no-cache for docker
|
||||||
rm -rf ~/coinswaps/basicswap/build
|
rm -rf $SWAP_DATADIR/basicswap/build
|
||||||
# Fix any conflicts from potential force-pushes
|
|
||||||
git reset HEAD~5 --hard
|
# BasicSwap, coincurve, and dependencies
|
||||||
# Pull repo
|
# Switch to new repo: basicswap/basicswap
|
||||||
|
cd $SWAP_DATADIR/basicswap
|
||||||
|
git remote set-url origin https://github.com/basicswap/basicswap
|
||||||
|
|
||||||
|
# Conflicting messages_pb2.py from v0.12.7
|
||||||
|
if [[ -f basicswap/messages_pb2.py ]]; then
|
||||||
|
git restore basicswap/messages_pb2.py
|
||||||
|
fi
|
||||||
|
|
||||||
|
#git checkout master
|
||||||
git pull
|
git pull
|
||||||
# Install
|
$SWAP_DATADIR/venv/bin/pip3 install -r requirements.txt --require-hashes
|
||||||
$SWAP_DATADIR/venv/bin/pip install .
|
$SWAP_DATADIR/venv/bin/pip3 install .
|
||||||
|
|
||||||
|
# Update Coin Cores
|
||||||
|
$HOME/.local/bin/bsx/auto_coinupd8.sh
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
rm -rf basicswap-bash
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#!/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"
|
|
9
core_versions
Normal file
9
core_versions
Normal 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 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)
|
149
install.sh
149
install.sh
|
@ -1,9 +1,22 @@
|
||||||
#/bin/bash
|
#/bin/bash
|
||||||
|
export SWAP_DATADIR=$HOME/coinswaps
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
red="echo -e -n \e[31;1m"
|
red="printf \e[31;1m"
|
||||||
green="echo -e -n \e[32;1m"
|
green="printf \e[32;1m"
|
||||||
nocolor="echo -e -n \e[0m"
|
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=$(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"
|
||||||
|
@ -11,9 +24,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
|
||||||
|
@ -23,56 +36,69 @@ DEPENDENCY=""
|
||||||
TAILS=""
|
TAILS=""
|
||||||
|
|
||||||
check_tails() {
|
check_tails() {
|
||||||
if [ $USER == amnesia ]; then
|
if [[ $USER == amnesia ]]; then
|
||||||
$green"\nDetected Tails\n";$nocolor
|
$green"\n\nDetected Tails";$nocolor
|
||||||
TAILS=1
|
TAILS=1
|
||||||
else
|
else
|
||||||
$green"\nDetected Debian\n";$nocolor
|
$green"\n\nDetected Debian";$nocolor
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
detect_os_arch() {
|
detect_os_arch() {
|
||||||
if type -P apt > /dev/null; then
|
if [[ $(uname -s) = "Darwin" ]]; 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="python-is-python3 python3-pip python3-venv gnupg pkg-config"
|
DEPENDENCY="python3-pip python3-venv libpython3-dev 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"\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"
|
||||||
DEPENDENCY="python-pipenv gnupg pkgconf base-devel"
|
DEPENDENCY="curl python-pipenv gnupg pkgconf base-devel"
|
||||||
$green"\nDetected Arch Linux\n";$nocolor
|
$green"\n\nDetected Arch Linux";$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"Failed to detect OS. Unsupported or unknown distribution.\nInstall Failed.";$nocolor
|
$red"\nFailed to detect OS. Unsupported or unknown distribution.\nInstall Failed.\n";$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
|
||||||
echo -e "\n\n[1] Tor ON\n[2] Tor OFF\n"
|
printf "\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
|
||||||
1)
|
1)
|
||||||
$green"\nBasicSwapDEX will use Tor";$nocolor
|
$green"BasicSwapDEX will use Tor\n";$nocolor
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
$red"\nBasicSwapDEX will NOT use Tor";$nocolor
|
$red"BasicSwapDEX will NOT use Tor\n";$nocolor
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$red"You must answer 1 or 2\n";$nocolor
|
$red"You must answer 1 or 2\n";$nocolor
|
||||||
|
@ -81,22 +107,22 @@ read -p 'Select an option: [1|2] ' tor_on
|
||||||
done
|
done
|
||||||
|
|
||||||
## Particl restore Seed
|
## Particl restore Seed
|
||||||
echo -e "\n\n[1] New Install (default)\n[2] Restore from Particl Seed\n"
|
printf "\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"\nInstalling BasicSwapDEX\n"; $nocolor
|
$green"Installing 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
|
||||||
echo -e "Restoring BasicSwapDEX"
|
printf "Restoring BasicSwapDEX\n"
|
||||||
$green"$particl_mnemonic\n";$nocolor
|
$green"$particl_mnemonic\n";$nocolor
|
||||||
else
|
else
|
||||||
$red"Try again. Seed must be 24 words"; $nocolor
|
$red"Try again. Seed must be 24 words\n"; $nocolor
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
@ -111,13 +137,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"\nNot using a custom XMR Restore height";$nocolor
|
$red"Not using a custom XMR Restore height\n";$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"\nYour XMR Restore height: $xmrrestoreheight"; $nocolor
|
$green"Your XMR Restore height: $xmrrestoreheight\n"; $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
|
||||||
|
@ -127,17 +153,24 @@ if [[ $particl_mnemonic ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Configure Monero
|
## Configure Monero
|
||||||
echo -e "\n[1] Connect to a Monero node\n[2] Allow BasicSwapDEX to run a Monero node (+70GB)\n"
|
printf "\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)
|
||||||
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 | jq .height)
|
||||||
|
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"\nBasicSwapDEX will run the Monero node for you."; $nocolor
|
$green"BasicSwapDEX will run the Monero node for you.\n"; $nocolor
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$red"You must answer 1 or 2\n"; $nocolor
|
$red"You must answer 1 or 2\n"; $nocolor
|
||||||
|
@ -146,23 +179,47 @@ read -p 'Select an option [1|2]: ' l
|
||||||
done
|
done
|
||||||
|
|
||||||
## Begin Install
|
## Begin Install
|
||||||
echo -e "\n\nInstalling dependencies"
|
printf "\nInstalling BasicSwapDEX\n"
|
||||||
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 -F '.local/bin')
|
||||||
sudo rm -r /usr/local/bin/bsx* /usr/local/bin/basicswap-bash
|
|
||||||
sudo mv -f -t /usr/local/bin/ basicswap-bash bsx*
|
if [[ ! -d $HOME/.local/bin ]]; then
|
||||||
|
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
|
||||||
mkdir -p "$SWAP_DATADIR/venv"
|
python3 -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
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
Loading…
Reference in a new issue