mirror of
https://github.com/nahuhh/basicswap-bash.git
synced 2025-01-03 17:39:56 +00:00
Compare commits
3 commits
10e81c85d1
...
72ae7e315e
Author | SHA1 | Date | |
---|---|---|---|
|
72ae7e315e | ||
|
82fd60cd3c | ||
|
e9eee1c826 |
4 changed files with 49 additions and 98 deletions
|
@ -1,85 +1,43 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#set -x
|
set -x
|
||||||
SWAP_DATADIR=$HOME/coinswaps
|
SWAP_DATADIR=$HOME/coinswaps
|
||||||
|
BINDIR=$SWAP_DATADIR/bin
|
||||||
|
|
||||||
echo "Checking for Coin updates" && sleep 1
|
echo "Checking for Coin updates" && sleep 1
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/bitcoin ]]; then
|
chain=(
|
||||||
BTC=$($SWAP_DATADIR/bin/bitcoin/bitcoind --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
bitcoin
|
||||||
if [[ -z $BTC ]]; then
|
dash
|
||||||
echo "Updating Bitcoin"
|
decred
|
||||||
Bitcoin="bitcoin,"
|
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
|
fi
|
||||||
fi
|
if [[ -z $UPDATE ]]; then
|
||||||
|
select+="$coin,"
|
||||||
if [[ -d $SWAP_DATADIR/bin/dash ]]; then
|
list=${select%,}
|
||||||
DASH=$($SWAP_DATADIR/bin/dash/dashd --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $DASH ]]; then
|
|
||||||
echo "Updating Dash"
|
|
||||||
Dash="dash,"
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/decred ]]; then
|
|
||||||
DCR=$($SWAP_DATADIR/bin/decred/dcrd --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $DCR ]]; then
|
|
||||||
echo "Updating Decred"
|
|
||||||
Decred="decred,"
|
|
||||||
fi
|
fi
|
||||||
fi
|
done
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/firo ]]; then
|
echo "Updating $list"
|
||||||
FIRO=$($SWAP_DATADIR/bin/firo/firod --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $FIRO ]]; then
|
|
||||||
echo "Updating Firo"
|
|
||||||
Firo="firo,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/litecoin ]]; then
|
if [[ -n $select ]]; then
|
||||||
LTC=$($SWAP_DATADIR/bin/litecoin/litecoind --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $LTC ]]; then
|
|
||||||
echo "Updating Litecoin"
|
|
||||||
Litecoin="litecoin,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/particl ]]; then
|
|
||||||
PART=$($SWAP_DATADIR/bin/particl/particld --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $PART ]]; then
|
|
||||||
echo "Updating Particl"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/pivx ]]; then
|
|
||||||
PIVX=$($SWAP_DATADIR/bin/pivx/pivxd --version | grep version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $PIVX ]]; then
|
|
||||||
echo "Updating PIVX"
|
|
||||||
Pivx="pivx,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/monero ]]; then
|
|
||||||
XMR=$($SWAP_DATADIR/bin/monero/monerod --version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $XMR ]]; then
|
|
||||||
echo "Updating Monero"
|
|
||||||
Monero="monero,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $SWAP_DATADIR/bin/wownero ]]; then
|
|
||||||
WOW=$($SWAP_DATADIR/bin/wownero/wownerod --version | grep -Fxf $SWAP_DATADIR/basicswap/core_versions)
|
|
||||||
if [[ -z $WOW ]]; then
|
|
||||||
echo "Updating Wownero"
|
|
||||||
Wownero="wownero,"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
if [[ -n $Bitcoin ]] || [[ -n $Dash ]] || [[ -n $Decred ]] || [[ -n $Firo ]] || [[ -n $Litecoin ]] || [[ -n $Particl ]] || [[ -n $Pivx ]] || [[ -n $Monero ]] || [[ -n $Wownero ]]; then
|
|
||||||
. $SWAP_DATADIR/venv/bin/activate
|
. $SWAP_DATADIR/venv/bin/activate
|
||||||
basicswap-prepare --datadir=$SWAP_DATADIR --preparebinonly --withcoins="$Bitcoin$Dash$Decred$Firo$Litecoin$Pivx$Monero$Wownero"particl
|
basicswap-prepare --datadir=$SWAP_DATADIR --preparebinonly --withcoins=$list
|
||||||
else
|
else
|
||||||
echo "Coin Cores are up to date"
|
echo "Coin Cores are up to date"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -62,5 +62,5 @@ else
|
||||||
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\nYou'll need to open a new login shell (a new terminal window) for the start scripts to be recognized.\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
|
$red"You may have to logout / login or open a new terminal window for the commands to be detected\n";$nocolor
|
||||||
|
|
|
@ -5,20 +5,19 @@ 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"
|
||||||
|
|
||||||
## 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 -b wow
|
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/pip install certifi
|
||||||
|
fi
|
||||||
|
|
||||||
|
## Install basicswap, coincurve, and pip dependencies
|
||||||
|
torsocks $SWAP_DATADIR/venv/bin/pip install -r requirements.txt --require-hashes
|
||||||
|
torsocks $SWAP_DATADIR/venv/bin/pip install .
|
||||||
|
|
||||||
## Decide a source for Monero's restore height
|
## Decide a source for Monero's restore height
|
||||||
if [[ "$xmrrestoreheight" ]]; then
|
if [[ "$xmrrestoreheight" ]]; then
|
||||||
|
@ -42,27 +41,20 @@ 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"; $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
|
||||||
|
@ -70,4 +62,5 @@ else
|
||||||
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
|
||||||
|
|
|
@ -211,7 +211,7 @@ fi
|
||||||
if [[ -d $HOME/.local/bin/bsx ]]; then
|
if [[ -d $HOME/.local/bin/bsx ]]; then
|
||||||
rm -r $HOME/.local/bin/bsx* $HOME/.local/bin/basicswap-bash
|
rm -r $HOME/.local/bin/bsx* $HOME/.local/bin/basicswap-bash
|
||||||
fi
|
fi
|
||||||
mv -f -t $HOME/.local/bin/ basicswap-bash bsx*
|
cp -r -t $HOME/.local/bin/ basicswap-bash bsx*
|
||||||
|
|
||||||
## Make venv and set variables for install
|
## Make venv and set variables for install
|
||||||
export monerod_addr=$monerod_addr
|
export monerod_addr=$monerod_addr
|
||||||
|
|
Loading…
Reference in a new issue