How To Setup a Bitcoin Node Using Source Code [Linux]?
Mục lục bài viết
How To Setup a Bitcoin Node Using Source Code [Linux]?
Bitcoin node helps for bitcoin development or backend services.
Bitcoin is the most popular cryptocurrency and its price is continuously grown up in 2020. Many developers are looking for a guide to set up a bitcoin node. I heard the word bitcoin first time in 2016 and I have worked on blockchain development for more than the last two years. Bitcoin code is written in C++
. We need to compile a code (if you want to do some changes to the code you can do it) then setup the node. So let’s look at the steps with a fresh operating system. I am dividing this article into two parts. The first part is to compile the source code and the second part is for setup the node.
Photo by André François McKenzie on Unsplash
If you want to set up only a node then you can skip the source code compilation process and download the bitcoin executable files directly from here. Extract the file and check bin folder.
Part 1: Source Code Compilation Guide
Step 1.
Update all the repositories apt-get update -y
and download the latest bitcoin code. you can get all the releases from here.
wget https://github.com/bitcoin/bitcoin/archive/v0.20.1.tar.gz
(If wget command not found then apt-get install wget -y
)
Step 2.
Extract the file tar -xvzf v0.20.1.tar.gz
Install some helper libraries
- AutoConf
apt-get install autoconf -y
- Libtool
apt-get install -y libtool
- G++
apt-get install g++ -y
- Package Config
apt-get install pkg-config -y
- All Dev
apt-get install libboost-all-dev -y
- LibDB Package
apt-get install libdb++-dev -y
- Utils
apt-get install bsdmainutils -y
- Essential for make
apt-get install build-essential -y
Step 3.
We are ready to compile the code. Go into the extracted directory (bitcoin-0.20.1) and execute the command ./autogen.sh
If everything goes good then you will see the output like this.
root@05664050921e:~/bitcoin-0.20.1# ./autogen.sh
Llibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build-aux/m4'.
libtoolize: copying file 'build-aux/m4/libtool.m4'
libtoolize: copying file 'build-aux/m4/ltoptions.m4'
etc...
Step 4.
Configure the project with incompatible DB version because it required only 4.8 version and we don’t need to track the dependency.
./configure --with-incompatible-bdb --disable-dependency-tracking
Step 5.
Now we are ready to make the executable files using the make
command. It will take time about an hour so don’t worry about that.
[Optional] You can run this command in the background using the article.
After successfully execute the make command then you can check in the src folder there are some executable files created.
## These files are
1. bitcoind
2. bitcoin-cli
3. bitcoin-tx
4. bitcoin-wallet
Congratulations !! You have compiled the bitcoin code, now a new journey started to setup the bitcoin node.