Run a Bitcoin Node

This guide is written for running a Glittr node on testnet4, on a linux-based system.

Requirements

Download or build bitcoind

Create a new "bitcoind" user on your machine:

$ sudo adduser bitcoind

Make a new empty directory

$ mkdir -p /home/bitcoind/.bitcoin/
$ mkdir -p /home/bitcoind/data

Bitcoin Config

Put your bitcoin.conf file on /home/bitcoind/.bitcoin/bitcoin.conf

note: rpcauth can be generated by using this script https://github.com/bitcoin/bitcoin/blob/master/share/rpcauth/rpcauth.py

testnet4=1

[testnet4]
rpcuser=root
rpcpassword=root
# generate using https://github.com/bitcoin/bitcoin/blob/master/share/rpcauth/rpcauth.py
rpcauth=rpcauth=root:98307881641a85ed72ac421b4997b8ce$206a7001fc977b92a67fd0bc9012765335eff452a2fde6a943d53f998a71256d

coinstatsindex=1
blockfilterindex=1
server=1
txindex=1
listen=1

maxconnections=100
datadir=/home/bitcoind/data

Running the bitcoin node

Change the user to "bitcoind"

$ sudo su bitcoind

Run bitcoind

$ bitcoind

You may want to run the bitcoind as a service using systemd, the following is an example for the systemd configuration file (put it inside `/etc/systemd/system/`)

[Unit]
Description=Bitcoin daemon
After=network.target

[Service]
ExecStart=/usr/local/bin/bitcoind
Type=simple
User=bitcoind
Group=bitcoind
Restart=on-failure
PrivateTmp=true
PrivateDevices=true
MemoryDenyWriteExecute=true
RestartSec=5s
TimeoutStopSec=10m
Type=simple

[Install]
WantedBy=multi-user.target

And then, run the following to start the service

$ sudo systemctl daemon-reload
$ sudo systemctl start bitcoind

Last updated