Bitcoin & Blockchain Programming #003 – Building bitcoind on Linux

By Albert Szmigielski

In this tutorial we will show you how to download and build the bitcoin core reference client on your Linux machine. Let’s get to it.

Required Libraries

Open a terminal and issue the following commands.

This will download and install build requirements.
We will also need boost library development packages

Let’s add the bitcoin repository

Next, we need Berkley DB development libraries

Later on we may want to build the Qt wallet – the GUI version. We will need QT packages for that.

 

GIT and Sourcecode

Make a directory for Bitcoin and your code

When you first start bitcoind it is going to create a .bitcoin directory in your home directory and it will proceed to connect to other peers and download the blockchain. We will be working on the bitcoin testnet (also called testchain) first. So we want to start bitcoind with a testnet directive.

Screenshot - 16-01-29 - 05:20:54 PM

To stop bitcoind we use the command line interface tool called bitcoin-cli

Screenshot - 16-01-29 - 05:22:38 PM

Configuration File

We can specify start-up options for bitcoind, to see all options available type in:

It is probably the easiest to create a file that bitcoind will read from when we start it. Lets create a file called bitcoin.conf and save it in the ~/.bitcoin directory.

The contents of the file should be as follows:

Next time we start bitcoind it will read from the bitcoin.conf file located in the .bitcoin directory and all the options will be set for us. You need to select a user name and password so that later on we can talk to bitcoind via RPC.

Screenshot - 16-01-29 - 05:52:30 PM

You may want to issue some commands to bitcoind just like we did in the screen shot. However bitcoind needs to download the blockchain first, so it may come back with an error. Let it download the blockchain and then you can query the wallet via the bitcoin-cli command.

If all went well you now have Bitcoin Core installed on your machine, and you have bitcoind running in the background. Next we will start looking at commands

 

Leave a Reply

Your email address will not be published. Required fields are marked *