How To Run a Bitcoin Full Node over Tor on an Ubuntu (Linux) Virtual Machine (updated 2020)

A step-by-step guide to getting a Bitcoin Full Node running on your computer — no previous experience required!

Image for post
Image for post
Full Nodes are Bitcoin’s nervous system!

This article updated in April 2020 with latest info and corrections, including VirtualBox 6.1, Ubuntu Server 18.04.4 LTS, and Bitcoin Core 19.1

Part Zero — Overview

Part One — Prerequisites

Part Two— Setting up the VirtualBox platform

Part Three — Configuring our Ubuntu Linux server virtual machine

Part Four — Installing Ubuntu Linux on our new virtual machine disk

sudo apt update && sudo apt upgrade

Part Five — Installing the Bitcoin Core server (bitcoind)

sudo add-apt-repository universe
sudo apt-get install build-essential autoconf libtool pkg-config libboost-all-dev libssl-dev libevent-dev doxygen libzmqpp-dev libdb++-dev
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef  db-4.8.30.NC.tar.gz' | sha256sum -c
tar -xvf db-4.8.30.NC.tar.gzcd db-4.8.30.NC/build_unix
mkdir -p build
BDB_PREFIX=$(pwd)/build../dist/configure --disable-shared --enable-cxx --with-pic --prefix=$BDB_PREFIXmake install
cd ~
git clone https://github.com/bitcoin/bitcoin.git 
cd bitcoingit checkout v0.19.1git status
./autogen.sh
./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/" --with-gui=no(NOTE the -O2 flag contains the letter “oh”, not the numeral zero!)
makemake checksudo make install

Part Six — Configuring Bitcoin to use Tor

cd ~mkdir .bitcointouch .bitcoin/bitcoin.confecho "txindex=1" >> .bitcoin/bitcoin.confecho "onlynet=onion" >> .bitcoin/bitcoin.conf
echo "maxconnections=20" >> .bitcoin/bitcoin.conf
sudo apt install tor
less /usr/share/tor/tor-service-defaults-torrc
sudo sh -c "echo 'ControlPort 9051' >> /usr/share/tor/tor-service-defaults-torrc"
sudo /etc/init.d/tor restart
sudo usermod -a -G debian-tor username
bitcoind -daemon
tail -f ~/.bitcoin/debug.log
bitcoin-cli getnetworkinfo
bitcoin-cli getpeerinfo | grep true

References

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store