2019-07-26 13:07:22 +00:00
|
|
|
|
2020-12-05 11:22:22 +00:00
|
|
|
## Source code
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
git clone https://github.com/tecnovert/basicswap.git
|
2019-07-26 13:07:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Run Using Docker
|
|
|
|
|
2022-06-27 20:10:28 +00:00
|
|
|
|
|
|
|
Install dependencies:
|
|
|
|
|
2022-12-08 15:06:38 +00:00
|
|
|
apt-get install curl jq git
|
2022-06-27 20:10:28 +00:00
|
|
|
|
|
|
|
|
2019-07-26 13:07:22 +00:00
|
|
|
Docker must be installed and started:
|
2020-12-06 17:34:56 +00:00
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
docker -v
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2021-11-03 21:20:19 +00:00
|
|
|
Should return a line containing `Docker version`...
|
2020-12-05 11:22:22 +00:00
|
|
|
|
|
|
|
|
2022-06-27 20:10:28 +00:00
|
|
|
To install docker engine on your platform see:
|
|
|
|
|
|
|
|
https://docs.docker.com/engine/install/#server
|
|
|
|
|
|
|
|
|
|
|
|
It's recommended to setup docker to work without sudo.<br>
|
|
|
|
Without this step you will need to preface each `docker-compose` command with `sudo`:
|
2022-05-23 21:51:06 +00:00
|
|
|
|
|
|
|
https://docs.docker.com/engine/install/linux-postinstall/
|
|
|
|
|
|
|
|
|
2021-02-14 13:06:46 +00:00
|
|
|
#### Create the images:
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2022-10-18 19:01:34 +00:00
|
|
|
COINDATA_PATH can be set to your preference but must be exported each time you launch Basicswap.<br>
|
2022-06-27 20:10:28 +00:00
|
|
|
Consider adding COINDATA_PATH to the `.env` file in the docker directory file so it's always set.
|
|
|
|
|
|
|
|
export COINDATA_PATH=/var/data/coinswaps
|
2022-06-18 17:28:40 +00:00
|
|
|
cd basicswap/docker
|
|
|
|
docker-compose build
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2023-01-11 20:57:19 +00:00
|
|
|
Depending on your environment, the `docker-compose` command may not work. If that's the case, type `docker compose` instead, without the dash.
|
2021-02-14 13:06:46 +00:00
|
|
|
|
|
|
|
#### Prepare the datadir:
|
|
|
|
|
2020-12-08 22:05:28 +00:00
|
|
|
Set xmrrestoreheight to the current xmr chain height.
|
2022-06-18 17:28:40 +00:00
|
|
|
|
|
|
|
CURRENT_XMR_HEIGHT=$(curl https://localmonero.co/blocks/api/get_stats | jq .height)
|
|
|
|
|
2021-01-05 18:10:33 +00:00
|
|
|
Adjust `--withcoins` and `--withoutcoins` as desired, eg: `--withcoins=monero,bitcoin`. By default only Particl is loaded.
|
2020-12-05 11:22:22 +00:00
|
|
|
|
2022-06-27 20:10:28 +00:00
|
|
|
##### FastSync
|
|
|
|
|
|
|
|
Append `--usebtcfastsync` to the below command to optionally initialise the Bitcoin datadir with a chain snapshot from btcpayserver FastSync.<br>
|
|
|
|
[FastSync README.md](https://github.com/btcpayserver/btcpayserver-docker/blob/master/contrib/FastSync/README.md)
|
|
|
|
|
|
|
|
|
|
|
|
Setup with a local Monero daemon (recommended):
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
export COINDATA_PATH=/var/data/coinswaps
|
2022-07-31 21:40:58 +00:00
|
|
|
docker run --rm -t --name swap_prepare -v $COINDATA_PATH:/coindata i_swapclient basicswap-prepare --datadir=/coindata --withcoins=monero --htmlhost="0.0.0.0" --wshost="0.0.0.0" --xmrrestoreheight=$CURRENT_XMR_HEIGHT
|
2020-12-05 11:22:22 +00:00
|
|
|
|
2021-02-14 13:06:46 +00:00
|
|
|
|
2022-06-27 20:10:28 +00:00
|
|
|
To instead use Monero public nodes and not run a local Monero daemon<br>(it can be difficult to find reliable public nodes):
|
2021-02-14 13:06:46 +00:00
|
|
|
|
2022-06-27 20:10:28 +00:00
|
|
|
Set XMR_RPC_HOST and BASE_XMR_RPC_PORT to a public XMR node.
|
|
|
|
export COINDATA_PATH=/var/data/coinswaps
|
2022-07-31 21:40:58 +00:00
|
|
|
docker run --rm -e XMR_RPC_HOST="node.xmr.to" -e BASE_XMR_RPC_PORT=18081 -t --name swap_prepare -v $COINDATA_PATH:/coindata i_swapclient basicswap-prepare --datadir=/coindata --withcoins=monero --htmlhost="0.0.0.0" --wshost="0.0.0.0" --xmrrestoreheight=$CURRENT_XMR_HEIGHT
|
2022-06-04 20:41:24 +00:00
|
|
|
|
2022-06-27 20:10:28 +00:00
|
|
|
|
|
|
|
**Record the mnemonic from the output of the above command.**
|
2023-07-18 23:19:04 +00:00
|
|
|
**Mnemonics should be stored encrypted and/or air-gapped.**
|
2022-06-27 20:10:28 +00:00
|
|
|
And the output of `echo $CURRENT_XMR_HEIGHT` for use if you need to later restore your wallet.
|
2022-06-04 20:41:24 +00:00
|
|
|
|
2023-01-11 20:57:19 +00:00
|
|
|
#### Make COINDATA_PATH permanent (optional):
|
2023-01-11 20:52:46 +00:00
|
|
|
|
|
|
|
Edit the `.env` file in the docker directory and uncomment COINDATA_PATH line by deleting the hashtag.
|
2022-06-04 20:41:24 +00:00
|
|
|
|
2021-02-14 14:53:44 +00:00
|
|
|
#### Set the timezone (optional):
|
2021-02-14 13:06:46 +00:00
|
|
|
|
|
|
|
Edit the `.env` file in the docker directory, set TZ to your local timezone.
|
|
|
|
Valid options can be listed with: `timedatectl list-timezones`
|
2020-12-05 11:22:22 +00:00
|
|
|
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2021-02-14 13:06:46 +00:00
|
|
|
#### Start the container:
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
export COINDATA_PATH=/var/data/coinswaps
|
|
|
|
docker-compose up
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2020-12-05 11:22:22 +00:00
|
|
|
Open in browser: `http://localhost:12700`
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2021-01-05 12:31:02 +00:00
|
|
|
|
|
|
|
|
2020-12-06 17:34:56 +00:00
|
|
|
### Add a coin
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
docker-compose stop
|
|
|
|
export COINDATA_PATH=/var/data/coinswaps
|
2022-12-11 23:30:33 +00:00
|
|
|
docker run --rm -t --name swap_prepare -v $COINDATA_PATH:/coindata i_swapclient basicswap-prepare --datadir=/coindata --addcoin=bitcoin --usebtcfastsync
|
2020-12-06 17:34:56 +00:00
|
|
|
|
|
|
|
You can copy an existing pruned datadir (excluding bitcoin.conf and any wallets) over to `$COINDATA_PATH/bitcoin`
|
2020-12-08 22:05:28 +00:00
|
|
|
Remove any existing wallets after copying over a pruned chain or the Bitcoin daemon won't start.
|
2020-12-06 17:34:56 +00:00
|
|
|
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2022-12-11 23:30:33 +00:00
|
|
|
With Encryption
|
|
|
|
|
|
|
|
export COINDATA_PATH=/var/data/coinswaps
|
|
|
|
docker run -e WALLET_ENCRYPTION_PWD=passwordhere --rm -t --name swap_prepare -v $COINDATA_PATH:/coindata i_swapclient basicswap-prepare --datadir=/coindata --addcoin=bitcoin --usebtcfastsync
|
|
|
|
|
2021-02-06 08:19:46 +00:00
|
|
|
|
2021-11-03 21:20:19 +00:00
|
|
|
## Windows
|
2021-02-06 08:19:46 +00:00
|
|
|
|
2021-11-03 21:20:19 +00:00
|
|
|
#### Setup WSL 2 and Docker Desktop
|
2021-01-05 12:31:02 +00:00
|
|
|
[docs.docker.com/docker-for-windows/wsl](https://docs.docker.com/docker-for-windows/wsl/)
|
|
|
|
|
|
|
|
|
2021-11-03 21:20:19 +00:00
|
|
|
Open a wsl terminal
|
|
|
|
Windows key + R -> "wsl" -> Enter
|
2021-01-05 12:31:02 +00:00
|
|
|
|
2021-02-06 08:19:46 +00:00
|
|
|
|
2021-11-03 21:20:19 +00:00
|
|
|
Install Git:
|
2021-02-06 08:19:46 +00:00
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
sudo apt update
|
|
|
|
sudo apt install git
|
2021-02-06 08:19:46 +00:00
|
|
|
|
|
|
|
|
2021-11-03 21:20:19 +00:00
|
|
|
Download the BasicSwap code:
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
git clone https://github.com/tecnovert/basicswap.git
|
|
|
|
cd basicswap/docker/
|
2021-02-06 08:19:46 +00:00
|
|
|
|
|
|
|
|
2021-11-03 21:20:19 +00:00
|
|
|
It's significantly faster to set COINDATA_PATH in the linux filesystem.
|
|
|
|
You can access it from the windows side at: `\\wsl$\Ubuntu`
|
2021-02-06 08:19:46 +00:00
|
|
|
|
|
|
|
Continue from the [Run Using Docker](#run-using-docker) section.
|
|
|
|
|
|
|
|
|
2020-12-05 11:22:22 +00:00
|
|
|
## Run Without Docker:
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2020-12-30 21:01:21 +00:00
|
|
|
|
|
|
|
### Ubuntu Setup:
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
apt-get install -y wget python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config curl jq
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2020-12-30 21:01:21 +00:00
|
|
|
### OSX Setup:
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
Install Homebrew (See https://brew.sh/):
|
2020-12-30 21:01:21 +00:00
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
2020-12-30 21:01:21 +00:00
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
|
2022-06-25 20:10:31 +00:00
|
|
|
brew install wget unzip python git protobuf gnupg automake libtool pkg-config curl jq
|
2022-06-18 17:28:40 +00:00
|
|
|
|
2022-06-25 20:10:31 +00:00
|
|
|
Close the terminal and open a new one to update the python symlinks.
|
2020-12-30 21:01:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
### Basicswap:
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
export SWAP_DATADIR=/Users/$USER/coinswaps
|
|
|
|
mkdir -p "$SWAP_DATADIR/venv"
|
|
|
|
python3 -m venv "$SWAP_DATADIR/venv"
|
|
|
|
. $SWAP_DATADIR/venv/bin/activate && python -V
|
|
|
|
cd $SWAP_DATADIR
|
2023-12-14 18:29:32 +00:00
|
|
|
wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/refs/tags/anonswap_v0.2.zip
|
2022-06-29 12:17:57 +00:00
|
|
|
unzip -d coincurve-anonswap coincurve-anonswap.zip
|
|
|
|
mv ./coincurve-anonswap/*/{.,}* ./coincurve-anonswap || true
|
2022-06-18 17:28:40 +00:00
|
|
|
cd $SWAP_DATADIR/coincurve-anonswap
|
|
|
|
pip3 install .
|
2019-07-26 13:07:22 +00:00
|
|
|
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
cd $SWAP_DATADIR
|
|
|
|
git clone https://github.com/tecnovert/basicswap.git
|
|
|
|
cd $SWAP_DATADIR/basicswap
|
2022-06-25 20:10:31 +00:00
|
|
|
|
2023-12-19 09:13:41 +00:00
|
|
|
|
2022-06-25 20:10:31 +00:00
|
|
|
If installed on OSX, you may need to install additional root ssl certificates for the ssl module.
|
|
|
|
From https://pypi.org/project/certifi/
|
|
|
|
|
|
|
|
sudo python3 bin/install_certifi.py
|
|
|
|
|
|
|
|
|
|
|
|
Continue installing Basicswap
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto
|
|
|
|
pip3 install .
|
2019-07-26 13:07:22 +00:00
|
|
|
|
2022-06-25 20:10:31 +00:00
|
|
|
|
2020-12-05 11:22:22 +00:00
|
|
|
Prepare the datadir:
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
CURRENT_XMR_HEIGHT=$(curl https://localmonero.co/blocks/api/get_stats | jq .height)
|
|
|
|
|
2023-12-19 09:13:41 +00:00
|
|
|
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=$CURRENT_XMR_HEIGHT
|
|
|
|
|
|
|
|
OR using a remote/public XMR daemon (not recommended):
|
2022-06-18 17:28:40 +00:00
|
|
|
XMR_RPC_HOST="node.xmr.to" BASE_XMR_RPC_PORT=18081 basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=$CURRENT_XMR_HEIGHT
|
2020-12-05 11:22:22 +00:00
|
|
|
|
2020-12-30 21:01:21 +00:00
|
|
|
|
2020-12-05 11:22:22 +00:00
|
|
|
Record the mnemonic from the output of the above command.
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
Start Basicswap:
|
2020-12-05 11:22:22 +00:00
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
basicswap-run --datadir=$SWAP_DATADIR
|
2020-12-05 11:22:22 +00:00
|
|
|
|
2023-12-19 09:13:41 +00:00
|
|
|
|
2020-12-05 11:22:22 +00:00
|
|
|
Open in browser: `http://localhost:12700`
|
2020-12-31 12:53:31 +00:00
|
|
|
It may take a few minutes to start as the coin daemons are started before the http interface.
|
2019-07-26 13:07:22 +00:00
|
|
|
|
|
|
|
|
2022-06-27 20:10:28 +00:00
|
|
|
Add a coin (Stop basicswap first):
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
export SWAP_DATADIR=/Users/$USER/coinswaps
|
|
|
|
basicswap-prepare --usebtcfastsync --datadir=/$SWAP_DATADIR --addcoin=bitcoin
|
|
|
|
|
|
|
|
|
2020-12-30 21:01:21 +00:00
|
|
|
Start after installed:
|
|
|
|
|
2022-06-18 17:28:40 +00:00
|
|
|
export SWAP_DATADIR=/Users/$USER/coinswaps
|
|
|
|
. $SWAP_DATADIR/venv/bin/activate && python -V
|
|
|
|
basicswap-run --datadir=$SWAP_DATADIR
|