• WealthMinds.Tech
  • Posts
  • Ultimate Guide 2024: Setting Up a Secure Bitcoin Core Node for Private Transactions on Linux

Ultimate Guide 2024: Setting Up a Secure Bitcoin Core Node for Private Transactions on Linux

Learn How to Set Up and Run a Secure Bitcoin Core Node on Linux: Enhance Your Privacy, Security, and Control Over Bitcoin Transactions in 2024

< README.md />

Hey Engineers! In today’s issue, we’re exploring why cookies can be considered more secure for certain use cases and explore their various attributes that enhance security.

Today’s content:

> Dev Byte: Key Terms for Secure Bitcoin Node Setup
> Article: Ultimate Guide 2024: Setting Up a Secure Bitcoin Core Node for Private Transactions on Linux
> Mindset and Motivation: Become A Millionaire Without Hard Work

Let’s go!

< DEV BYTE />
Applications & Packages

With a focus on security, privacy, and usability, you can explore the applications and packages discussed in this article:

<DEV BYTE STORY/>
Ultimate Guide 2024: Setting Up a Secure Bitcoin Core Node for Private Transactions on Linux

Setting up and running my own Bitcoin Core node has been a rejuvenating experience. It's not every day you have the chance to start on a barebone OS and fight through all the configuration problems. By controlling your own Bitcoin node, not only do you gain enhanced privacy and security, but you also have complete control over your Bitcoin transactions. In this article, I’ll walk you through my steps to set up a secure server, install Bitcoin Core, and connect it with Sparrow Wallet. By the end, you’ll be well-equipped to enjoy the benefits of running your own Bitcoin node.

Why Run your own Bitcoin Node?

Creating your own Bitcoin node is a crucial step in preserving the trustless nature of the Bitcoin network. By running your own node, you eliminate the need to rely on third parties, such as financial institutions or external servers, to verify your transactions. This level of independence enhances your privacy and security, as your transaction data and wallet queries remain confidential and are not exposed to external entities. Your Bitcoin node acts as a personal validator, independently confirming that received payments are genuine and adhere to Bitcoin's consensus rules.

Moreover, running a node significantly contributes to the decentralization and robustness of the Bitcoin network. Each node helps propagate transactions and blocks, increasing the network's resilience against attacks and censorship. Below I’ll explain the setup on Linux to give you full control over your Bitcoin interactions, enabling custom configurations and ensuring data sovereignty.

Setting Up a Secure Server with Debian

I chose Debian for this server because I also plan to emulate the capabilities of my Raspberry Pi, with this setup, my server can be configured to control other processes like running Pihole, and Homebridge.

Update and Upgrade System Packages:

Keeping your system updated is crucial for security and performance. The first thing I did was ensure my server was fully up-to-date. This step is important because outdated software can have vulnerabilities that attackers could exploit.

I ran the following commands to update and upgrade my system packages:

sudo apt update && sudo apt upgrade -y

Install and Configure UFW (Uncomplicated Firewall):

UFW is a user-friendly way to manage firewall rules. A properly configured firewall is essential to block unauthorized access to your server. Without it, your server could be vulnerable to attacks.

To install UFW, run the command:

sudo apt install ufw -y

Firewall and Network Isolation

Now we must set our firewall to protect against unauthorized access. Securing our node involves creating network isolation and configuring the firewall. After installing UFW, we can configure it to allow only the necessary ports and deny all others.

To limit the points of entry to your server set the following ufw settings:

sudo ufw allow OpenSSH
sudo ufw allow 8333/tcp  # Bitcoin Core default port
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable

Disable Root Login via SSH:

Next up let’s disable root login via SSH, As a security best practice this reduces the risk of brute-force attacks aimed at the root account. To do this, I edited the SSH configuration file:

sudo nano /etc/ssh/sshd_config

And set, PermitRootLogin to no . Now, restart the SSH service to apply the changes:

sudo systemctl restart ssh

Create a Non-Root User with Sudo Privileges:

Using a non-root user for everyday tasks adds an extra layer of security. If this account is compromised, the attacker won't gain full control over our server.

Add a new user and grant sudo privileges with the following commands:

sudo adduser newuser
sudo usermod -aG sudo newuser

Install Fail2ban:

Fail2ban helps protect our server by monitoring logs and banning IPs that show malicious signs, such as too many password failures.

To install Fail2ban:

sudo apt install fail2ban -y

If needed, you can configure Fail2ban to suit your security needs by editing its configuration file:

sudo nano /etc/fail2ban/jail.local

Installing and Configuring Bitcoin Core

Install Bitcoin Core:

Bitcoin Core is the reference implementation of Bitcoin. Running your own node allows you to verify transactions independently and maintain privacy by not relying on third-party services.

Minimum Requirements

Bitcoin Core full nodes have specific requirements. Running a node on weak hardware may work, but you’ll likely face more issues. Meeting the following requirements ensures an easy-to-use node.

  • Desktop or laptop hardware running recent versions of Windows, Mac OS X, or Linux.

  • 7 GB of free disk space, accessible at a minimum read/write speed of 100 MB/s.

  • 2 gigabytes of memory (RAM)

  • A broadband Internet connection with upload speeds of at least 400 kilobits (50 kilobytes) per second

Assuming your server meets the minimum requirements we can install Bitcoin Core. You can install Bitcoin Core, by navigating to the Bitcoin Core download page and installing the app for your OS. or, use the terminal command below.

At the time of writing Bitcoin Core version is 27.0. Ensure you download the latest version from a reputable source. I recommend you only download it from bitcoin.org

wget https://bitcoin.org/bin/bitcoin-core-27.0/bitcoin-27.0-x86_64-linux-gnu.tar.gz
   tar -xvf bitcoin-27.0-x86_64-linux-gnu.tar.gz
   sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-27.0/bin/*

Configure Bitcoin Core:

With Bitcoin Core installed; configuration is necessary to make sure Bitcoin Core runs with the desired settings. The configuration file bitcoin.conf includes parameters that control how Bitcoin Core operates.

I edited the bitcoin.conf file:

sudo nano /etc/bitcoin/bitcoin.conf

Here’s an example configuration I used:

server=1
daemon=1
txindex=1
rpcuser=yourusername
rpcpassword=yourpassword

Start and Verify Bitcoin Core:

bitcoind -daemon

To ensure everything was working correctly, I checked its status:

bitcoin-cli getblockchaininfo

Bitcoin Core has to sync the entire node to ensure that it has a complete and accurate copy of the Bitcoin blockchain. This process involves downloading and verifying all past transactions and blocks from the network, starting from the very first block (the genesis block) up to the current block.

This full sync allows the node to participate in the decentralized network, validating new transactions and blocks, and relaying them to other nodes.

Networking and Security

Network Isolation:

For additional security, I set up a separate network. aka VLAN to isolate my Bitcoin node from other network activities. This reduces the risk of other networked devices compromising the node.

VPN and Privacy

Using a VPN provides an extra layer of privacy by encrypting your internet traffic and masking your IP address. This step helps protect your node from being easily targeted. I highly recommend Private Internet Access.

Set Up a VPN:

I used OpenVPN to set up a VPN, by running the following commands:

sudo apt install openvpn

Download the PIA OpenVPN configuration by entering the following command:

sudo wget https://www.privateinternetaccess.com/openvpn/openvpn.zip

Now, unzip and extract the openvpn.zip by entering this command:

sudo unzip openvpn.zip

This will create a new folder with individual OpenVPN configuration files for each VPN server in it.

Connect to an OpenVPN server with the command (for example, “sudo openvpn us_atlanta.ovpn”):

sudo openvpn config-filename-goes-here.ovpn

Enter your PIA username and password to connect to your chosen server.

Connecting Sparrow Wallet to Bitcoin Core

What is Sparrow Bitcoin Wallet?

Sparrow is a Bitcoin wallet designed for people who prioritize financial independence. Sparrow focuses on security, privacy, and user-friendliness. It offers all the usual features of a modern Bitcoin wallet and ensures that you have access to all relevant information without hiding anything. Moreover, Sparrow strives to provide detailed insights into your transactions and UTXOs in a manageable and user-friendly manner.

Due to private concerns, it is not advisable to use Sparrow with a public server if you plan to store any significant funds. that is why we set up a private Bitcoin Core node.

Sparrow can be downloaded from the Download page.

Connecting Sparrow to Bitcoin Core

If you’ve been following along up to this point your config file bitcoin.conf should be configured properly, assuming your Bitcoin Core node runs on the same server as your Sparrow Wallet.

If your Bitcoin Core is running on a different machine, you will need to ensure that it is configured correctly. You can find more information about this setup here.

Configure Sparrow Wallet:

The good news is that with a local setup and the default configuration, you should be ready to go! Sparrow will connect on localhost (127.0.0.1) using the default port, and authenticate by retrieving the cookie file that Bitcoin Core writes to the data folder every time it starts up. If you have changed the data folder for Bitcoin Core, be sure to select that folder now.

Testing the Connection

Once you have configured Sparrow to match your Bitcoin Core setup, you’re ready to test the connection. Click Test Connection. Sparrow will attempt to connect to Bitcoin Core. If successful, you should see the following:

You can now create a wallet in Sparrow. Select File > New Wallet in the menu.

Congratulations! You have successfully connected Sparrow to your Bitcoin Core node and set up your wallet. You can now be confident that your wallet is private and you’re ready to send and receive Bitcoin.

Wrap Up

Setting up a secure Bitcoin Core node and Sparrow Wallet is not just about enhancing your privacy and security; it's about taking control of your Bitcoin transactions and contributing to the decentralization and resilience of the Bitcoin network.

I hope you’ve found this article a rewarding journey. By following these steps, you are empowering yourself to manage your Bitcoin securely and efficiently. Every step you take towards running your own node strengthens the Bitcoin ecosystem. Together, we can build a more decentralized and secure future.

Stay secure, stay empowered!

< MINDSET AND MOTIVATION />
The Money Expert: Become A Millionaire Without Hard Work!

This episode will teach you everything you would learn in a business degree, saving you $200,000 and 10,000 hours

< CLOSING />
About WealthMinds.Tech Newsletter

My newsletter offers valuable insights and perspectives on the intersection of software engineering and wealth building. From programming insights to wealth-building strategies, as we continue to pioneer technology, build wealth, and ignite minds, I invite you to stay connected with me through my newsletter. Stay tuned for our upcoming edition.

🌐 Pioneering Technology | 💰 Building Wealth | 🔥 Ignite Minds

1 

Reply

or to participate.