basicswap/doc/install.md

163 lines
4.3 KiB
Markdown
Raw Normal View History

2019-07-26 13:07:22 +00:00
## Source code
2019-07-26 13:07:22 +00:00
$ git clone https://github.com/tecnovert/basicswap.git
## Run Using Docker
Docker must be installed and started:
2021-11-03 21:20:19 +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`...
2022-05-23 21:51:06 +00:00
It's recommended to setup docker to work without sudo:
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
$ cd basicswap/docker
$ docker-compose build
2021-02-14 13:06:46 +00:00
#### Prepare the datadir:
Set XMR_RPC_HOST and BASE_XMR_RPC_PORT to a public XMR node or exclude to run a local node.
Set xmrrestoreheight to the current xmr chain 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.
$ export COINDATA_PATH=/var/data/coinswaps
$ 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 \
2021-11-03 21:20:19 +00:00
basicswap-prepare --datadir=/coindata --withcoins=monero --htmlhost="0.0.0.0" --xmrrestoreheight=2485205
2021-02-14 13:06:46 +00:00
**Record the mnemonic from the output of the above command.**
##### FastSync
Use `--usebtcfastsync` to optionally initialise the Bitcoin datadir with a chain snapshot from btcpayserver FastSync.
[FastSync README.md](https://github.com/btcpayserver/btcpayserver-docker/blob/master/contrib/FastSync/README.md)
#### 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`
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
$ export COINDATA_PATH=/var/data/coinswaps
$ docker-compose up
2019-07-26 13:07: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
### Add a coin
$ docker-compose stop
$ export COINDATA_PATH=/var/data/coinswaps
2021-02-06 08:19:46 +00:00
$ docker run --rm -t --name swap_prepare -v $COINDATA_PATH:/coindata i_swapclient basicswap-prepare --datadir=/coindata --addcoin=bitcoin
You can copy an existing pruned datadir (excluding bitcoin.conf and any wallets) over to `$COINDATA_PATH/bitcoin`
Remove any existing wallets after copying over a pruned chain or the Bitcoin daemon won't start.
2019-07-26 13:07:22 +00:00
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
2021-11-03 21:20:19 +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:
$ 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.
## Run Without Docker:
2019-07-26 13:07:22 +00:00
### Ubuntu Setup:
$ apt-get install -y wget python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config
2019-07-26 13:07:22 +00:00
### OSX Setup:
Install Homebrew:
https://brew.sh/
Command Line Tools:
$ xcode-select --install
Dependencies:
$ brew install wget unzip python git protobuf gnupg automake libtool pkg-config
### Basicswap:
$ export SWAP_DATADIR=/Users/$USER/coinswaps
2020-12-31 10:02:17 +00:00
$ mkdir -p "$SWAP_DATADIR/venv"
$ python3 -m venv "$SWAP_DATADIR/venv"
$ . $SWAP_DATADIR/venv/bin/activate && python -V
$ cd $SWAP_DATADIR
$ wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/anonswap.zip
$ unzip coincurve-anonswap.zip
$ cd $SWAP_DATADIR/coincurve-anonswap
$ pip3 install .
2019-07-26 13:07:22 +00:00
$ cd $SWAP_DATADIR
$ git clone https://github.com/tecnovert/basicswap.git
$ cd $SWAP_DATADIR/basicswap
2019-07-26 13:07:22 +00:00
$ protoc -I=basicswap --python_out=basicswap basicswap/messages.proto
2019-07-27 20:13:35 +00:00
$ pip3 install .
2019-07-26 13:07:22 +00:00
Prepare the datadir:
2021-01-05 18:10:33 +00:00
XMR_RPC_HOST="node.xmr.to" BASE_XMR_RPC_PORT=18081 basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=2245107
OR using a local XMR daemon:
2021-01-05 18:10:33 +00:00
basicswap-prepare --datadir=$SWAP_DATADIR --withcoins=monero --xmrrestoreheight=2245107
Record the mnemonic from the output of the above command.
Start the app
$ basicswap-run --datadir=$SWAP_DATADIR
Open in browser: `http://localhost:12700`
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
Start after installed:
$ export SWAP_DATADIR=/Users/$USER/coinswaps
2021-01-01 16:03:05 +00:00
$ . $SWAP_DATADIR/venv/bin/activate && python -V
$ basicswap-run --datadir=$SWAP_DATADIR