Setup Bitcoin Node

Setup Current Bitcoin Core Node

This guide will walk you through setting up a Bitcoin node by compiling the software from source. This method ensures you have the latest version and allows for customization.

Clone the repository and automatically checkout the latest release

git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
git checkout `git describe --tags $(git rev-list --tags --max-count=1)`

Install dependencies

For Ubuntu/Debian:

sudo apt update
sudo apt install -y build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libminiupnpc-dev libzmq3-dev libqrencode-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler

Choose compilation method

You have two options for compiling: using system-wide shared libraries or compiling dependencies yourself.

Option 1: Using system-wide shared libraries
./autogen.sh
./configure
make -j$(nproc)
Option 2: Compiling dependencies (more control, longer build time)
cd depends
make -j$(nproc)
cd ..
./autogen.sh
cmake -B build --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake

Install the software

sudo make install

Create Bitcoin configuration

mkdir -p ~/.bitcoin
cat <<EOF > ~/.bitcoin/bitcoin.conf
server=1
txindex=1
EOF

Start the Bitcoin daemon

bitcoind -daemon

Verify the node is running (it will take a bit to start up)

bitcoin-cli getblockchaininfo

Monitor the debug log

tail -n 10 ~/.bitcoin/debug.log

This setup process will compile and install a Bitcoin node from source. For Bitcoin forks, the process is similar, but you'll need to clone the specific fork's repository and may need to adjust some of the dependency names or configuration options based on the fork's requirements.

Remember to secure your node by setting up a firewall and keeping the software updated regularly.