add tails, remove protobuf, update README

This commit is contained in:
nahuhh 2024-06-03 21:20:34 -05:00
parent b8729282f9
commit 91447cf5ec
10 changed files with 145 additions and 36 deletions

View file

@ -1,16 +1,24 @@
# basicswap-bash # basicswap-bash
A BasicSwapDEX bash installer for Debian/Ubuntu A BasicSwapDEX bash installer for Debian/Ubuntu/Arch/Fedora
User account must have sudo privileges
### Installation ### Installation
```bash ```bash
wget https://github.com/nahuhh/basicswap-bash/releases/latest/download/basicswap-bash.tar.gz git clone https://github.com/nahuhh/basicswap-bash -b dev
tar xvf basicswap-bash.tar.gz
cd basicswap-bash && ./install.sh cd basicswap-bash && ./install.sh
cd .. && rm -rf basicswap-bash
``` ```
### Running BasicSwapDEX ### Running BasicSwapDEX
``` ```
basicswap-bash basicswap-bash
``` ```
#### Update BSX core
```
bsx-update
```
#### Enable/Disable Tor [post install] #### Enable/Disable Tor [post install]
``` ```
@ -20,17 +28,17 @@ bsx-enabletor
bsx-disabletor bsx-disabletor
``` ```
#### Add coins #### Add/remove coins
``` ```
bsx-addcoin bsx-addcoin
``` ```
```
bsx-removecoin
```
#### Update blockchains #### Update blockchains
``` ```
bsx-upgrade-coins bsx-upgradecoins
```
#### Update BSX core
```
bsx-update
``` ```

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps export SWAP_DATADIR=$HOME/coinswaps
. $SWAP_DATADIR/venv/bin/activate && python -V . $SWAP_DATADIR/venv/bin/activate && python -V
/usr/local/bin/bsx/disablecoin.sh /usr/local/bin/bsx/removecoin.sh

View file

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

View file

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

View file

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

View file

@ -5,9 +5,6 @@ red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m" green="echo -e -n \e[32;1m"
nocolor="echo -e -n \e[0m" nocolor="echo -e -n \e[0m"
## UBUNTU 22.04 FIX upgrade protobuf inside of venv
python -m pip install --upgrade "protobuf<=3.20.1"
## Download & Install coincurve stuff ## Download & Install coincurve stuff
cd $SWAP_DATADIR cd $SWAP_DATADIR
wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/refs/tags/anonswap_v0.2.zip wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/refs/tags/anonswap_v0.2.zip
@ -21,7 +18,6 @@ cd $SWAP_DATADIR
git clone https://github.com/tecnovert/basicswap.git git clone https://github.com/tecnovert/basicswap.git
cd $SWAP_DATADIR/basicswap cd $SWAP_DATADIR/basicswap
## Install basicswap ## Install basicswap
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto
$SWAP_DATADIR/venv/bin/pip install . $SWAP_DATADIR/venv/bin/pip install .
## Decide a source for Monero's restore height ## Decide a source for Monero's restore height
@ -32,7 +28,7 @@ elif [[ "$monerod_addr" ]]; then
CURRENT_XMR_HEIGHT=$(curl "http://$monerod_addr:$monerod_port/get_info" | jq .height) CURRENT_XMR_HEIGHT=$(curl "http://$monerod_addr:$monerod_port/get_info" | jq .height)
else else
# Use public node # Use public node
CURRENT_XMR_HEIGHT=$(curl https://localmonero.co/blocks/api/get_stats | jq .height) CURRENT_XMR_HEIGHT=$(curl http://node3.monerodevs.org:18089/get_info | jq .height)
fi fi
# Use Tor if we want # Use Tor if we want
@ -42,22 +38,31 @@ enable_tor() {
fi fi
} }
# Use the custom Monero node # Use the custom Monero node & add wownero because its a small chain
if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then if [[ "$particl_mnemonic" && "$monerod_addr" ]]; then
# Restore seed
PARTICL_MNEMONIC=$particl_mnemonic PARTICL_MNEMONIC=$particl_mnemonic
basicswap-prepare --datadir=$SWAP_DATADIR --particl_mnemonic="$PARTICL_MNEMONIC" basicswap-prepare --datadir=$SWAP_DATADIR --particl_mnemonic="$PARTICL_MNEMONIC"
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port basicswap-prepare --datadir=$SWAP_DATADIR --addcoin=monero --xmrrestoreheight=$CURRENT_XMR_HEIGHT # 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
PARTICL_MNEMONIC=$particl_mnemonic PARTICL_MNEMONIC=$particl_mnemonic
basicswap-prepare --datadir=$SWAP_DATADIR --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
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=$CURRENT_XMR_HEIGHT # Setup new install and use a remote monero node
XMR_RPC_HOST=$monerod_addr BASE_XMR_RPC_PORT=$monerod_port \
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
$red"\n\nMake note of your seed above\n"; $nocolor $red"\n\nMake note of your seed above\n"; $nocolor
enable_tor enable_tor
else else
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=$CURRENT_XMR_HEIGHT # Setup new install using local nodes
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero,wownero --xmrrestoreheight=$CURRENT_XMR_HEIGHT --wowrestoreheight=600000
$red"\n\nMake note of your seed above\n"; $nocolor $red"\n\nMake note of your seed above\n"; $nocolor
enable_tor enable_tor
fi fi

73
bsx/tails_setup.sh Executable file
View file

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

View file

@ -1,4 +1,11 @@
#!/bin/bash #!/bin/bash
cd $SWAP_DATADIR/basicswap cd $SWAP_DATADIR/basicswap
# Delete dangling build folder. Same as --no-cache for docker
rm -rf ~/coinswaps/basicswap/build
# Fix any conflicts from potential force-pushes
git reset HEAD~5 --hard
# Pull repo
git pull git pull
# Install
$SWAP_DATADIR/venv/bin/pip install . $SWAP_DATADIR/venv/bin/pip install .

View file

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

View file

@ -20,29 +20,40 @@ $nocolor
INSTALL="" INSTALL=""
UPDATE="" UPDATE=""
DEPENDENCY="" DEPENDENCY=""
TAILS=""
check_tails() {
if [ $USER == amnesia ]; then
$green"\nDetected Tails\n";$nocolor
TAILS=1
else
$green"\nDetected Debian\n";$nocolor
fi
}
detect_os_arch() { detect_os_arch() {
if type -P apt > /dev/null; then if type -P apt > /dev/null; then
check_tails
# Debian / Ubuntu / Mint # Debian / Ubuntu / Mint
INSTALL="sudo apt install" INSTALL="sudo apt install"
UPDATE="sudo apt update" UPDATE="sudo apt update"
DEPENDENCY="python-is-python3 python3-pip python3-venv gnupg pkg-config protobuf-compiler" DEPENDENCY="python-is-python3 python3-pip python3-venv gnupg pkg-config"
$green"\nDetected Debian\n";$nocolor
elif type -P dnf > /dev/null; then elif type -P dnf > /dev/null; then
# Fedora # Fedora
INSTALL="sudo dnf install" INSTALL="sudo dnf install"
UPDATE="sudo dnf check-update" UPDATE="sudo dnf check-update"
DEPENDENCY="python3-virtualenv python3-pip python3-devel gnupg2 pkgconf protobuf-compiler" DEPENDENCY="python3-virtualenv python3-pip python3-devel gnupg2 pkgconf"
$green"\nDetected Fedora\n";$nocolor $green"\nDetected Fedora\n";$nocolor
elif type -P pacman > /dev/null; then elif type -P pacman > /dev/null; then
# Arch Linux # Arch Linux
INSTALL="sudo pacman -S" INSTALL="sudo pacman -S"
UPDATE="sudo pacman -Syu" UPDATE="sudo pacman -Syu"
DEPENDENCY="python-pipenv gnupg protobuf pkgconf base-devel" DEPENDENCY="python-pipenv gnupg pkgconf base-devel"
$green"\nDetected Arch Linux\n";$nocolor $green"\nDetected Arch Linux\n";$nocolor
elif type -P brew > /dev/null; then elif type -P brew > /dev/null; then
# MacOS # MacOS
INSTALL="brew install" INSTALL="brew install"
DEPENDENCY="python protobuf gnupg pkg-config" DEPENDENCY="python gnupg pkg-config"
$green"\nDetected MacOS\n";$nocolor $green"\nDetected MacOS\n";$nocolor
else else
$red"Failed to detect OS. Unsupported or unknown distribution.\nInstall Failed.";$nocolor $red"Failed to detect OS. Unsupported or unknown distribution.\nInstall Failed.";$nocolor
@ -150,6 +161,7 @@ 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
mkdir -p "$SWAP_DATADIR/venv" mkdir -p "$SWAP_DATADIR/venv"
python -m venv "$SWAP_DATADIR/venv" python -m venv "$SWAP_DATADIR/venv"
## Activate venv ## Activate venv