How to install a pruned Bitcoin full node on Ubuntu VPS
Tags: Linux, Bitcoin, Vps, Crypto, Node

If you want to run a Bitcoin full node to use bitcoin-cli or support the Bitcoin network, you don't need to setup and maintain a physical server, old computer or Raspberry Pi, with associated hardware, electricity and bandwidth costs. While it is ideal to run a Bitcoin full node on physical hardware with a full copy of the blockchain, you can also run a pruned Bitcoin full node on a regular VPS (OpenVZ/LXC/KVM, 1 GB RAM, 1 vCPU, 10 GB storage is enough).

If you don’t already have a VPS, LavaVPS (https://www.lavavps.lt/) is based in Lithuania, sells OpenVZ VPS from $2/month with unlimited bandwidth, and accepts Bitcoin and other cryptocurrencies. Noez (https://nas.noez.io/) is based in Germany, sells LXC, OpenVZ and KVM VPS from $1.50/month with fair-use bandwidth, and accepts Bitcoin.

This guide focuses on Ubuntu VPS, but you can install a Bitcoin full node on any Linux VPS. Check here for more information: https://bitcoin.org/en/full-node

1) Secure your VPS

Before you install your Bitcoin full node, make sure to secure your VPS. You can find a guide here: https://www.digitalocean.com/community/tutorials/an-introduction-to-securing-your-linux-vps Most important parts are to update your server regularly with sudo apt-get update && sudo apt-get upgrade , set ufw firewall and harden ssh .

2) Add Bitcoin PPA

If you use Ubuntu, you don’t need to compile bitcoind and bitcoin-cli from source. You can simply add the official Bitcoin PPA.

sudo apt-get install software-properties-common

sudo apt-add-repository ppa:bitcoin/bitcoin

sudo apt-get update

sudo apt-get install bitcoind

3) Create user for Bitcoin and login

sudo adduser bitcoin

su - bitcoin

4) Add bitcoin.conf file

cd ~

mkdir .bitcoin

nano .bitcoin/bitcoin.conf

Paste the following text:

prune=550

If you have less than 2 GB RAM, use these options instead:

prune=550

minrelaytxfee=0.00005

limitfreerelay=0

dbcache=50

maxmempool=100

maxorphantx=10

The prune=550 option will ensure that bitcoind doesn't try to save the entire 250+ GB blockchain to disk and instead prunes it as it downloads. This means that your blockchain file will be less than 1 GB. chainstate will additionally write around 5 GB to disk. Your VPS will still need to download the entire blockchain, even if it doesn't save it to disk, so make sure you have enough bandwidth.

The remaining options save RAM by limiting mempool size and requiring a fee of more than 0.00005 BTC (around $0.25). With these options, your node should use less than 500 MB RAM. However, it is recommended to allow any tx fees, so if you have more than 2 GB RAM, feel free to only keep prune=550 .

5) Start bitcoind and wait for blockchain sync

nohup bitcoind &

Depending on your VPS's internet speed, it may take 12-72 hours to sync. The first 300k blocks will sync fairly quickly, while the remaining 200k blocks will take longer to sync. nohup means that the process continues after you log out. & means that the process runs in the background, so you can execute other commands during sync.

To check sync progress, enter:

bitcoin-cli getblockchaininfo

When sync is completed, you will see something like:

"verificationprogress": 0.99998765

verificationprogress doesnt need to reach 1.0000 , a value close to 0.9999 is already synced.

6) Use and monitor your full node

Now your full node can relay transactions and you can use bitcoin-cli s features. You can also create and encrypt a Bitcoin wallet, but due to security reasons, it is advised to not store a large amount on your VPS and instead use a hardware wallet like Trezor or Ledger or a secure paper wallet.

Check RAM usage:

free -h

The available column tells you how much RAM is free.

Check CPU and RAM usage by process:

ps aux --sort=-pcpu,-pmem

Look for bitcoind and you will see how much CPU and RAM it uses.

Check disk usage:

df -h

Check disk usage of Bitcoin:

du -h ~/.bitcoin

You can monitor your full node without logging into your VPS at BitNodes.

Scroll down to "Join the network" and enter your VPS's IP address and Bitcoin port (generally 8333 ):

https://bitnodes.earn.com/

For example, here is my pruned node:

https://bitnodes.earn.com/nodes/149.202.109.58-8333/

Congratulations, your pruned Bitcoin node is now ready to use.

—

If you found this guide useful, feel free to send a contribution to 1CaLCR5mGwS4FJzU1HZm9qwr5WoRYFDdyB (BTC).

—

This article was originally published in the Web4Crypto Steemit blog. Web4Crypto offers web development, web design, programming and scripting services from $40 and accepts Bitcoin, Monero, Ethereum and other cryptos. Visit https://web4crypto.xyz for more information and a free consultation.