Hosting BTCPay Server for cheap

…and without credit card

BTCPay Server
8 min readAug 18, 2018

WARNING: THIS ARTICLE WAS USING TIME4VPS AS VPS PROVIDER HOWEVER:
1. The VPS became slow during sync, now it is stuck synching
2. Some people are asked IDs (Passport, driver license) to be customer
3. Some people get VMs without a kernel supporting docker
FOR THESE REASONS, WE ADVISE AGAINST USING TIME4VPS.

Instead, if you are interested into reading how to host BTCPay on your own host, read this article which show how to manually install BTCPay on LunaNode.

If you are just interested to get it work fast and cheap, follow this article to install on LunaNode with the install wizard.

Problem

BTCPay Server can easily be hosted with the magical one-click deploy to azure. However, simplicity come with a cost: Around 65 USD per month.

While you can bring it down to around 20 USD per month by following this guide after initial sync. The cost of Azure is too damn high.

The other issue is that Azure don’t accept Bitcoin, I had friends having headache to use pay for their Azure account because reasons about their credit card.

Last and not the least, America’s top companies are subject to lot’s of pressure nowadays to censor anything which can offend, or incite violence with the definition of both concept being expanded way above their original intent.

This tweet was in response of me being surprise Azure censored an a blog article. I was outraged at Microsoft, but I found out that the article was indeed inciting violence, and deemed that what Microsoft did was ethical. It would be nice if the reason for censorship was more transparent so that each person can judge the morality of the censor by themselves instead of assuming that those big companies are doing good.

But this still beg the question: If tomorrow the US government bans Bitcoin, or that using Bitcoin becomes suddenly “offensive or unpatriotic” (which will happen when shit hit the fan with USD), and merchants are using Microsoft Azure, then lot’s of shops will end up closed. This would hurt the ecosystem.

Solution

= 4.49 EUR/MO at the time being

The solution is to find alternative VPS (Virtual Private Server) Hosting solutions.
We might lose the ease of use of the one-click deploy (assuming your credit card works with Azure) but we save money on hosting fee, while improving the anti-fragility of Bitcoin.
Better, because VPS host provider are available in all countries in the world, Bitcoin will gain from jurisdictional diversity.

BTCPay can be hosted on any Linux machine. But most merchant or users are not technical people, but it does not mean they can’t learn!

This article will teach you step by step, without technical skills, how you can host BTCPay on cheap servers.

Minimal recommended BTCPay specification for BTC and Lightning Network support with LND is:

  • 2048MB of RAM
  • 80GB of storage

I was recently search VPS provider which:

  • Accept Bitcoin (without Bitpay, as most wallet don’t support their protocol)
  • Have the minimal recommended specification

It turns out that time4vps (in Lithuania) fit what I want. More specifically their 6 EUR/mo (or 4.49 EUR/mo if you pay for 2 years up front)

You might even find better deal if you can pay by credit card (OVH’s VPS SSD 1 at 3.35 USD/mo might be enough)

Well let’s click order!

I won’t step you through the boring wizard, but you just enter your info mail, billing info etc… then get presented with a nice QR Code. (provided by Coinify)

Only small UX issue with coinify, I paid 2 sat/bytes, so it seems it made me wait. But otherwise, good experience. Exercise, check the latest drama on reddit, and twitter, the price on coinmarketcap, play quick to Mario Kart, go drink coffee, and you are good to go! (For maximum fun, I RBFed my transaction with samurai wallet, and they handled it correctly)

So then you can go to the main panel, click on Manage:

Then Click on install OS:

Take Ubuntu:

Once this is installed, it will give you the password to connect to your VM via SSH:

Note that my Host is 72368.s.time4vps.cloud, yours will be different.

If you are on linux/mac/WSL, just enter the following command line and copy/paste the password:

ssh root@72368.s.time4vps.cloud

If you are on windows, download and install Putty (Direct Link) and copy/paste your host name in Host Name (or IP Address) textbox:

Then enter root in login as, press Enter, and then enter your password:

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
cd btcpayserver-docker

Then, assuming you want bitcoin on mainnet:

export NBITCOIN_NETWORK="mainnet"
export BTCPAYGEN_CRYPTO1="btc"

If you want Lightning Network with LND:

export BTCPAYGEN_LIGHTNING="lnd"

Then you need to setup staging certificates for Let’s encrypt, and give access to SSH to BTCPay:

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

Then, your need to replace this line with your own Host:

export BTCPAY_HOST="72368.s.time4vps.cloud"

Optionally, setup your address email to be notified if anything get wrong with your certificates:

export LETSENCRYPT_EMAIL="nicolas.dorier@example.com"

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:

export BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage-s"

Note that if you don’t use time4vps and have bigger store 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:

. ./btcpay-setup.sh

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.

Last, and not the least, time4vps does not allow sustained 100% use of CPU.
So run this to limit the CPU to 80%.

docker update btcpayserver_bitcoind --cpus ".8"

Congratulation! 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 72368.s.time4vps.cloud (unsafe) 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 72368.s.time4vps.cloud. In my case I want easybtcpay.btcpayserver.org.

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 easybtcpay as HOST:

You can find the IP inside your instance’s page on time4vps interface, in the Service Details menu.

So I fill this information in my A record, and click on Next:

And confirm

Then back to BTCPay, I enter my new domain name and click on Confirm:

If you have set up your DNS correctly, victorious green message will appear.

Then wait a bit (1 or 2 minutes), you can now access https://easybtcpay.btcpayserver.org successfully.

Congratulation!

Conclusion

If you prepaid for 2 years, you are effectively paying 4.49 EUR/Mo for accepting payments on your own node!
By using easyDNS and time4vps, you don’t even need a credit card.

Your server might take one or two days to synchronize to the Bitcoin network.
Jonas Schnelli is working on a pull request which would make it possible to use BTCPay without waiting one or two days to be synchronized. (See hybrid full block SPV mode pull request)

Once things are synched, you can happily connect Zap to your LND instance via https://easybtcpay.btcpayserver.org/server/services/lnd-grpc/BTC/0 page. You can create invoices, create stores and be sovereign!

If you have any cool hosting solution to propose, let us know!

If any problem, connect with the community:

Slack: http://slack.forkbitpay.ninja/
Twitter: https://twitter.com/BtcpayServer
Github: https://github.com/btcpayserver/btcpayserver

--

--