Welcome anon! So you’ve decided to eliminate third parties like Visa and take control of your payments using BTCPay Server. You’re accepting Bitcoin payments straight into your cold storage wallet. Now it’s time to take advantage of instant, low fee Bitcoin payments on Lightning Network.
We showed you how to set up your own Bitcoin payment processor in 30 minutes using LunaNode. The default setup uses the Bitcoin blockchain. Now we are going to add Bitcoin payments over the Lightning Network.
Lightning Network is a decentralized system that enables instant, low fee Bitcoin transactions. Here is a high level overview of the Lightning Network.
WARNING: Please understand that the Lightning Network is still in the experimental stage. Do not put the money you can’t afford to lose. Also, BTCPay Server recommends using c-lighting with a pruned node instead of LND. It is possible in BTCPay to enable LND with a pruned node, however the LND implementation does not officially support it. We plan to integrate Sphinx Chat with our LND node. Sphinx Chat isn’t compatible with c-lighting. If you want to use a less riskly implementation, see Set Up BTCPay Server with c-lightning and Add a Channel with Inbound Liquidity.
We’ll cover 5 steps to set up Lightning payments on your BTCPay Server:
- Configure BTCPay Server for Lightning
- Fund Bitcoin wallet
- Open Lightning channel
- Add Inbound liquidity
- Enable Lightning option in BTCPay Store
We’ll cover both adding Lightning during initial BTCPay Server setup and adding Lightning to an existing BTCPay Server.
If you haven’t created your BTCPay Server, you can accomplish a majority of the configuration through through the LunaNode BTCPay Server web form. If you are taking this approach, you want to read through our initial BTCPay Server post first.
LND lightning option. Then add you SSH pubkey, see Using SSH Keys guide from LunaNode. Leave all other options as default, including
m.4 since we are including Lightning. Lighting Alias is optional.
You will need to add ThunderHub following the instructions below starting with logging into the VPS over SSH (you can skip the step to add
If you already deployed your BTCPay Server, you can add Lightning using the LunaNode Dashboard and Command Line.
Use the LunaNode Dashboard to resize from
m.4 per the LunaNode recommendation for running Lightning. Note: this will increase your monthly cost.
You can connect to the VM with SSH using the username and password specified in the Initial Login Details, which you’ll see after selecting the VM from the Dashboard. Alternatively you can save your SSH pubkey during intital set up. See more at https://www.lunanode.com/guides/quickstart.
SSH into your VM replacing
000.00.000.000 with your External IP found in the LunaNode Dashboard. You may also need to provide the filename if you are using a 2nd SSH identity for your anon avatar.
# separate ssh file for my bowtiedchukar identity ssh -i ~/.ssh/id_ed25519_bowtiedchukar email@example.com
Now change to root and cd into the
# on vps firstname.lastname@example.org, change to root sudo su - cd btcpayserver-docker
Add the appropriate environmental variables from the BTCPay Server docs to add
thunderhub then restart.
# on vps email@example.com, export new environmental variables and restart export BTCPAYGEN_LIGHTNING="lnd" export BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-add-thunderhub" . ./btcpay-setup.sh -i
Once your VM restarts, you’ll be running LND and ThunderHub. You can verify they are up and running. Log in to your BTCPay Server then click
Server Settings then
Services. LND and ThunderHub should be listed along with your Bitcoin Full Node services.
We are going to use ThunderHub to manage out Bitcoin and Lightning nodes. From your BTCPay Server
Services tab, click Thunderhub
See information to log in to ThunderHub in your browser.
The first step is to fund the wallet on your Bitcoin node with .001-.0005 Bitcoin. You can get the Bitcoin receive address from the main ThunderHub page.
Once you click
Create Address you can either copy the address text or scan the QR code. We suggest using Strike.me to fund your wallet, but you can send the Bitcoin with any Bitcoin wallet.
Sphinx Chat is a chat service built on Lightning. Later we plan to add a post about using Sphinx with your Lighting node. With that in mind, we are going to use the Sphinx Chat instructions to open our first channel.
Now that your Bitcoin node wallet is funded, we are going to use it to open a channel with one of the Sphinx nodes:
gameb_1: firstname.lastname@example.org:9735 gameb_2: email@example.com:9735
Follow the Sphinx instructions to open a channel using ThunderHub here.
Awesome! You just opened your first Lightning Network channel. Don’t forget to
update your channel’s
base_fee to 0 and
fee_rate to 0.000001. Sphinx will set
their channel to the same.
If you followed the Sphinx instructions, you pushed 2,000 sats to the other side of the channel. If you look at the channel details in ThunderHub, you’ll see 90,000+ on your side of the channel and 2,000 sats on the other side of the channel.
This means you can spend/send 90,000 sats and you can only receive 2,000 sats before you’ll need to increase the sats on the other side of the channel, i.e. add inbound liquidity.
Note: with Breez you can also stream sats to your favorite podcasts, see my previous post Let Your Podcast Audience Stream Sats While They Listen.
Click send on the main ThunderHub page.
Paste the invoice string from your other Lightning wallet and hit pay.
Now when you visit the
Channels tab in ThunderHub, you should have more sats on the other side of the channel (i.e. inbound liquidity). Here I’ve increased my inbound liquidity to 15K sats.
For more options to add liquidity, check out the Lightning Node Management.
Now that your Lightning Node is up and running, you can add Lightning as a payment option in your store.
Now test out the pay button to send $1 using Lightning. You can test it using Strike.me or another Lightning wallet. The cool thing about Strike is you can pay both Bitcoin and Lighting addresses very easily.
Here is the BTCPay Server with Lightning Network selected.
When people use your BTCPay Server, they will now have the option to select Lightning payments for instant, low fee transactions!