How to run a BTC full node in 3 steps (beginner friendly)

How to run a BTC full node in 3 steps (beginner friendly)

2019 edition

I know I just said this article is beginner friendly, and although I will try my best to break it down step by step, running a bitcoin node is inherently technical. If you don’t understand some of the terms used in this article, please take your time, google them, and understand them before moving on. That being said, if you’re here because you think bitcoin is cool and you want to help the network or just want to learn more, welcome! Glad you’re with us. Feel free to hit me up on twitter if you have any questions.

I don’t recommend running a bitcoin node on your home computer, since it uses a lot of bandwidth, memory, and hard drive space that you’ll probably want to use for other things. Personally, I like online.net, but you can google and pick whatever VPS or server provider you like. Bitcoin.org recommends a server with at least 2GB of RAM, at least 200GB of hard drive space, and without a bandwidth limit due to the amount of traffic a bitcoin node uses. Right now, my node uses:
~500MB RAM
~275GB hard drive space
~25GB of data downloaded per week
~250GB of data uploaded per week
Based on these stats, I recommend a VPS/server provider that can comfortably manage that without breaking your wallet. If you don’t want to use a remotely managed server, you can always buy your own hardware that meets those requirements (but don’t forget it will be using your internet connection and the amount of traffic the node uses could slow it down drastically, depending on your speeds).
Also, I want to note here that I don’t recommend storing any amount of bitcoin on a remotely managed server. Following this guide is strictly to help the bitcoin network (or learn about how bitcoin nodes work). If you’re looking for a secure way to store bitcoin, I recommend a hardware wallet.

Your server provider should have a tutorial on how to set up your server (here’s online.net’s), but just in case it doesn’t, or if you don’t want to read all that shit, there’s a couple things you need to do to make sure your node is set up correctly.
First, set up your server with the Ubuntu OS. Most server providers will allow you to pick whatever OS you want to install when you set up your server, so that should be fairly straightforward. When setting up your accounts, I recommend using a password generator such as LastPass to make long, complex passwords.
Second, connect to your server using ssh. If you’re on windows, I recommend using MobaXterm. If you’re on Mac, you can connect to your server through Terminal. If you’re on linux, you probably already know how to do all this, so feel free to skip ahead.
On MobaXterm, you’ll want to click Session -> ssh, then fill in the IP address that your server provider gave you. When you click ok, you’ll be prompted for the username and password that you set up.
On Mac, type “ssh username.you.setup@your.servers.ip.address” and hit enter. Fill in your password.
Once you’re connected, you should see a line that says something like “username@server.name:~#”. Although I strongly encourage reading about how linux command line works (for example, you can run “man ssh” to get information about how ssh works), you can set up your server by copying and pasting the following commands (root’s password should be an admin password you set up):

su root
useradd -m BTC
su BTC
passwd
exit
add-apt-repository ppa:luke-jr/bitcoincore
apt -y update
apt -y upgrade
apt -y install BTCd
su BTC
cd /home/bitcoin

Essentially, what you are doing here is creating the bitcoin user account, so that way the bitcoin process only runs as the bitcoin user (for security reasons). Then, you update your system and install the BTCd process, and switch to the bitcoin user in order to run it.

bitcoind -daemon

That’s it! Congratulations, you are now running a bitcoin node. It will take quite a while for the entire blockchain to download and validate, so sit back, relax, and come back in a day or so. To check the status of your bitcoin node, you can run commands like the following:

ps -U BTC #see if the BTCd process is running
netstat -ntp #see the network connections to your node
top #see how many resources the BTCd process is using

In addition to those system commands, BTCd comes with bitcoin-cli, which has a suite of commands you can use to get information about your node, such as:

bitcoin-cli -getinfo
bitcoin-cli getnetworkinfo
bitcoin-cli help

Lastly, you can run

tail -f /home/bitcoin/.bitcoin/debug.log

to watch your node update, or watch blocks roll in as they’re mined. Once your bitcoin node is up to date, you can check to see if the network can see it by going to Bitnodes and putting in your node’s IP address.

Thanks for reading! Like I said earlier, feel free to hit me up on twitter if you have any questions.

Also, here’s a couple more tweaks you might be interested in:

Security

You can increase your security by configuring your sshd to only accept public key authentication rather than password authentication. I also recommend changing your sshd_config so that only your user account can log in (and not your root or bitcoin accounts).

You can install Fail2Ban to block malicious connections after a certain number of failed login attempts.

Monitoring

gtop

You can install the coolest command line system monitor tool, gtop, or any other system monitoring tool you like.

Published at Mon, 04 Nov 2019 23:21:58 +0000

{flickr|100|campaign}

Spread the word. Share this post!