Hosting BTCPayServer on LunaNode
…without credit card
UPDATE: THIS ARTICLE IS OBSOLETE THANKS TO THE NEW ONE CLICK DEPLOY ON LUNANODE, WHICH MAKE THE INSTALL EASIER.
Please follow this article for hosting on LunaNode instead.
If you are interested to see how to install manually on another VPS, you can continue to read.
This post is also available on youtube thanks to bitcoinshirt.
My previous article show you how to host on time4vps.
Sadly, it turns out several problem came up after the article:
- Some users were asked to provide ID to rent the server
- My server supported Docker by chance
- My server started becoming highly unreliable after 10% of the initial sync
Still, time4vps had a very good support, said they were experimenting docker support and identified the CPU issue to be a problem on their end. I will keep an eye on them and try again later!
This led me to search a new solution, as always searching for the following spec:
- Can pay in Bitcoin without Bitpay
- At least 2GB of RAM, ideally 100GB of disk, can compromise to 50GB
How much Luna Node cost?
So after many advises, I took a look at LunaNode.
So c.1 is the only to match our specs. However it cost a bit too much: 20 USD/Mo.
It has more RAM than needed, which make it ideal if you want to support altcoins.
Highly recommended if you don’t mind paying 20 USD/Mo.
For s.2 and m.2 the storage is too low. We can however buy storage separately for 0.03 USD/Mo/GB. We don’t need much CPU once the node is fully synced, so we don’t really need the power of s.2.
For this reason, we will choose m.2 with 80GB of additional storage, for 2.4 USD/Mo.
Note: s.2 has 4 CPU, so will probably be 4 times faster to sync your node ( 1 day against 4 days for m.2)
Note that if you chose c.1, you don’t need the additional storage and the additional steps taken in this article to use it.
On top of it, LunaNode has the concept of CPU-Points. Long story short, if I use 1 CPU for 100% during 5 minutes, I spend 1 CPU-Point, if I use 80%, I spend 0.8 CPU-Point. The m.2 is earning 0.2 CPU-Point/5min.
It is safe to assume that Bitcoin Core, for initial sync, need 100% of the CPU for 3 or 4 days. (I prefer shooting up!)
So for synching, I need to pay to LunaNode 0.8 CPU-Point/5min. Doing this for 4 days is about 921 CPU-Point. Each CPU-Point cost 0.0037 USD, so it is a one time cost of 3.5 USD.
LunaNode seems throttling on IOPS as well, but do not offer the ability to buy IO burst point if you consume more than 100 IOPS/s. After contacting them, they told me that it should be normally OK if I only use that disk intensively for 2 or 3 days.
- 2.4 USD/Mo for 80 GB of storage
- 7 USD / Mo for m.2 instance
- One time cost of 3.5 USD for CPU-Points
Total: 9.4 USD/Mo + one time 3.5 USD
Buying the server on LunaNode
Buy the virtual machine
After registering, I needed to deposit first. Sadly, you are required to provide SMS verification.
Then LunaNode ask you to pay with Bitcoin:
Of course, because Bitpay is not supported by almost any wallet , you need to pay with Swyfte.
The UX sucks because it does not show the QR code, so you need to use separate QR Code Generator to copy paste the address and pay from your mobile. No feedback is given to you once paid. So I decided to leave it alone until I get the credits.
Funny story: I received a mail from Bitpay confirming my purchase, meaning that LunaNode are probably just using their own homegrown BIP70 decoder.
LunaNode, please, if you are reading this let me help you, BTCPay Server can replace Bitpay with almost no change on your back-end.
Then I go ahead to create my m.2 server, choosing Montreal as location, with the name lunanodepayserver
Selecting Ubuntu 18.04 as OS.
Then click on Create the Virtual Machine.
Buy the volume
I just create the volume to be co-located with my Virtual Machine in Montreal, setting 80 GB of space, with name btcpay.
Then once created, click on Manage
Click on Attach to VM
Select the previously created VM, click on Attach Volume to VM
Buy the CPU-Points
Then last, we need to allow LunaNode to pay for the CPU we will use during synchronization of our node.
Select Virtual Machines in the menu, then Manage:
In the CPU tab, allow to pay for CPU utilization above baseline perfomance and click Update.
Setup your DNS
Now, let’s see how to configure our DNS registar, in my case I want my server to use the domain lunabtcpay.btcpayserver.org.
Get the IP address of your server in the General tab of your Virtual machine:
My IP is 188.8.131.52.
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 easydns, because they accept Bitcoin without using Bitpay.
Once I logged, and payed for my btcpayserver.org domain name with bitcoin, I clicked on it:
Then DNS Settings, and adding a A record this will allow us to bind a domain name to the IP address of our server.
So it goes to this page, I fill lunabtcpay as HOST and 184.108.40.206, then click Next and confirm:
Connect to your Virtual Machine
Connect via SSH to this Virtual machine
If you are on linux/mac/WSL, just enter the following command line and copy/paste the password:
When you connect, you will be prompted to input a password, you can find it in the General tab of your Virtual Machine.
Then, log as root
sudo su -
Use the 80GB volume for storage
Now we need to configure docker to store data on the volume we bought, because we would quickly run out of space.
Format and mount your volume
mount /dev/vdc /mnt/dockervolume
echo "/dev/vdc /mnt/dockervolume ext4 defaults 0 0" >> /etc/fstab
Then set docker to use this volume
ln -s /mnt/dockervolume /var/lib/docker
Setup BTCPay Server
Then on your VPS, install git:
apt-get update && apt-get install -y git
Once over, you need to clone btcpayserver-docker and go inside directory:
git clone https://github.com/btcpayserver/btcpayserver-docker
Then, assuming you want bitcoin on mainnet:
If you want Lightning Network with LND:
Then you need to setup staging certificates for Let’s encrypt, and give access to SSH to BTCPay:
ssh-keygen -t rsa -f /root/.ssh/id_rsa_btcpay -q -P ""
echo "# Key used by BTCPay Server" >> /root/.ssh/authorized_keys
cat /root/.ssh/id_rsa_btcpay.pub >> /root/.ssh/authorized_keys
Then, your need to replace this line with your own Host:
Optionally, setup your address email to be notified if anything get wrong with your certificates:
Now, because we only have 80GB of 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 don’t use lunanode and have stricter storage limitation, you can use opt-save-storage-xxs instead which will use 5GB of storage instead.
If you want to see more options, you can enter:
If you are fine with current options, run:
. ./btcpay-setup.sh -i
Note that btcpay-setup.sh is idempotent, which mean it is safe to run again if something goes wrong, or if you want to change your settings.
Now, be patient… with 1 CPU the full sync will take between 3 and 4 days. (At the time of writing)
If you want quicker, take a better machine with better CPU, although this seem a bit wasted as this CPU will mainly be idle once the node is synced.
We managed to use LunaNode successfully to host a full node with LND support on 9.4 USD/mo.
This is more expensive than what time4vps would be if it was working.
However, their c.1 (20 USD/mo) instance seems quite interesting if you want to support other crypto currencies as it gives you 5 GB of RAM.
In summary, the steps involved in this article were:
- Deposit of BTC on LunaNode
- Create the VM
- Create a Volume
- Activate automatic buy CPU-point if needed
- Setup our DNS
- Setup BTCPay
- Setup docker to use the volume