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.



BasicSwap on Docker

Create Initial Files

If you’re about to connect BasicSwap to Tor for the first time, you first need to create Tor configuration files.

  1. 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.

  1. Install BasicSwap through the installation process detailed here.

  2. 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
    
  3. 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.

  1. Shutdown BasicSwap entirely.

  2. 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
    
  3. Start BasicSwap along with Tor.

    export COINDATA_PATH=/var/data/coinswaps && docker compose -f docker-compose_with_tor.yml up
    

Update Coins Through Tor

  1. Shutdown BasicSwap entirely.

  2. Start a Tor-connected BasicSwap instance in the background.

    docker compose -f docker-compose_with_tor.yml up -d tor
    
  3. 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
    
  4. 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

  1. Shutdown BasicSwap entirely.

  2. 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
    
  3. Start Tor normally.

    export COINDATA_PATH=/var/data/coinswaps && docker-compose up
    

BasicSwap Without Docker

For Linux users that have installed BasicSwap without Docker, enabling Tor is simplified through community-developed scripts available here on Github.


See also