This is the first in a multiple-part guide to installing and configuring an x86 bitcoin node from source, including Bitcoin Core, Dojo, Whirlpool, Fulcrum and Mempool Explorer packages.
Installing from source is the best way to learn how bitcoin nodes work whilst also giving you the power to run manual updates whenever you want instead of relying on node package maintainers to push updates, giving you full sovereignty over your node.
This sovereignty, however, comes with great responsibility since any mistakes you make will be your own to solve. The flip side is that you have the flexibility to install any other services you want on your node, so the possibilities are limitless. The packages we cover all have great documentation; some even have their own support channels, so help is never far away.
You can use any PC, but you will need a 1TB SSD or larger (not HDD), and I recommend a minimum of 8GB of system memory. I also recommend checking your system’s BIOS power settings and, if one is available, enabling any automatic power-on modes. This helps reduce downtime after power loss by automatically booting the device once power returns.
Those wanting a device with a footprint similar in size to a traditional node may want to check out the Lenovo ThinkCentre M series or, my favourite, the Dell Optiplex M range of microcomputers.
The first step is installing Ubuntu Server on the machine. If you’re unsure how to do this, check out my previous article on installing Ubuntu Server.
When creating your Ubuntu admin account, I recommend using the username “satoshi” since this is what I use throughout the entire series of guides. If using a different username, you will need to modify the supplied commands throughout the guides to reflect your username, paths and directories, or you will encounter errors. To avoid this added complexity, using my recommended username allows the simple process of copying and pasting.
Installing Bitcoin Core.
After gaining SSH access to the node, run a full system update and install all required dependencies.
sudo apt update && sudo apt upgrade -y
sudo apt install curl gpg unzip tor -y
Next, create and enter a downloads directory.
Next, visit bitcoincore.org and locate the page for the most current Bitcoin version, avoiding any releases marked “test“.
At the time of writing, version 25.0 is the most recent release. Copy the URL for the latest “x86_64-linux-gnu.tar.gz” package and download it using the “wget” command.
Do the same for the “SHA256SUMS” and “SHA256SUMS.asc” files listed on the same page.
Now verify the checksum of your download.
sha256sum --ignore-missing --check SHA256SUMS
Ignore any warnings or errors but ensure you get an “ok” message, for example:- “bitcoin-24.1-x86_64-linux-gnu.tar.gz: OK“.
To verify the validity of the release, you need to check the signatures against the developer keys listed in the official Bitcoin Core repository and import them into your GPG keyring.
The following command will download all keys and import them into your keyring.
curl -L https://api.github.com/repos/bitcoin-core/guix.sigs/tarball --output bitcoin-builders.tgz && tar --strip-components=1 -xzvf bitcoin-builders.tgz bitcoin-core-guix.sigs-948d975/builder-keys && gpg --import builder-keys/* && rm bitcoin-builders.tgz && rm -r builder-keys/
You can now verify the release’s signatures.
gpg --verify SHA256SUMS.asc
This will output a series of signature checks for each public key that signed the checksums. The keys previously imported into your keyring should show a “gpg: Good signature” message.
Remove the downloaded verification files; they are no longer required.
rm SHA256SUMS && rm SHA256SUMS.asc
Next, unpackage your Core download and remove the archive.
tar xzf bitcoin-25.0-x86_64-linux-gnu.tar.gz
rm -r bitcoin-25.0-x86_64-linux-gnu.tar.gz
Now install Bitcoin.
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-25.0/bin/*
Now that Bitcoin is installed start the daemon with the following command. The blockchain will immediately begin downloading.
Next, create a Bitcoin configuration file.
Paste the following lines into the file.
server=1 txindex=1 daemon=1 pruned=0 rpcport=8332 rpcbind=0.0.0.0 rpcallowip=127.0.0.1 rpcallowip=10.0.0.0/8 rpcallowip=126.96.36.199/8 rpcallowip=192.0.0.0/8 zmqpubrawblock=tcp://0.0.0.0:28332 zmqpubrawtx=tcp://0.0.0.0:28333 zmqpubhashblock=tcp://0.0.0.0:28334 whitelist=127.0.0.1
If you plan to use your node with the Bisq Network P2P exchange, you must also include the following line.
You also have the option of enabling or disabling “Mempool Full-RBF“. If you want to ensure that your choice persists through updates, regardless of whatever defaults future Core releases settle on, then I recommend flagging this in your conf file using either the enable (1) or disable (0) flag. You can ignore this line if you are happy to flow with any defaults chosen for you in future updates.
Leave the file open and start a new terminal session. SSH into the node and download the raw “rpcauth.py file” from the Bitcoin repository with the “wget” command.
chmod +x rpcauth.py
Create a robust and unique RPC password, avoiding special characters, and record it safely. A Core RPC username is also required; for simplicity, I use the RPC username “bitcoin“, which I’ll be using in the examples provided throughout the rest of the series.
Edit the following command to include your chosen RPC username & password.
./rpcauth.py bitcoin password
In the output, copy the RPC string. If you used “bitcoin” for your username, it would start like this:- “rpcauth=bitcoin:“. Paste this, including the long string of numbers that follow, into the bottom of the “bitcoin.conf” file, still open in your first terminal window.
You can then save and exit the file by pressing “control+x” and confirm by pressing “y” and then “enter“. The second terminal you opened can be safely closed.
Remove the “rpcauth.py” file and the leftover Bitcoin folder from your downloads directory.
rm -r bitcoin-25.0/
Now that you have a valid configuration file, the next step is creating a service file that allows the Bitcoin CLI to start whenever the node boots automatically.
First, stop the CLI.
Copy the link to the raw “bitcoind.service” file in the Bitcoin repository. You need to download the file to a different directory this time.
sudo wget https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/init/bitcoind.service
sudo nano bitcoind.service
The file will open. You need to make several edits, not forgetting to modify any paths if you did not use “satoshi” as your admin username.
####change ExecStart=/usr/bin/bitcoind -daemonwait \ -pid=/run/bitcoind/bitcoind.pid \ -conf=/etc/bitcoin/bitcoin.conf \ -datadir=/var/lib/bitcoind ##to ExecStart=/usr/local/bin/bitcoind -daemon \ -pid=/run/bitcoind/bitcoind.pid \ -conf=/home/satoshi/.bitcoin/bitcoin.conf \ -datadir=/home/satoshi/.bitcoin ####comment out ExecStartPre=/bin/chgrp bitcoin /etc/bitcoin ##like this #ExecStartPre=/bin/chgrp bitcoin /etc/bitcoin ####edit User=bitcoin Group=bitcoin ##to match your ubuntu admin username User=satoshi Group=satoshi ####comment out ProtectHome=true ##like this #ProtectHome=true
Exit the file with “control+x”, ensuring you save it when prompted with “y” and then “enter“. Next, activate the service file.
sudo systemctl enable bitcoind
sudo systemctl start bitcoind
sudo systemctl status bitcoind
You should see a green light and an “active” status. You can exit the output in the usual way with “control+c”.
Before continuing, wait until the initial block download completes. IBD speeds vary depending on bandwidth, but it can complete as quickly as 24 hours with a good connection. Use the following command to monitor progress.
tail -f .bitcoin/debug.log
Once the logs show “progress=1.000000“, the IBD is complete.
Tor needs to be configured to work with the Bitcoin CLI. First, check that Tor is operational.
sudo systemctl status tor
Again, you should look for the green light and “active” status. Exit the status output and run the following command to open the “torrc” file.
sudo nano /etc/tor/torrc
Paste the following at the bottom of the file and then save and exit.
ControlPort 9051 CookieAuthentication 1 CookieAuthFileGroupReadable 1
Now restart Tor.
sudo systemctl restart tor
Then add your Ubuntu admin user to the Tor group.
sudo usermod -aG debian-tor satoshi
You now need to make further edits to the “bitcoin.conf” file.
At the very bottom, paste the following lines.
# Hidden Service Core proxy=127.0.0.1:9050 listen=1 bind=127.0.0.1 onlynet=onion
Your first Tor peer needs to be added manually. This temporary edit is required to plug your node into the network of other Tor Bitcoin nodes.
Leave the “bitcoin.conf” file open in the terminal and open a web browser. Visit the Tor node page at Bitnodes.io and scroll down to the list of active Tor nodes. Select any onion address from the list.
(26/5/2023 Note): Bitnodes has recently started blocking the IP addresses of many VPN providers. If you encounter difficulties accessing the above link, either disable your VPN or access the link using a Tor browser.
Copy the address and port number, then returning to your terminal, paste it at the bottom of the conf file. As shown in the example below, you need to start the line with the “addnode=” prefix.
Save and exit the conf file, then reboot the node.
After a minute or so, SSH back into the node. You need to check that your node is successfully connecting to peers. Run the following command several times until you see four or five connected peers.
You may now remove the node that you added manually. Open your “bitcoin.conf” file and delete the “addnode=” line using “control+k“, then save and exit.
Next, restart the CLI and, after a minute, check that you are still connecting to other Tor nodes.
sudo systemctl restart bitcoind
Finally, you need to confirm that network traffic only passes through Tor. Use the following command and ensure that the output shows a “reachable false” status for both “IPV4” and “IPV6“. You also want to confirm that “onion” shows a “reachable true” status.
The output of this command also displays your Bitcoin Core onion address. This is useful for services requiring a direct connection to Core, such as the Bisq application. You can also make a specific request for your onion address with the following command.
bitcoin-cli getnetworkinfo | grep address.*onion
Congratulations if you have made it this far; you now have a fully synchronised Bitcoin Core installation configured with Tor.
In the next article, we will be installing the Fulcrum indexer.