tor – How to run Bitcoin Core as onion service on Windows, Ubuntu and Android?


Windows

You can follow one of the steps from 2 and 3. Step 2 uses cookie for authentication and Step 3 uses password.

  1. Download and Install Bitcoin Core from https://bitcoincore.org/bin/bitcoin-core-0.20.1/bitcoin-0.20.1-win64-setup.exe

  2. Edit the bitcoin.conf file, enter the below things and save it. Default location of the file is %UserProfile%AppDataRoamingBitcoinbitcoin.conf

listen=1

debug=1

logips=1

testnet=1

listenonion=1

onlynet=onion

proxy=127.0.0.1:9150

torcontrol=127.0.0.1:9151
  • How to setup cookie auth for Tor control?

Open C:UsersPrayankDesktopTor BrowserBrowserTorBrowserDataTortorrc and add below line:

HCookieAuthentication 1

  1. IGNORE THIS STEP IF YOU ALREADY DID STEP 2. Edit the bitcoin.conf file, enter the below things and save it. Default location of the file is %UserProfile%AppDataRoamingBitcoinbitcoin.conf
listen=1

debug=1

logips=1

testnet=1

listenonion=1

onlynet=onion

proxy=127.0.0.1:9150

torcontrol=127.0.0.1:9151

torpassword=XYZ

XYZ: Replace it with your password in plain text

  • How to setup password for Tor control?

Open command prompt/PowerShell and run the below commands:

cd C:UsersPrayankDesktopTor BrowserBrowserTorBrowserTor

tor --hash-password "XYZ" >torhash.txt

Open torhash.tx file, copy the last line which has below content, paste in C:UsersPrayankDesktopTor BrowserBrowserTorBrowserDataTortorrc and save it:

HashedControlPassword 16:1CEDITEDOMERANDOMSHITCF8EBCD9A50CLOLCDACF

Run the below commands in command prompt or PowerShell to ensure connection with Tor control works:

telnet 127.0.0.1 9151
AUTHENTICATE "XYZ"

  1. Launch Tor Browser

  2. Launch Bitcoin Core Wallet (Testnet) using the shortcut with a green icon or run "C:Program FilesBitcoinbitcoin-qt.exe" -testnet in command prompt or PowerShell and change the path accordingly

  3. Run getnetworkinfo in console window and check the localaddresses. Check if testnet3/onion_private_key file is created and analyze the logs in debug.log file.

Bitcoin-Core-Tor-Windows

Ubuntu

You can follow one of the steps from 2 and 3. Step 2 uses cookie for authentication and Step 3 uses password.

  1. Download Bitcoin Core and run the below commands:

tar xzf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz

sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.20.0/bin/*

/usr/local/bin/bitcoin-qt

  1. Edit the .bitcoin/bitcoin.conf file, enter the below things and save it.
listen=1

debug=1

logips=1

testnet=1

listenonion=1

onlynet=onion

proxy=127.0.0.1:9050

sudo apt install tor

Open /etc/tor/torrc and add below lines:

ControlPort 9051

CookieAuthentication 1

CookieAuthFileGroupReadable 1

Restarts Tor: sudo /etc/init.d/tor restart

Add user to Tor group: sudo usermod -a -G debian-tor <username>

Run Bitcoin Core: /usr/local/bin/bitcoin-qt

  1. IGNORE THIS STEP IF YOU ALREADY DID STEP 2. Edit the bitcoin.conf file, enter the below things and save it.
listen=1

debug=1

logips=1

testnet=1

listenonion=1

onlynet=onion

proxy=127.0.0.1:9150

torpassword=XYZ

XYZ: Replace it with your password in plain text

  • How to setup password for Tor control?

Open command terminal and run the below commands:

torpass=$(tor --hash-password "my-tor-password")

printf "HashedControlPassword $torpassnControlPort 9051n" | sudo tee -a /etc/tor/torrc

  1. Run getnetworkinfo in console window and check the localaddresses. Check if testnet3/onion_private_key file is created and analyze the logs in debug.log file.

debug-log

Bitcoin-Core-Tor-Ubuntu

Android

Download, Install and Run either ABCore or Nayuta Core.

Nayuta-1 Nayuta-2
Nayuta-3

I have selected Bitcoin Knots in the settings of ABCore however there is an option to use Bitcoin Core as well.

ABCore-1ABCore-4
ABCore-3ABCore-2