How to Setup and Run a Bitcoin Full Node on Ubuntu
If you are a Bitcoin developer or want to start Bitcoin mining, then you would need to install a Bitcoin full node.
Minimum Hardware Requirements
It is recommended to have a good hardware (or VPS) to run a full node. You may run on a weak hardware, but you will end up having issues.
Disk space: 400GB accessible at a minimum read/write speed of 100 MB/s. Note that the blockchain size is dynamically increasing.
Memory (RAM): 2GB
CPU: 2 cores
Internet: A broadband stable Internet connection with upload speeds of at least 400 kilobits (50 kilobytes) per second. Download usage is around 20 gigabytes a month, plus around an additional 340 gigabytes the first time you start your node.
Install Required Libraries
You must install BerkleyDB version 4.8. If you get an error when running the following command, then keep reading.
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev
If you upgraded your Ubuntu to 20.04 or higher and tried to run the above commands you may get an error, because Bitcoin PPA has not released libdb-4.8 for Focal Fossa (Ubuntu 20.04) yet. If this is a case then you need to install libdb-4.8 from the source code.
wget http://download.oracle.com/berkeley-db/db-4.8.30.zip
unzip db-4.8.30.zip
cd db-4.8.30
If you try to compile now you will get an error. Let’s bypass the bug by running the following command:
sed -i 's/__atomic_compare_exchange/__atomic_compare_exchange_db/g' dbinc/atomic.h
The above basically opens the dbinc/atomic.h file and changes all the __atomic_compare_exchange appearances to __atomic_compare_exchange_db
If the sed command doesn’t work for you then you can do it manually.
Now, run the following commands to build the library.
cd build_unix/
../dist/configure --prefix=/usr/local --enable-cxx
make
sudo make install
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
Now, run the following commands to install the required libraries
sudo apt-get install libboost-all-dev libzmq3-dev libminiupnpc-dev
sudo apt-get install curl git build-essential libtool autotools-dev
sudo apt-get install automake pkg-config bsdmainutils python3
sudo apt-get install software-properties-common libssl-dev libevent-dev
Install Bitcoin Full Node
Download the Bitcoin source code, compile and install it by running the following commands:
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
./autogen.sh
./configure
make
cd src
sudo install -sv bitcoind bitcoin-cli /usr/local/bin/
Create a Bitcoin configuration file and provide a username and a password.
mkdir ~/.bitcoin
vim $HOME/.bitcoin/bitcoin.conf
Provide your RPC username and password
rpcuser=yourusername
rpcpassword=yourpassword
Run Bitcoin Full Node
Start the Bitcoin node daemon using the following command:
bitcoind --daemon
Wait for the synchronization of the blockchain to end. It might take days or weeks.
Use the following command to verify the status of the blockchain synchronization:
tail -f ~/.bitcoin/debug.log
Here is a list of useful commands:
bitcoin-cli -getinfo
bitcoin-cli getblockchaininfo
bitcoin-cli getnetworkinfo
bitcoin-cli getpeerinfo
Happy Bitcoin Mining!
Join the r/zerowallstreet Reddit community for discussions on investment, business, and financial market topics.