remove protobuf, update README

This commit is contained in:
nahuhh 2024-06-03 21:20:34 -05:00
parent b8729282f9
commit 7ae1eb55b2
13 changed files with 159 additions and 58 deletions

View file

@ -1,16 +1,24 @@
# 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
```bash
wget https://github.com/nahuhh/basicswap-bash/releases/latest/download/basicswap-bash.tar.gz
tar xvf basicswap-bash.tar.gz
git clone https://github.com/nahuhh/basicswap-bash -b dev
cd basicswap-bash && ./install.sh
cd .. && rm -rf basicswap-bash
```
### Running BasicSwapDEX
```
basicswap-bash
```
#### Update BSX core
```
bsx-update
```
#### Enable/Disable Tor [post install]
```
@ -20,18 +28,18 @@ bsx-enabletor
bsx-disabletor
```
#### Add coins
#### Add/remove coins
```
bsx-addcoin
```
```
bsx-removecoin
```
#### Update blockchains
```
bsx-upgrade-coins
```
#### Update BSX core
```
bsx-update
```
A small donation goes a long way. Thanks

View file

@ -1,4 +1,4 @@
#!/bin/bash
export SWAP_DATADIR=$HOME/coinswaps
. $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
. $SWAP_DATADIR/venv/bin/activate && python -V
if [[ $TAILS ]]; then
/usr/local/bin/bsx/tails_setup.sh
else
/usr/local/bin/bsx/setup.sh
fi

View file

@ -1,11 +1,11 @@
#!/bin/bash
## 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
## Confirm
echo -e "\nAdd $addcoin to your BasicSwap install, correct? Press any key to continue. CTRL-C to exit"
read
read -p $'\nAdd '$addcoin' to your BasicSwap install, correct? Press ENTER to continue. CTRL-C to exit'
## Add the coin
if [ $addcoin = bitcoin ]; then
read -p 'Use --usebtcfastsync for bitcoin? [Y/n] ' btcfastsync

View file

@ -53,7 +53,8 @@ read -p "Enter a (new) tor control password [example: 123123] " torcontrolpass
# Edit /etc/tor/torrc
torhashedpass=$(tor --hash-password $torcontrolpass)
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
# Use Existing enabled ControlPort and append HashedControlPassword
echo -e "# Added by basicswap-bash\nHashedControlPassword $torhashedpass" | sudo tee -a /etc/tor/torrc

View file

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

View file

@ -5,9 +5,6 @@ red="echo -e -n \e[31;1m"
green="echo -e -n \e[32;1m"
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
cd $SWAP_DATADIR
wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/refs/tags/anonswap_v0.2.zip
@ -18,10 +15,9 @@ $SWAP_DATADIR/venv/bin/pip install .
## Clone basicswap git
cd $SWAP_DATADIR
git clone https://github.com/tecnovert/basicswap.git
git clone https://github.com/tecnovert/basicswap -b wow
cd $SWAP_DATADIR/basicswap
## Install basicswap
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto
$SWAP_DATADIR/venv/bin/pip install .
## 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)
else
# 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
# Use Tor if we want
@ -42,22 +38,31 @@ enable_tor() {
fi
}
# Use the custom Monero node
# 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"
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
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
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
enable_tor
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
enable_tor
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 -b wow
cd $SWAP_DATADIR/basicswap
## Install basicswap
torsocks $SWAP_DATADIR/venv/bin/pip install . # Tails requires torsocks for pip
## Decide a source for Monero's restore height
if [[ "$xmrrestoreheight" ]]; then
CURRENT_XMR_HEIGHT=$xmrrestoreheight
elif [[ "$monerod_addr" ]]; then
# Use custom Monero node
CURRENT_XMR_HEIGHT=$(curl "http://$monerod_addr:$monerod_port/get_info" | jq .height)
else
# Use public node
CURRENT_XMR_HEIGHT=$(curl http://node3.monerodevs.org:18089/get_info | jq .height)
fi
# Use Tor if we want
enable_tor() {
if [[ "$tor_on" = 1 ]]; then
/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,23 @@
#!/bin/bash
cd $SWAP_DATADIR/basicswap
# Download updated scripts
echo "Updating basicswap-bash scripts" && sleep 1
git clone https://github.com/nahuhh/basicswap-bash -b dev
cd basicswap-bash
# Move scripts
sudo rm -rf /usr/local/bin/bsx
sudo mv -f basic* bsx* /usr/local/bin/
# Cleanup install
cd ..
rm -rf basicswap-bash
echo "Updating BasicSwapDEX" && sleep 1
# Delete dangling build folder. Same as --no-cache for docker
rm -rf ~/coinswaps/basicswap/build
# Fix conflicts from force-pushes
git reset HEAD~5 --hard
# Pull repo
git pull
# Install
$SWAP_DATADIR/venv/bin/pip install .

View file

@ -1,13 +1,13 @@
#!/bin/bash
## Prompt for user input
echo "You can only update 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"
read -p 'Full name of coin to update [example: litecoin] ' updatecoin
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 $'\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
basicswap-prepare --datadir=$SWAP_DATADIR -preparebinonly --withcoins=$updatecoin
echo "Updated $updatecoin"
## Upgrade the coin
basicswap-prepare --datadir=$SWAP_DATADIR -preparebinonly --withcoins=$upgradecoin
echo "Upgraded $upgradecoin"

View file

@ -20,29 +20,40 @@ $nocolor
INSTALL=""
UPDATE=""
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() {
if type -P apt > /dev/null; then
check_tails
# Debian / Ubuntu / Mint
INSTALL="sudo apt install"
UPDATE="sudo apt update"
DEPENDENCY="python-is-python3 python3-pip python3-venv gnupg pkg-config protobuf-compiler"
$green"\nDetected Debian\n";$nocolor
DEPENDENCY="python-is-python3 python3-pip python3-venv gnupg pkg-config"
elif type -P dnf > /dev/null; then
# Fedora
INSTALL="sudo dnf install"
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
elif type -P pacman > /dev/null; then
# Arch Linux
INSTALL="sudo pacman -S"
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
elif type -P brew > /dev/null; then
# MacOS
INSTALL="brew install"
DEPENDENCY="python protobuf gnupg pkg-config"
DEPENDENCY="python gnupg pkg-config"
$green"\nDetected MacOS\n";$nocolor
else
$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 xmrrestoreheight=$xmrrestoreheight
export tor_on=$tor_on
export TAILS=$TAILS
mkdir -p "$SWAP_DATADIR/venv"
python -m venv "$SWAP_DATADIR/venv"
## Activate venv

View file

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

View file

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