The Onist

The Onist


Running a Full Bitcoin Node

A step by step walkthrough on how to setup, sync, and route a fully validating Bitcoin node. Following this setup guide and help the Bitcoin network!

Today I'm going to help the Bitcoin network by setting up and running a full node. I am documenting my setup process in the hopes that maybe a few of you will do the same. In the near future I plan to also blog about setting up and running a Lightning node as well.

What Is A Full Bitcoin Node?

A full node is a program that fully validates transactions and blocks. Almost all full nodes also help the network by accepting transactions and blocks from other full nodes, validating those transactions and blocks, and then relaying them to further full nodes.

Why This Is Important?

Full nodes help enforce the consensus rules of the Bitcoin network. When a full node client is running, it downloads every new block and every new transaction and checks them to make sure they are valid. Here are some examples of consensus rules, though there are many more:

Minimum System Requirements

Bitcoin Core full nodes have certain requirements. If you try running a node on weak hardware, it may work — but you’ll likely spend more time dealing with issues. If you can meet the following requirements, you’ll have an easy-to-use node.

Machine Setup

I will be using a small Lenovo Thinkpad running Ubuntu 17.10.1. A unique challenge with my setup is that the internal HD in my machine is only 32 GB, which is far less than the required ~150GB needed to store the entire blockchain. To work around this I will be storing only the most recent chainstate on the HD itself while storing the rest of the chain on the an external HD. I will cover this setup in more details later.

Before installing Bitcoin Core, it is important to first make sure that your machine has all the latest software updates, security patches, drivers and BIOS installed. Install and updated as needed before proceeding.

Now that your machine is fully up to date, lets download Bitcoin Core and sync with the latest blockchain.

Installing Bitcoin Core and Syncing

First open your console or terminal emulator and run the following commands as an admin level user:

// Add the Bitcoin Personal Package Archive (PPA) to your system
sudo apt-add-repository ppa:bitcoin/bitcoin

// Install both the Bitcoin GUI and the daemon
sudo apt-get install bitcoin-qt bitcoind

Note that even though we installed both the GUI and daemon, you can’t run both at the same time using the same configuration directory.

Next start the Bitcoin Core GUI. You will immediately be prompted to choose a directory to store the blockchain and your wallet. Unless you have a separate partition or drive you want to use, click OK to use the default. Since I do not have enough internal storage on my machine, I chose to download the data to my external drive.

Bitcoin Core Welcome

The Bitcoin Core GUI will now begin to download the block chain. **This step will take at least 16 hours based on your internet connection and computer speed. Also be aware that during the download, Bitcoin Core will use a significant part of your connection bandwidth. Thankfully can stop Bitcoin Core at any time by closing it and it will resume from the point where it stopped the next time you start it.

Bitcoin Core Sync Screen

Autostarting the Bitcoin Daemon (Optional)

Starting your node automatically each time you login to your computer makes it easy for you to always contribute to the network. The easiest way to do this is to tell Bitcoin Core GUI or Daemon to start at login.

Since I will be only be accessing my node via SSH, I will configure my machine to autostart the Daemon only via crontab. To edit crontab, run the following command via your terminal:

crontab -e

Scroll to the bottom of the file displayed and add the following line.

@reboot bitcoind -daemon

Save the file and exit. Now Bitcoin Core daemon will be automatically started each time your reboot your computer.

Network Configuration

To support the Bitcoin network, you must allow inbound connections on port 8333. By default when Bitcoin Core starts, it will establish 8 outbound connections to other full nodes so it can download the latest blocks and transactions. If you just want to use your full node as a wallet only, you don’t need more than these 8 connections—but if you want to support lightweight clients and other full nodes on the network, you must allow inbound connections.

Since almost all home internet connections are filtered by a router or modem and sometimes also a firewall. Bitcoin Core will request your router automatically configure itself to allow inbound connections to Bitcoin’s port, port 8333. Unfortunately many routers don’t allow automatic configuration, so you must manually configure your router. You may also need to configure your firewall to allow inbound connections to port 8333.

Enabling inbound connections requires two steps, plus an extra third step for firewall users:

Let's configure all of this now!

Configuring DHCP

In order for your router to direct incoming port 8333 connections to your computer, it needs to know your computer’s internal IP address. Routers usually assign computers on your network dynamic IP addresses that change frequently, so we need to ensure your router always gives your computer the same internal IP address.

Start by logging into your router’s administration interface. Usually this can be done by going to http://192.168.[0,1 or 2].1 depending upon the brand of your router. Authenticate when prompted and then search the menus for options related to DHCP. These options may also be called "Address Reservation" or "DHCP Resveration".

Once this menu is found, most routers will display a list of computers and devices currently connected to your network, and then let you select a device to make its current IP address permanent. Find the computer running Bitcoin Core in the list, select it, and add it to the list of reserved addresses. Make a note of its current IP address as we’ll use the address in the next section.

DHCP Reservation Screen

Enabling Port Forwarding

For this step, you need to know the local IP address of the computer running Bitcoin Core. You should now have this information from configuring the DHCP reservation table in the previous step. Again from your routers configuration page, look for an option called "Port Forwarding", "Port Assignment" or anything with “Port” in its name.

Both the external port and the internal port should be 8333 for Bitcoin. Make sure the IP address you enter is the same one you configured in the previous subsection.

Port Forwarding Screen

After filling in the details for the mapping, save the entry. If you are not behind a firewall, your bitcoin node should now be fully accessible to the network! To verify your node visit this handy verification page provided by Bitnodes. The tool will attempt to guess your IP address. If the address is wrong or blank, you will need to enter your address manually. Note that your node doesn't have have to be completely synced to verify it's visibility!

After you fill in the field with your IP address, press the "Check Node" button and the tool will inform you whether your port is open (green box) or not open (red box). If you get the green box, congratulations you're all setup. If you get the red box, you either misconfigured your router or are possibly behind a firewall. Verify your DHCP and Port Forwarding configurations and/or view the "Firewall Configuration" section below for help configuring your firewall.

Node Verification Screen

Firewall Configuration

Here are some helpful links for the most common firewalls to allow inbound connections on port 8333.

Configuration Tuning

This section contains advice about how to change your Bitcoin Core configuration to adapt it to your needs.

There are two ways to change your configuration. The first is to start Bitcoin Core with the options you want. For example, if you want to limit it to using one CPU core for signature verification, you can start Bitcoin Core like this:

// Bitcoin Core daemon
bitcoind -par=1 -daemon

// Bitcoin Core GUI
bitcoin-qt -par=1

Once you’ve decided you like your configuration, you can add it to the Bitcoin Core configuration file. You can find that file in the following directories:

To add an option to the configuration file, just remove its leading dash. You may also need to remove any quotation marks you used in your shell. For example, the -par option seen above would look like this in the configuration file:


Reducing Storage

It is possible to configure your node to to run in pruned mode in order to reduce storage requirements. This can reduce the disk usage from over 150GB to around 5GB. Be ware that running a pruned node is incompatible with -txindex and -rescan. It also disables the RPC importwallet. Two RPCs that are available and potentially helpful, however, are importprunedfunds and removeprunedfunds.

To enable block pruning set prune=N on the command line or in bitcoin.conf, where N is the number of MiB to allot for block and undo data. A value of 0 disables pruning entirely.

Reducing Traffic

Depending on the limitations imposed by your household, or more likely, your ISP, you may need to set limits on the amount of bandwidth your node consumes.

By default, bitcoin-core allows up to 125 connections to different peers, 8 of which are outbound. You can therefore, have at most 117 inbound connections. The default settings can result in relatively significant traffic consumption.

Here are some useful configuration commands to help reduce overall traffic to your node:

Note that there are tons of other ways to configure your node to suit your needs but these are some of the most common.

Splitting Blockchain Storage Area

Bitcoin Core normally puts all of its data into one data directory, but oftentimes it is useful to adjust things so that certain of these files go elsewhere. In my case, I need to split storage between my internal HD and external.

Bitcoin Core's overall speed is significantly affected by the random-access speed of the contents of the chainstate directory; if your data directory is located on a magnetic disk, your chainstate access speed will very probably be the biggest performance bottleneck. You can therefore often massively improve performance by moving just the chainstate directory (which is only a few GB) to an SSD drive. Even moving the chainstate directory to a USB flash drive can often provide a large performance improvement, especially if the USB flash drive is advertised as being particularly high-speed.

To move your chainstate, do the following steps in order:


Congratulations you have now improved the overall health, stability and security of the entire Bitcoin network. Be sure to run node as often as possible. Now relax and pour yourself a nice drink! Cheers!

Share Post
View Comments