Project Roma : Installing & Configuring Bitcoin Core
Prerequisite
- A dedicated computer
- Ubuntu Server
1- Installing Bitcoin Core
This section will be done remotely from another computer by connecting to your Node using SSH. Please follow previous Chapter to make sure your hardware is adequate, and you have followed Ubuntu Server installation.
***First of all, we will validate that the installation was done properly and that the Ubuntu installation was NOT setup as a virtual machine **
df -h
Looking for updates
sudo apt update
Updating
sudo apt upgrade
Lets start by creating a βdownloadsβ folder
mkdir downloads
***Go in the downloads folder
cd downloads
It is now important to understand what you are about to do. There are different ways to install Bitcoin Core. My preferred way is to download the release from Bitcoin Core here
and do the GPG Key verification with the key list here
Download the files from the Bitcoin Core website
wget https://bitcoincore.org/bin/bitcoin-core-24.0.1/bitcoin-24.0.1-x86_64-linux-gnu.tar.gz
wget https://bitcoincore.org/bin/bitcoin-core-24.0.1/SHA256SUMS
wget https://bitcoincore.org/bin/bitcoin-core-24.0.1/SHA256SUMS.asc
Validate that the release file is listed in the checksums file
sha256sum --ignore-missing --check SHA256SUMS
Use GPG to load keys locally from individuals found on the Github site
Ignore any warning and failures, but you must be sure that the lists βOKβ after the name of the release file downloaded
Use GPG to load keys locally from individuals found on the Github site
gpg --keyserver hkps://keys.openpgp.org --recv-keys E777299FC265DD04793070EB944D35F9AC3DB76A
gpg --keyserver hkps://keys.openpgp.org --recv-keys D1DBF2C4B96F2DEBF4C16654410108112E7EA81F
Verify that the checksum file is verified
gpg --verify SHA256SUMS.asc
You should receive a βGood signatureβ beside the name associated to the key
Extract the tar file. It will create a folder called bitcoin-24.0.1 so it is important that you call it in the next command line.
tar xzf bitcoin-24.0.1-x86_64-linux-gnu.tar.gz
Install the content in the following directory. It is IMPORTANT that you write the correct folder name based on your release number. If you have installed the release 25.0, the folder name has to be bitcoin-25.0
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-24.0.1/bin/*
Cross your fingers and launch Bitcoin Core
bitcoind -daemon
***Get blockchain info to see which block your node is at
bitcoin-cli getblockchaininfo
Validate your node is connected to how many peers
bitcoin-cli getconnectioncount
***If you want to follow the log of your node synchronization, you should open secondary Terminal window and write the following command
tail -f .bitcoin/debug.log
2. Configuring Bitcoin Core
While the blockchain is synchronizing, you can start the configuration. In order to be fully synchronized, it will take approximately 18 hours. I found a great tutorial on youtube here:
Open a new therminal window and go to the /.bitcoin folder
cd /.bitcoin
*** We need to create a new configuration file***
nano bitcoin.conf
Paste de following text in the bitcoin.conf file
server=1
txindex=1
daemon=1
rpcport=8332
rpcbind=0.0.0.0
rpcallowip=127.0.0.1
rpcallowip=10.0.0.0/8
rpcallowip=172.0.0.0/8
rpcallowip=192.0.0.0/8
zmqpubrawblock=tcp://0.0.0.0:28332
zmqpubrawtx=tcp://0.0.0.0:28333
zmqpubhashblock=tcp://0.0.0.0:28334
whitelist=127.0.0.1
rpcauth="username":[output of rpcauth.py]
Keep this terminal window open and go back to the main window
We will create a username and password for the RPC Authentification of the bitcoin.conf file we have created in the other terminal window and modify it
In the original terminal window, be sure you are in your βdownloadsβ folder
cd downloads
*** In order to add a "username" and "password" to access to your node, go to Github.com/bitcoin/bitcoin and search for rpcauth.py. Go to the raw file and copy the link***
wget https://github.com/bitcoin/bitcoin/blob/master/share/rpcauth/rpcauth.py
Make the file executablechmod +x rpcauth.py
Execute the file with a "username" & "password" at the end of the command line./rpcauth.py "username" "password"
Copy the string and paste it in the configuration file of the auxiliary termina window
Modify the "username" and "password" in the bitcon.conf file
#Output for your username and password
rpcauth="username":[output of rpcauth.py]
CTRL+X and save Yes
Restart your nodeBitcoin-cli stop
Bitcoind
3.Creating the service file for automatic boot on start-up
*** Go back to Github.com/bitcoin/bitcoin and search for .service file.
Important note: The new service file does not work properly. The link above is for the service file from 2021
Download the .service file in your systemd foldercd /etc/systemd/system
sudo wget https://raw.githubusercontent.com/bitcoin/bitcoin/663f6cd9ddadeec30b27ec12f0f5ed49f3146cc9/contrib/init/bitcoind.service
sudo nano bitcoind.service
Change the file
In the [service] section, make the following changes:
β’ Make sure that the βExecStartβ has the right path for the folder βbitcoindβ on the same line as βdaemonwaitβ (you can verify the path in another terminal with the command βwhereis bitcoindβ)
β’ you need to remove the βwaitβ in -daemonwait to have only -daemon
β’ Make sure that the bitcoin.conf file has the right path.
β’ Change also the path for the datadir.
β’ Put a # in front of ExecStartPre=
β’ Change βuserβ and βgroupβ for the actual user of the server instead of Bitcoin and Bitcoin
β’ Put a # in front of ProtectHome
Press CTRL + X to save it, Y, enter
Shutdown Bitcoinbitcoin-cli stop
Activate the new service filesudo systemctl enable bitcoind
sudo systemctl start bitcoind
Validate the statussudo systemctl status bitcoind
4. Enable TOR
Go back to home directorysudo apt install tor
Validate that TOR has been activatedsudo systemctl status tor
Edit TOR rc filesudo nano /etc/tor/torrc
Go all the way to bottom and enter 3 lines
ControlPort 9051
CookieAuthentication 1
CookieAuthFileGroupReadable 1
CTRL-X, Save
Restart Torsudo systemctl restart tor
sudo usermod -a -G debian-tor "username"
Modify bitcoin.conf to add TOR linesnano .bitcoin/bitcoin.conf
Add the following lines at the end of the file:
proxy=127.0.0.1:9050
listen=1 b
bind=127.0.0.1
onlynet=onion
addnode=ty5nq4ua4v47jmebyib7wtk6b25exd735twap6g3rckbfhvlzvrkdhid.onion:8333
CTRL+X, Y
Reboot your nodesudo reboot
Et voila!