Bitcoin is getting more and more widespread, the price is going up, and more and more people are using Bitcoin. But there is a problem getting in the way of all of that, and that is scalability. Visa processes on average about 4000 transactions per second, while Bitcoin can process at most only seven transactions per second. The more Bitcoin grows, the higher the transaction fees also get, and you have to wait longer. But there is already a solution that is being worked on continuously, and it is called the Lightning Network. The main idea behind it is that everyday and smaller transactions do not have to be stored on the main blockchain, but can happen offchain.
How You Buy Bitcoin
You cannot hold Bitcoin physically in your hand, and you cannot just pick it up in the supermarket either. The answer is: you need an exchange, a platform that allows you to trade your Euros for Bitcoin. And no, you do not have to buy a whole Bitcoin right away. You do not need 100,000 euros or anything like that. You can start with less than one euro, because Bitcoin, just like the euro, is divisible into smaller units.
When it comes to exchanges, there are really a lot of options nowadays. The most important things to look out for are, on the one hand, the fee structure — how expensive buying and selling is — and then where the exchange is located. As a rule, you want to avoid exchanges that sit on some random island like the Bahamas. And very important: you want to be able to withdraw your Bitcoin from the platform. That is, after all, often not possible with the big exchanges.
Leaving the Bitcoin you have bought just lying on the exchange is nothing wrong in itself. But if you feel uncomfortable with that, if you do not trust the exchange completely, or if you are really dealing with larger sums, then my clear recommendation is: store your Bitcoin externally in your own wallet. The safest option is a hardware wallet, which is a small device that stores your Bitcoin offline, completely outside of the internet, protecting you from hacks, platform failures, and insolvencies.
How the Lightning Network Works
Let us take an example: a customer buys lunch every day in the canteen and pays five euros for it. If he were to do that with Bitcoin on the main blockchain, the transaction fees would be far too high, and they would probably cost more than the whole lunch. But if he were to use the Lightning Network instead, the customer and the canteen could open a so-called payment channel. For that, both parties each deposit a certain amount of Bitcoin into a so-called multi-signature address. Let us say the customer deposits around 500 euros, and the canteen deposits nothing, since it is not going to buy anything from the customer. In addition to the deposit, there is also a ledger about who currently owns how much of the money. That means, at the beginning it says: customer owns 0.01 Bitcoin, canteen owns 0 Bitcoin. This deposit transaction is the opening of the payment channel, and it happens on the main blockchain, so that everyone can see it.
Now let us look at what happens when the customer pays for his lunch. The lunch costs five euros, that is about 0.0001 Bitcoin converted. To pay, the customer simply changes the ledger by that amount, so that now it says: customer owns 0.0099 Bitcoin, canteen owns 0.0001 Bitcoin. Both parties then add a digital signature with their private keys to the whole thing and each receive a copy of the ledger to keep. The customer can now make hundreds of orders following exactly this pattern, as long as enough money has been deposited.
The payment channel can be closed by either partner at any time. All that person has to do is take the last current state of the ledger, signed by both, and send it to the Bitcoin network. The miners then pick up this transaction in the blockchain, and the money is released and split up as described in the ledger. This significantly reduces the load on the blockchain: only two transactions are needed, one to open the payment channel and one to close it. It is also very secure, and it is always only possible to redeem the last ledger that was signed by both.
A problem is, though, that you would have to open an individual payment channel with every person. That is not how it works in practice: you can also use the payment channels of other people. What is important is only that there is a path in total, leading from one person to the other, and that on that path enough money has been deposited at each point. The system then automatically always finds the path with the fewest intermediate people, so that you do not need your own payment channel to every person.
What Is a BTCPay Server?
If you already have an online shop, then you probably offer credit card or PayPal, or solutions like invoice or instant transfer. In all of these cases, you are working together with a payment provider. If you want to accept Bitcoin payments, you have to work together with a Bitcoin payment processor that specializes in Bitcoin.
At this point the question arises: why not just do it yourself? The Bitcoin whitepaper says that Bitcoin gets by without an intermediary, that Bitcoin is always sent directly from sender to receiver, without anyone in between. And that is exactly what you can build yourself with a BTCPay Server: a merchant can run his own Bitcoin payment processing and is no longer dependent on working with a payment provider. Between the merchant and the end customer there is a direct payment, and there is no party in between.
BTCPay Server: What You Do Not Have to Do Anymore
Who runs his Bitcoin payment processing with a BTCPay Server no longer has to do the following: You do not have to open an account and hand over your business documents in the process. You do not have to explain your business model and get it reviewed. You do not have to pay a monthly fee, no percentage fee on revenue, or a transaction fee, because using a BTCPay Server is free of charge. The credits of your revenues are posted directly to your own Bitcoin address, and there is no delay in the so-called settlement. No security deposit is held back either, because a payment is final, and there are no chargebacks.
Setting Up a BTCPay Server
What is special about LunaNode is that it specializes in hosting BTCPay Servers. For the equivalent of under 10 US dollars per month, you can already run your own BTCPay Server there, and it is very simple to set up your own BTCPay Server — even without any technical prerequisites.
We begin with the setup: for that, we go to the website of lunanode.com and begin the setup process. For registration we need an email address, a self-chosen password, and at a later point a mobile phone number, to which an SMS will be sent. We start with our email address and a self-chosen password, select our country and click on Submit. We then automatically arrive at the LunaNode dashboard.
Before we top up our account, we have received an email from LunaNode confirming our email address. We start and enter 20 US dollars as an example, enter our phone number with the international prefix and receive an SMS containing a four-digit code. We enter this code. After we have verified our mobile number, we can top up our account: we load 10 US dollars and confirm. Here we see the LunaNode payment window and have the option to choose between Bitcoin and Bitcoin Lightning. We open our Lightning wallet, scan the QR code and click pay. The payment is successful, and in parallel we receive an email confirming that the deposit has been credited.
Now we begin setting up the server. We switch to API and get the login data here. We click on „Create API Credentials“ and get two details: the API key and the API ID. We copy both of these into a separate text file, because we need them for the next step. We switch to the BTCPay Server page of LunaNode and enter the API ID and the API key there. Up here we are shown that for the server in size M.2, a virtual machine, we will pay a monthly price of 8.80 euros. This is the smallest machine, and it is completely sufficient if we only want to accept the payment method Bitcoin.
We click on Continue and see an IP address here. We copy this one as well, because we need it if we want to run our BTCPay Server on our own domain. We choose the option with our own domain endpoint and click on Continue. On the next page we see which blockchains we want installed on the server. Bitcoin is preselected. We recommend taking only Bitcoin and Lightning here, and we decide on LND, the Lightning implementation. Which virtual server we want to use: we take M.2, which is completely sufficient for the plan.
There is also the option of faster synchronization of the blockchain: on the BTCPay Server, the complete blockchain since the beginning is copied onto the server. Without the quick start, it takes about seven days until the complete blockchain is installed. With the quick start it takes only two to three days, costs a one-time 3 US dollars, and that is worth it for it to go a little faster.
From now on the setup of the BTCPay Server begins. In about five minutes we see the link that takes us to the login area of our BTCPay Server. In the backend we see a window that shows the BTCPay Server is in the process of synchronizing the blockchain. This process takes about two to three days, which we should wait out.
For our own domain to work, we log in to the domain provider that manages our domains, and create a CNAME entry that generates, for our domain, for example btcpayserver.ourcompany.com. We enter the record name, choose the record type and enter the IP address that was made available to us during registration with LunaNode. It will take about one to two hours until this entry is registered and accessible over the entire internet.
After the DNS record has been created and the blockchain has been synchronized, we log in to the backend. We go to Server Settings at the bottom left and enter in the Domain Name field the domain name that we linked with the IP address, and confirm per Confirm. Then the following happens: the server is stopped, shuts down, and then starts up again automatically. When we call up our domain, we see the page with the lock, and everything runs over HTTPS.
Self-Hosting: BTCPay Server with Docker on a VPS
If you are already using a BTCPay Server with a third-party host, you can skip this section and come back to it later, when your shop grows and you need your own server. The third-party solution is great for beginners, because then someone else looks after your server. But building on someone else’s full node brings privacy and trust issues with it. On top of that, a self-hosted BTCPay Server offers additional features like the Lightning Network and the ability to connect an unlimited number of stores and to be a payment processor for others — and that only works if you are the server admin or owner. So if you are hitting the limits of the third-party solution, you should seriously consider running your own BTCPay Server instance on a VPS.
BTCPay can be deployed on any VPS that meets the following requirements: 80 gigabytes of storage are pretty sufficient if you use pruned mode. If you want to accept cryptocurrencies other than Bitcoin and on top of that the Lightning Network, you should consider somewhat larger storage.
Costs of the Setup
For this setup we use a LunaNode VPS, which accepts Bitcoin and is relatively cheap: the M2 plan costs 7 dollars per month, plus 2.4 dollars for additional storage and a one-time 3.5 dollars. In total that is 9.4 dollars per month plus 3.5 dollars in the first month.
The first thing you have to do is, of course, create your account: click on Sign up, enter your email address, a password, and your country, and confirm by email. Then you add credit: click on „Deposit credit“, choose the amount and the payment method — I am paying with Bitcoin here — and verify your phone number via the PIN code from the SMS.
Then click on „Create VM“, choose a region, enter a hostname, say BTC pay, choose the memory-optimized plan M2, as the operating system Ubuntu 64-bit, and click on „Create virtual machine“. After that you add an additional volume: go to Volumes, choose the same region, name the volume, say BTC pay, choose 80 gigabytes and create the volume. Attach the volume to the virtual machine, and enable „Pay for CPU above baseline performance“ in the CPU tab.
If you want your own domain name: copy the external IP address of your VM and create an A record with this IP address in your domain account.
Now we install the BTCPay Server. For that we use a bit of the command line — do not be afraid, it is only about copying and pasting commands that already exist. First, you log in to the virtual machine: ssh ubuntu@your-domain, then the password from LunaNode, then sudo su. After that you copy the commands one after the other: the command to set Docker to use this volume, then the installation of Git, then the installation of BTCPay. If you want Bitcoin, you paste in this command, and if you want the Lightning Network implementation, you paste in this command. At one point you have to change something yourself: replace the text inside the quotation marks with your own domain and enter your email address.
Copy the next command, paste it in — and now BTCPay begins to install. That takes two to three minutes. Leave the terminal open, do not switch off the laptop, and just wait. When you see the message „BTCPay Server started“, it is finished. Our BTCPay Server is now completely installed. It has also installed the Lightning Network and the Bitcoin full node. Now you go into your browser, enter the domain name, and your BTCPay Server is running.
One very important thing: you see here this warning „Your nodes are syncing“. That means the BTCPay Server has to load and synchronize the entire blockchain. Since this is a process-intensive operation, it can take a few days — with a cheap virtual machine, also three or four days. Check back in three or four days, then you will be able to use the BTCPay Server fully.
Setting Up Lightning
If you want to accept Lightning payments, you have to tell the server which Lightning node you want to use to accept the Lightning payments. On the dashboard, in the setup, you see that a Lightning node is still missing. When you click on it, you see all the options, and if you have the maximum configuration, you see three options.
The first would be: use the internal BTCPay Server node. That is the LND that is integrated into the server. I choose the option „Use internal node“, then you click on Save, and that is it. You are already using the interface to your own Lightning node. Simple, it is — but of course it is not simply clicking „Lightning node“ and using it: behind it you need a node that is well connected in the network, that has channels, and that can accept payments.
Then there is the second option: I use an external node. That is, I can link a Lightning node that is not directly on the BTCPay Server, but external in the network — either in my home network or on a server. That means I use a custom node, „Use custom node“. The external node has to be reachable via the clearnet, a Tor connection is not yet available. If you take, for example, my variant with the LunaNode server and want to use your home Lightning node, then you have to tell the BTCPay Server the admin macaroon of the node — that means full access — and your node at home has to be reachable over the internet. A port forwarding has to be set up, and that is simply the downside: you grant access from the outside to your own network, and that is a security topic.
Then there is the option of using LNbank: that is not its own Lightning node, but a plugin on the BTCPay Server that uses the internal Lightning node, but without access to the complete funds. There is an extra wallet that is created for every user who logs in to the BTCPay Server. You can make your Lightning instance available to your users, they can accept and send invoices, and you as the administrator have the funds. Warning: you cannot offer this as a business in Germany. If you want to manage cryptocurrency for other people, then you need a BaFin license for that.
If you have your own node at home, for example installed with Umbrel, and a BTCPay Server with an external provider, then there is a nice mixed variant: you open a channel from your node to the virtual server, and provide it with liquidity. That way you have the availability, and you do not have to worry so much about channel management. When a payment is then accepted, it lands on a local balance in the channel, and you can simply rebalance — from your own node, emptying the channel again — and keep the liquidity at home with you.
Conclusion
The Lightning Network offers a worldwide network. Anyone can take part, and then you can theoretically even pay someone cent amounts on a per-second basis, or subdivide the whole thing even further. It makes sure that we have a second layer on which we can install, and the main blockchain is relieved.