Skip to content

Instantly share code, notes, and snippets.

@normandmickey
Last active October 29, 2021 11:45
Show Gist options
  • Save normandmickey/22dce2fe61a944dedf9d1c8b3d95535d to your computer and use it in GitHub Desktop.
Save normandmickey/22dce2fe61a944dedf9d1c8b3d95535d to your computer and use it in GitHub Desktop.
Install BTCPayServer on Raspberry Pi with Pruning and Fast Sync
Order from Lightning in a Box https://lightninginabox.co/product/btcpi/
or
Visit BTCPi.com for DIY instructions.
The folloiwng are very old instructions to install BTCPayServer on a Raspberry Pi 3. Please ignore
These instructions assume that you are starting with "virgin" Raspberry Pi Model 3 B+ that is running the latest updated version
of Raspbian Stretch. https://downloads.raspberrypi.org/raspbian_lite_latest
Requirements:
- Raspberry Pi 3 B+
- Minimum 64 Gb SD Cardif no flash drive, 8 Gb minimum SD Card if you have a flash drive
- 64 Gb USB Flash Drive (optional)
- Sub domain pointed to "btcpay.mydomain.com"
- Static External IP Address
- Forward ports 80,443,8333,9735 on your router to the Raspberry Pi
1. SSH to Raspberry Pi
2. Switch to root
sudo su -
3. Because running a node involves a lot of I/O it's recommended that you store the blockchain on a flash drive
instead of the SD card. If you don't have a USB flash drive you can skip to the Step 5.
The command 'fdisk -l' shows a list of the connected storage devices. Assuming you only have one flash drive connected it will be
called /dev/sda. Double check that the /dev/sda exists and the storage capacity matches your device.
#Format and mount flash drive
#Delete existing partition(s)
fdisk /dev/sda
d
w
#create new primary partition
fdisk /dev/sda
n
p
1
enter
enter
w
#Format partition as ext4
mkfs.ext4 /dev/sda1
#create folder for mount
mkdir /mnt/usb
#Look up UUID of flash drive
blkid -o list
#Add mount to fstab
nano /etc/fstab
#Add the following line to the end of the fstab file
UUID=(UUID of flash drive do not include parenthesis) /mnt/usb ext4 defaults,nofail 0
#test fstab file
mount -a
#check to see if drive is mounted.
df -h
#/dev/sda1 should be mounted on /mnt/usb
#Create symlink to flash drive for Docker
mkdir /mnt/usb/docker
ln -s /var/lib/docker /mnt/usb/docker
5. Create a folder for BTCPay
mkdir BTCPayServer
cd BTCPayServer
6. Clone this repository
git clone https://github.com/btcpayserver/btcpayserver-docker
cd btcpayserver-docker
7. Run btcpay-setup.sh with the right parameters
export BTCPAY_HOST="btcpay.mydomain.com"
export NBITCOIN_NETWORK="mainnet"
export BTCPAYGEN_CRYPTO1="btc"
export BTCPAYGEN_REVERSEPROXY="nginx"
export BTCPAYGEN_LIGHTNING="lnd"
export BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage-xs;opt-save-memory"
. ./btcpay-setup.sh -i
BTCPayServer's FastSync documentation is available here https://github.com/btcpayserver/btcpayserver-docker/tree/master/contrib/FastSync.
Please read very carefully to understand what FastSync is and why it's important to verify the UTXO set yourself.
Allow BTCPayServer run for a few minutes and visit your website (https://btcpay.mydomain.com) to confirm BTCPayServer is running.
8. From the /root/BTCPayServer/btcpayserver-docker folder run the following commands.
./btcpay-down.sh
cd contrib
cd FastSync
./load-utxo-set.sh
9. This will take about 30 minutes or so depending on your download speed. After FastSync finishes run the following command.
./btcpay-up.sh
Visit your domain and you should now see that your sync is at least 99%.
Enjoy!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment