Today we will be configuring our own Bitcoin payment gateway and linking it to a wallet that can store Bitcoin. You may wish to combine this tutorial with my other tutorial on how to host a website on the Tor network, however, that is not essential as our new Bitcoin payment gateway will provide a platform for us to integrate a webstore within it.
sudo apt-get update && apt-get install -y git
Once completed you need to clone btcpayserver-docker and change to that directory, where we will be working:
git clone https://github.com/btcpayserver/btcpayserver-docker cd btcpayserver-docker
Then, assuming you want bitcoin on mainnet issue the following commands:
export NBITCOIN_NETWORK="mainnet" export BTCPAYGEN_CRYPTO1="btc"
If you want the Lightning Network with LND then smash this command in using your chubby little fingers:
Then you need to setup staging certificates for Let’s encrypt, and give access to SSH to BTCPay – you’re having fun, right?! … Keep going:
export ACME_CA_URI="https://acme-staging.api.letsencrypt.org/directory" ssh-keygen -t rsa -f /root/.ssh/id_rsa_btcpay -q -P "" -m PEM echo "# Key used by BTCPay Server" >> /root/.ssh/authorized_keys cat /root/.ssh/id_rsa_btcpay.pub >> /root/.ssh/authorized_keys export BTCPAY_HOST_SSHKEYFILE=/root/.ssh/id_rsa_btcpay
Now you need to replace this line with your own Host:
Optionally, setup your address email to be notified if anything goes wrong with your certificates – obviously add your own email address instead of mine, else I will read these messages and feel bad for you:
To save on disk space we need to instruct BTCPay setup to prune the nodes, this will make sure Bitcoin takes at most 50GB of storage for block storage:
Note that if you’re really poor and have very limited less space to play with, you can use opt-save-storage-xxs instead which will use 5GB instead… Also, did you know that you can also use BTCPay on a Raspberry Pi?! Yeah, you can be a real cheapskate!
Anyway, if you want to see more options, you can enter:
btcpay-setup.sh is idempotent, which means it is safe to run again if something goes wrong, or if you want to change your settings.
… But, if you are fine with current options, run:
. ./btcpay-setup.sh -i
Congratulations! You can now browse your instance BTCPay server online… but with a bad certificate (we will fix that soon).
Just click on Advanced and Proceed to ignore this bad certificate, then click on Register.
Your first account on your BTCPay instance is configured as a Server Administrator, proceed to choose an email and password and click on Register… Then go on Server Settings menu and Maintenance.
Now, let’s see how to configure our DNS registar to have a better domain name than host77.webots.london.
If you are a merchant, then you probably already have your own DNS provider to pay your domain name, if you don’t, I advise you use easydns, because they accept Bitcoin without using BitPay!
Your server might take one or two days to synchronize to the Bitcoin network. Once things are synced, you can happily connect Zap to your LND instance. You can create invoices, create stores and be sovereign!