[Unit]
Description=Bitcoin daemon
After=network.target
[Service]
ExecStart=/opt/node/bitcoin/bin/bitcoind -daemon -conf=/opt/node/bitcoin/blockdata/bitcoin.conf -pid=/run/bitcoind/bitcoind.pid
# Creates /run/bitcoind owned by bitcoin
RuntimeDirectory=bitcoind
RuntimeDirectoryPreserve=yes
User=ubuntu
Type=forking
PIDFile=/run/bitcoind/bitcoind.pid
Restart=on-failure
StandardOutput=/var/log/bitcoind.log
StandardError=/var/log/bitcoind.log
# Hardening measures
####################
# Provide a private /tmp and /var/tmp.
PrivateTmp=true
# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full
# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true
# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true
[Install]
WantedBy=multi-user.target