Run a secure Bitcoin Core node with ease.
Copy-paste the following command into Terminal:
sh -c "$(curl -fsSL https://github.com/bitcoin-tools/nodebuilder/raw/v1.10.0/nodebuilder)"
As mentioned above, start the script from the command line. Open Terminal and run:
sh -c "$(curl -fsSL https://github.com/bitcoin-tools/nodebuilder/raw/v1.10.0/nodebuilder)"
Or download the script to your local system, set permissions, and run it:
wget https://github.com/bitcoin-tools/nodebuilder/raw/v1.10.0/nodebuilder
chmod u+x nodebuilder
./nodebuilder
nodebuilder
supports optional arguments to override the default semi-automated settings:
Short | Long Version | Description |
---|---|---|
-b |
--bitcoin-version |
Specify the Bitcoin version. Requires one argument, for example: -b 28.0 |
-c |
--compile |
Build Bitcoin from source. Requires no arguments. |
-h |
--help |
Display the help message. Overrides all other arguments. |
-p |
--prune |
Set a prune value in MiB. Requires one argument, for example: -p 50000 |
-r |
--skip-reboot |
Skip reboot after installing system update. Requires no arguments. |
-s |
--skip-update |
Skip installation of system updates. Requires no arguments. |
-t |
--test |
Run unit tests on functions. |
-u |
--unattended |
Run in non-interactive mode. Requires no arguments. |
You can set multiple options. Here are two ways to compile Bitcoin 28.0 unattended with a 50000 MiB prune:
./nodebuilder -b 28.0 -c -p 50000 -u
./nodebuilder --bitcoin-version 28.0 --compile --prune 50000 --unattended
A nodebuilder Docker container can either run on Ubuntu (default) or on an alternative Linux distribution: Alpine, Amazon, Arch, Clear, Debian, Fedora, Gentoo, Manjaro, openSUSE Leap, openSUSE Tumbleweed, Oracle, Red Hat Enterprise, Rocky, and SUSE Enterprise.
To run the Ubuntu base image, clone the repository and build the default container.
git clone https://github.com/bitcoin-tools/nodebuilder
cd nodebuilder/docker/
docker build .
To use an alternative base image, clone the repository and build a different container. For example, to run nodebuilder on Alpine Linux, run:
docker build -f Dockerfile_alpine .
- An active internet connection
curl
, which the script will attempt to automatically install or you can install with a package manager- A supported operating system
- Any system that can run Docker
- Linux distributions
- Alpine
- Arch or any derivative like Manjaro
- Clear Linux
- Debian or any derivative like Kali or Ubuntu
- Gentoo
- Fedora, Red Hat, Amazon Linux, Oracle Linux, Rocky Linux, etc.
- SUSE or any derivative like openSUSE Leap
- macOS
- WSL and Docker on Windows
- FreeBSD
- OpenBSD
This POSIX-compliant script installs a minimal number of runtime dependencies that aren't defined in POSIX.
The script performs the following actions:
- Update the system (including reboot, if required) and install dependencies.
- Either download, validate, and extract Bitcoin Core or build directly from the source code.
- Set a prune for Bitcoin Core based on the disk free space.
- Create shortcuts for Bitcoin Core on the desktop and the "Show Applications" list.
- Start Bitcoin Core.
- Prevent the system from sleeping, suspending, and hibernating.
- Display relevant info while the initial block download proceeds, such as the percent synced, blocks left to sync, current chain tip date, and the free disk space remaining.
- After the initial block download completes, tell the user that the script has finished and end the script.
This script modifies the following in your file system:
- Any files related to installing system updates and dependencies
- The downloaded Bitcoin Core and validation files:
<temporary_directory>/compile_bitcoin/
<temporary_directory>/bitcoin-<version>-<architecture>.tar.gz
<temporary_directory>/SHA256SUMS
<temporary_directory>/SHA256SUMS.asc
<temporary_directory>/guix.sigs/
- The validated Bitcoin Core tarball and PGP keys:
~/Downloads/bitcoin-<version>-<architecture>.tar.gz
~/Downloads/guix.sigs/
- The installed Bitcoin Core executable binaries, headers, libraries, and manual pages, respectively, are installed into:
/usr/local/bin/{bitcoind,bitcoin-cli,bitcoin-qt,bitcoin-tx,bitcoin-util,bitcoin-wallet,test_bitcoin}
/usr/local/include/bitcoinconsensus.h
/usr/local/lib/{libbitcoinconsensus.so,libbitcoinconsensus.so.0,libbitcoinconsensus.so.0.0.0}
on Linux/usr/local/lib/libbitcoinconsensus.0.dylib
on macOS/usr/local/man/man1/{bitcoind.1,bitcoin-qt.1,bitcoin-cli.1,bitcoin-tx.1,bitcoin-util.1,bitcoin-wallet.1}
- An entry in the Show Applications menu and also on the desktop:
~/Desktop/bitcoin_core.desktop
on Linux~/.local/share/applications/bitcoin_core.desktop
on Linux
- The Bitcoin Core configuration file:
~/.bitcoin/bitcoin.conf
on FreeBSD and Linux~/Library/Application Support/Bitcoin/bitcoin.conf
on macOS
- Any files modified by Bitcoin Core, such as the blockchain, unspent transaction, and peer data.
An automated solution is in the backlog. For now, here are a series of manual steps to follow:
-
Uninstalling runtime dependencies can be be tricky. This script installs a minimal number of dependencies like curl, gzip, sudo, and tar as a defensive security posture. For advanced users, if you compiled Bitcoin from source by either using the
-c/--compile
optional argument or by running on Alpine Linux, please also review the build dependencies that were installed. -
To remove the downloaded Bitcoin Core installation and verification files, open the Files or Finder application, go to Downloads, and remove any files starting with
bitcoin-
. Also remove the directory namedguix.sigs
.- Or do it in Terminal with
rm ~/Downloads/bitcoin-*.tar.gz && rm -r ~/Downloads/guix.sigs/
.
- Or do it in Terminal with
-
To remove the installed executable binaries, headers, libraries, and manual pages, open the Files or Finder application, go to
/usr/local/bin
, and removebitcoind
,bitcoin-cli
,bitcoin-qt
,bitcoin-util
,bitcoin-wallet
, andtest_bitcoin
. Then go to/usr/local/include
and removebitcoinconsensus.h
. Then go to/usr/local/lib
and removelibbitcoinconsensus.so
,libbitcoinconsensus.so.0
,libbitcoinconsensus.so.0.0.0
on Linux orlibbitcoinconsensus.0.dylib
on macOS. Then go to/usr/local/man/man1
and removebitcoind.1
,bitcoin-qt.1
,bitcoin-cli.1
,bitcoin-tx.1
,bitcoin-util.1
, andbitcoin-wallet.1
.- Or do it in Terminal with
rm /usr/local/bin/{bitcoind,bitcoin-cli,bitcoin-qt,bitcoin-tx,bitcoin-util,bitcoin-wallet,test_bitcoin} /usr/local/include/bitcoinconsensus.h /usr/local/lib/{libbitcoinconsensus.so,libbitcoinconsensus.so.0,libbitcoinconsensus.so.0.0.0} /usr/local/man/man1/{bitcoind.1,bitcoin-qt.1,bitcoin-cli.1,bitcoin-tx.1,bitcoin-util.1,bitcoin-wallet.1}
on Linux orrm /usr/local/bin/{bitcoind,bitcoin-cli,bitcoin-qt,bitcoin-tx,bitcoin-util,bitcoin-wallet,test_bitcoin} /usr/local/include/bitcoinconsensus.h /usr/local/lib/libbitcoinconsensus.0.dylib /usr/local/man/man1/{bitcoind.1,bitcoin-qt.1,bitcoin-cli.1,bitcoin-tx.1,bitcoin-util.1,bitcoin-wallet.1}
on macOS. If the command fails, your user doesn't have proper privileges. Try addingsudo
to the front of the command.
- Or do it in Terminal with
-
To remove the shortcut files on Linux, go to the Desktop and remove the
bitcoin_core.desktop
file. Then go to~/.local/share/applications
and removebitcoin_core.desktop
.- Or do it in Terminal with
rm ~/Desktop/bitcoin_core.desktop ~/.local/share/applications/bitcoin_core.desktop
on Linux.
- Or do it in Terminal with
-
If you want to keep your synced blocks and chainstate data, open the Files or Finder application, go to the data directory at
~/.bitcoin
on FreeBSD and Linux or~/Library/Application Support/Bitcoin
on macOS, and either backup theblocks
andchainstate
directories to an external drive or move those directories somewhere else on your computer. (The next step will remove everything else from the Bitcoin Core data directory.)- Also open
bitcoin.conf
and make note of your prune value, in MiB (1024^2 bytes). Perhaps save that line (and only that line) to a text file wherever you copy/move theblocks
andchainstate
directories to. Any future Bitcoin Core nodes you run must have a prune setting less than or equal to this value, or you'll have to re-sync the chain.
- Also open
-
To remove the data directory, open the Files or Finder application, go to the
~
on FreeBSD and Linux or~/Library/Application Support
on macOS, and delete the data directory named.bitcoin
on FreeBSD and Linux orBitcoin
on macOS. You need to enable the "Show Hidden Files" option in the Files or Finder settings.- Or do it in Terminal with
rm -r ~/.bitcoin/
on FreeBSD and Linux orrm -r ~/Library/Application\ Support/Bitcoin/
on macOS.
- Or do it in Terminal with
If you have any questions or ideas on how this section can be improved, please open an issue.
Inspiration for this project came from these Open Source projects:
- Bitcoin Core
- Yeti Wallet
- Bails and yeti.Bash by Ben Westgate
- install-full-node.sh by Addy Yeow
- Parmanode by ArmanTheParman
- And from countless online guides, such as this one
Please open an issue for any bug reports or feature requests. You can see the list of open issues here.
If you plan to submit a pull request, please first look over our automated and manual test procedures.
This project is licensed under the terms of the MIT No Attribution / MIT-0 license.