My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

How to Compile Bitcoin GUI on Ubuntu 20.04 (Linux)

Shashwat Vangani's photo
Shashwat Vangani
·Aug 31, 2021·

4 min read

How to Compile Bitcoin GUI on Ubuntu 20.04 (Linux)

Introduction

As I began my journey with the world of bitcoin, the first challenge at my hand was knowing how to get the work environment set up. The problem was that it was tough to find some source for it. I could find some scrapes of questions related to the topic, but nothing that could help me move forward. Then, finally, I asked my mentor, Mr. Jarol Rodriguez for some help, and he hinted me to the right approach, and that was what I needed to connect all the dots and get my environment set upped. Let me help the readers simplify their setting-up journey by sharing what I have learned about getting started.

Installing git

So, our first task is to clone the Bitcoin-GUI repository. If you guys don’t know what cloning a repository means or want to freshen up your memory. You can check the documentation here. But in brief, it simply means to get a copy of the code or software on your local desktop. So to clone the bitcoin repository, we have first to make sure that we have git installed in our local system.

To check if git is installed, type the following command in the terminal.

git --version

Suppose the output shows a Git version; you already have git installed on your Linux machine. Otherwise, you will get a result something like this:

-bash: git: command not found

To install Git on Ubuntu or Debian, enter the following two commands:

sudo apt update
sudo apt install git

Cloning the Bitcoin GUI repository

After successfully installing git, let’s move on to cloning the bitcoin-GUI repository. To clone GUI, first move to the folder where you want to clone the repository using the cd command.

cd path/to/folder

After reaching the desired location type:

git clone https://github.com/bitcoin-core/gui.git

This will create a folder named gui inside your working directory. Before compiling, let us make sure all the dependencies required to collect bitcoin-core are installed. Download the following dependencies:

sudo apt-get install build-essential libtool
autotools-dev automake pkg-config bsdmainutils python3
libssl-dev libevent-dev libboost-system-dev
libboost-filesystem-dev libboost-chrono-dev
libboost-test-dev libboost-thread-dev libminiupnpc-dev
libzmq3-dev libqt5gui5 libqt5core5a libqt5dbus5
qttools5-dev qttools5-dev-tools libprotobuf-dev
protobuf-compiler git libsqlite3-dev ccache

After downloading dependencies, it is time to compiling bitcoin-core. Move to the gui folder.

cd gui

Compiling Bitcoin core:

Note: Installing Berkeley DB is optional and can be skipped in most of the scenarios; if you still want to install Berkeley DB v4.8, follow the following steps:

INSTALL Berkeley DB (Optional)

Type the following command. Take Note of the instructions that are presented in the terminal when the installation is complete.

./contrib/install_db4.sh

Replace the <PATH-TO> in the following command with the path specified at the end of the db4 installation above.

export BDB_PREFIX='<PATH-TO>/db4'

Now finally, to compile the bitcoin core. Type:

./autogen.sh
./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8"
BDB_CFLAGS="-I${BDB_PREFIX}/include"

Compiling without Berkeley DB

For those who chose to compile the Bitcoin GUI without installing Berkeley DB, simply write:

./autogen.sh
./configure --without-bdb

Make

Now to the final command. The next command will start the bitcoin-core compiling. It might take some time, so please be patient. Note, if your computer is not very powerful, remove -j "$(($(nproc)+1))" from the following command.

make -j "$(($(nproc)+1))"

Now it’s time to run the Bitcoin-GUI. The following command will start it over the signet network, which is the least size consuming, so it will not burden your PC with loads of size bandwidth.

./src/qt/bitcoin-qt -chain=signet

If you wish to run the Bitcoin GUI on a different network, replace the signet with their name in the above command. Remove the -chain command to run it on the mainnet. Be cautious before running the mainnet as it is large and may consume a lot of your PC space.

Conclusion

And that’s it. Hopefully, you might see bitcoin GUI opened in front of you. If the above steps felt overwhelming to you, don’t worry. With enough repetitions, these steps will become like second nature to you. Enjoy playing with GUI, but be careful with the main net as you might lose your actual bitcoins.

In the next blog post, I shall discuss how to go about reviewing a PR on the BItcoin GUI repository.