Categories: Blockchain

How to Install Bitcoin full node on Ubuntu Server?

In this how to tutorial, Let’s see how to install Bitcoin daemon full node wallet on a Ubuntu server.

Basic Requirements for bitcoin installation on ubuntu server:

  1. Minimum OS required – Ubuntu 16.04 OS
  2. Space required – minimum 400 GB. SSD hard disk recommended.
  3. RAM – Minimum 4GB ram server is required.

1. Install Apache

Make sure you have installed Apache or nginx on your server before starting with the installation. Type the below commands to install Apache on ubuntu server:

sudo apt-get update
sudo apt-get install apache2

You will be requested to enter Y/N. Type Y to proceed with the installation

2. Installing Bitcoin Blockchain

Download PPA repository by running the below command from home/root directory (Type cd ~ )

sudo add-apt-repository ppa:luke-jr/bitcoincore

When prompted, click ENTER key to proceed with the installation.

sudo apt-get update
sudo apt-get install bitcoind

When prompted, type Y to proceed with the installation.

3. Setting up Bitcoin Configuration

A. Creating .bitcoin folder in root directory.

Run the following command to check if you are in the root directory:

cd ~

Then run the following command to create the .bitcoin directory. For starters: mkdir stands for make directory. And and dot folder means it is a hidden folder. You can not view the folder normally with ls command and you need to use ls-a command to view the hidden folder.

mkdir .bitcoin

change or move into the newly created directory using the below command:

cd .bitcoin

B. Setting config file

Creating the config file. In this tutorial i am using nano editor in ubuntu. You can also use vi editor if you wish. Run the below command to create the file:

sudo nano bitcoin.conf

You will see an editor like in the below screenshot:

Copy the below configuration and paste it in the text editor:

server=1
rpcport=18523
rpcallowip=ip_address_of_your_external_application/0
rpcuser=yokesh_explains
testnet=1
rpcpassword=32_character_alphanumeric_string

and click ctrl+X. Prompt will ask you to save and exit. Type Y and hit enter. Your configuration file is saved now.

Let’s see about these configurations now.

  1. Server = 1 or 0 means -> Bitcoin server to accept JSON-RPC command or Not. 1 Stands for accepting.
  2. rpcport -> This is the tcp port which we setup for allowing rpc connections
  3. rpcuser -> An username will be required to setup for accessing the JSON-RPC Apis.
  4. rpcpassword -> Similarly a password will be required to setup for accessing the JSON-RPC Apis. The RPC Password can be any random alphanumeric number. 32 character is recommend for security purposes. You can generate one from HERE.
  5. testnet=1 -> If enabled as 1, the bitcoin network will access the bitcoin testnet network. If entered as 0 or if the config is removed, by default the bitcoind will connect to the mainnet. Connecting to bitcoin testnet will be helpful for testing purposes.

There are more configurations which you can do. Lets see more in detail about it in upcoming articles.

C. Setting up Firewall

Run the below commands to open the required ports and to turn on ubuntu default firewall.

Enabling SSH port with Firewall –

sudo ufw allow 22

Enabling HTTP port with Firewall –

sudo ufw allow 80

Enabling HTTPS port with Firewall –

sudo ufw allow 443

Enabling our RPC port with Firewall. make sure you give the same port number as you have given in conf file.

sudo ufw allow 18523

Finally enable Firewall –

sudo ufw enable

D. Configuring Cron

Run the below command to make sure bitcoind continues to run when server is restarted:

sudo crontab -e

Type 1 and hit enter. Next in the editor goto the last and paste it in a new line.

@reboot bitcoind -daemon

Finally the setup is now done. Lets start the bitcoin server and access the wallets.

4. Starting Bitcoin Blockchain

Run the below daemon command to initialize bitcoin blockchain in background:

bitcoind -daemon

We will have to wait for the blockchain to complete downloading and sync with the current block to send and receive transactions. The blocks and headers number will be equal in numbers when the blockchain is downloaded and in sync.

Use the below JSON-RPC commands to interact with the bitcoin blockchain:

  1. bitcoin-cli getblockchaininfo -> Gives complete detail of the blockchain status
  2. bitcoin-cli getwalletinfo -> Gives complete detail of the wallet – balance etc.
  3. bitcoin-cli getnewaddress -> Creates a new address.

Complete of bitcoin-cli commands can be found from HERE

Note that when you do getblockchaininfo, you see that the blocks and headers are not in sync initially

Alright! You are all ready now. You have successfully completed bitcoin installation on ubuntu server successfully. Let me know in comments if you face any issue in the above steps.

Yokesh Sankar

Technical Consultant - Blockchain Advisor - Project Manager

Recent Posts

Enhancing Supply Chain Management with Cross-Chain Communication: A Blockchain Revolution

Introduction In spite of the modernity advancements, supply chain control remains intricate but imperative in…

5 months ago

Ethereum EIP-4844 Explained

EIP-4844 suggests a new way to handle transactions on Ethereum so that it can scale…

5 months ago

7 Leading Real Estate Tokenization Development companies

The industry is experiencing a significant change as a result of the tokenization of real…

5 months ago

BRC20 Token Development: A Complete Guide

What is BRC20 Token? Domo, a confidential inventor, introduced BRC-20 tokens to the open on…

5 months ago

Zero-Knowledge Proof (ZKP) Technology: A Ultimate Guide

What is Zero-Knowledge Proof (ZKP-TECH) Confidence in zero knowledge proof is necessary between two individuals.…

6 months ago

Digital technologies for real estate Industry in 2024

By implementing over 1000 projects, software development became an expert field for Sparkout tech. We…

6 months ago