Visitar URL original
universalbit-dev/blockchain/bitcoin at main · universalbit-dev/universalbit-dev · GitHub
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

readme.md

Blockchain | Bitcoin Node Setup Guide

Bitcoin Litecoin TestNet

Table of Contents

  1. Introduction
  2. Prerequisites
  3. Installation Steps
  4. Bitcoin Node Configuration
  5. Using PM2 to Manage Processes
  6. Additional Resources
  7. Support and Contributions

Introduction

This guide explains how to set up a Bitcoin Full Node using minimal disk space (pruned node) and manage it with the PM2 Process Manager. It is part of the UniversalBit ecosystem and includes steps for setting up the node, configuring it, and running it efficiently.

Blockchain Stack


Prerequisites

Before proceeding, ensure you have the following:

  • A Linux-based operating system.
  • Basic knowledge of command-line tools.
  • Installed software:
    • Node.js (Version 24 recommended, install using nvm):
      # Install nvm if not already installed
      curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
      # Load nvm (restart shell or run the following)
      export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
      [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
      # Install Node.js 24
      nvm install 24
      nvm use 24
      nvm alias default 24

Installation Steps

Step 1: Clone the Repository

cd /home/$USER
git clone https://github.com/universalbit-dev/universalbit-dev.git

Step 2: Install the Latest Bitcoin Full Node

[Download and install the Bitcoin Full Node]

curl https://bitnodes.io/install-full-node.sh | sh

Bitcoin Node Configuration

Minimal Disk Space Configuration (Pruned Node)

Copy the Bitcoin configuration file:

Note: Summary of bitcoin.conf Configuration This bitcoin.conf file configures a lightweight Bitcoin node for testnet operation with limited resource usage:

  • prune=550: Enables blockchain pruning, keeping disk usage low by only storing recent blocks (here, up to ~550 MB).
  • maxconnections=8: Limits the maximum number of peer connections to 8, reducing network resource requirements.
  • listen=0: Disables listening for incoming connections, making this a non-public, outbound-only node.
  • maxuploadtarget=144: Restricts data uploaded to peers each day to 144 MB (helpful for bandwidth limitation).
  • checkblocks=1/checklevel=0: Minimal blockchain verification for faster, lightweight startup and operation.
  • txindex=0: Disables full transaction indexing, reducing storage and indexing needs.
  • testnet=1: Runs the node on the Bitcoin testnet, not on the main Bitcoin blockchain—useful for development and testing purposes.

This setup is ideal for a resource-constrained environment, development, or testing without maintaining a full blockchain or publicly accessible node.

    cp bitcoin.conf /home/$USER/.bitcoin/

Copy the bitcoind binary to the project directory:

    cp /home/$USER/bitcoin-core/bin/bitcoind /home/$USER/universalbit-dev/blockchain/bitcoin/

Resources:

Bitcoin-Core || Litecoin-Core


Install Node.js Dependencies

Navigate to the project directory and install the required Node.js dependencies:

cd /home/$USER/universalbit-dev/blockchain/bitcoin
npm i && npm audit fix && npm i pm2 -g

Using PM2 to Manage Processes

Start Bitcoin Node with PM2

Start the Bitcoin Node using the PM2 process manager:

pm2 start btc_pruned.js

PM2 Startup Script

Generate startup scripts using the PM2 Startup Script Generator to ensure the process list is preserved across machine restarts.

PM2 Startup Script


Relevant Resources

Additional Resources

Here are some helpful links and resources to enhance your setup and understanding of Bitcoin mining:


Support and Contributions

  • Support the UniversalBit Project: Support Page
  • For questions or contributions, feel free to open an issue or submit a pull request.