Enable Tor¶
By default, connections to the BasicSwap network are public, much like connecting to other P2P networks (i.e., torrents). However, you can easily anonymize your network information (i.e., IP address, location) by routing your BasicSwap connection through the privacy-preserving Tor network.
This guide will show you how to protect your network information by routing BasicSwap’s connection through the Tor network.
Attention
Tor integration into BasicSwap is experimental and only officially supported for Docker installations.
Always keep Tor up-to-date with the latest version. Failure to do so may incur more risks than benefits.
Create Initial Files¶
If you’re about to connect BasicSwap to Tor for the first time, you first need to create Tor configuration files.
Create the initial files BasicSwap needs to connect to the Tor network. Docker will create directories instead of files if these don’t exist.
mkdir $COINDATA_PATH/tor touch $COINDATA_PATH/tor/torrc
Enable Tor on First Startup¶
If you are doing a fresh installation of BasicSwap and want to route it through the Tor network, the torrc configuration file won’t exist yet. Follow these instructions to create it.
Install BasicSwap through the installation process detailed here.
Create the torrc configuration file by typing these two commands one by one.
docker compose -f docker-compose_with_tor.yml run --name tor --rm tor \ tor --allow-missing-torrc --SocksPort 0.0.0.0:9050 docker compose -f docker-compose_with_tor.yml run -e TOR_PROXY_HOST=172.16.238.200 --rm swapclient \ basicswap-prepare --usetorproxy --datadir=/coindata --withcoins=monero,particl
Start BasicSwap with the following command.
docker compose -f docker-compose_with_tor.yml up
Enable Tor¶
If you have been using BasicSwap previously and want to enable Tor now, you can easily activate it with a single command.
Shutdown BasicSwap entirely.
Enable Tor and make the required modifications to your data directory.
docker compose -f docker-compose_with_tor.yml run -e TOR_PROXY_HOST=172.16.238.200 --rm swapclient \ basicswap-prepare --datadir=/coindata --enabletor
Start BasicSwap along with Tor.
export COINDATA_PATH=/var/data/coinswaps && docker compose -f docker-compose_with_tor.yml up
Update Coins Through Tor¶
Shutdown BasicSwap entirely.
Start a Tor-connected BasicSwap instance in the background.
docker compose -f docker-compose_with_tor.yml up -d tor
Update the coin you want by typing this command and modifying the withcoins argument.
docker compose -f docker-compose_with_tor.yml run -e TOR_PROXY_HOST=172.16.238.200 --rm swapclient \ basicswap-prepare --usetorproxy --datadir=/coindata --preparebinonly --withcoins=bitcoin
Once the process from the last step completes, shutdown BasicSwap instance running in the background.
docker compose -f docker-compose_with_tor.yml stop
Disable Tor¶
Shutdown BasicSwap entirely.
Enable Tor and make the required modifications to your data directory.
docker compose -f docker-compose_with_tor.yml run --rm swapclient \ basicswap-prepare --datadir=/coindata --disabletor
Start Tor normally.
export COINDATA_PATH=/var/data/coinswaps && docker-compose up
See also
BasicSwap Explained - BasicSwap Explained
BasicSwap Guides - Install BasicSwap
BasicSwap Guides - Update BasicSwap
BasicSwap Guides - Make an Offer
BasicSwap Guides - Take an Offer