Lay the foundation for your Lightning Network enabled website.
- Setup two lightning nodes.
- Create the foundation for your website.
- Send a Lightning Network transaction.
Ready to be your own bank using free open-source software and cheap hardware? The core of this project relies on running the latest version of the Lightning Network lnd 0.5 and Bitcoin core 0.17.0. We will be setting up two Lightning Network nodes, BTC Pay Server hosted on Microsoft Azure and Raspiblitz running on a Raspberry Pi 3.
Step 1: Buy Hardware and Setup Accounts
Being your own payment processor is not free! You will need to make small investments in hardware and software to get yourself set up.
RaspBerry Pi 3 Requirements .
Create an Azure account.
Sign up for SquareSpace.
Once your amazon order arrives with your hardware follow this tutorial to set it up. Youtube Link
Creating accounts on Azure and Squarespace are simple and quick but will require a monthly subscriptions once you deploy your website.
Step 2: Setting Up Raspiblitz
The Raspiblitz is the fastest and cheapest way to get your own Lightning Node running on a RaspBerry Pi. I prefer having my own Lightning Node at home so I can easily experiment sending transactions and creating invoices with BTC Pay Server, while simultaneously running in the cloud.
Instead of creating my own setup tutorial, I will link the guide that I followed.
Things to be aware of before starting the setup process:
- Make sure to connect your RaspBerry Pi directly into your router.
- Downloading the Bitcoin blockchain will take at least 1–3 days depending on your internet.
You will be waiting a while for your Raspberry Pi to download every transaction that has happened on the Bitcoin blockchain. I recommend taking the next few days to focus on building your website. Squarespace has great website templates to get you started right away.
Step 3: Set Up Your Domain
Purchase your web domain.
I use Namecheap to purchase and manage all of my domains. I found their service to be the cheapest and easiest to manage, however,you can use any domain service you have experience with.
Create Your Website.
You can create & style your own website. You will have to register your domain through Squarespace.
If you have not transferred a web domain before, the process can be precarious. Squarespace does a great job explaining all the steps you need to take.
Step 4: BTC Pay Server Deployment
BTCPay is a non-custodial invoicing system which eliminates the involvement of a third-party. Payments with BTCPay go directly to your wallet, which increases privacy and security.
Thanks to Nicolas Dorier, running your own Lightning node in the cloud has never been easier. With the click of a button you can deploy your own Lightning node to Azure.
Things to be aware of before starting the setup process:
- We will be using a Pay-As-You-Go service for hosting your node on Azure ($30–$40 a month).
- You will need to have a web domain set up prior to deploying your node.
Nicolas created a great video that walks you through deploying BTC Pay Server to Azure and setting up your web domain.
Step 5. Sending a Lightning Transaction
If you have made it this far, congratulations, you are smarter than the average Bitcoiner. So far, you have set up two separate Lightning nodes and have the foundations of your own website. Soo what is next?
Let’s send a transaction on the Lightning Network between your two nodes to see how everything works.
Connecting BTC Pay Server to the Zap Wallet.
If you did not connect your BTC Pay Server to the Zap wallet when deploying your BTC Pay Server node, go back to step 4 and watch the end of the video before moving forward.
Funding & Opening Channels.
The first step in sending Lightning Network transactions is sending Bitcoin to your Lighting wallet. This is done by creating a regular on-chain transaction and sending BTC to your Lightning Network Bitcoin Address.
On your Raspiblitz, your Bitcoin Lightning wallet address can be found by going to Funding.
In the Zap wallet, click on the QR code logo next to your BTC balance. You will then be displayed with your nodes Public Key and your Bitcoin Address.
To make it easy, lets use $5 worth of BTC. We will send $2.5 to your BTC Pay Server and $2.5 to your Raspiblitz.
Once you have funded both of your Lightning Network wallets, the next step is to open a Lightning channel between the two.
Go to the ‘Connect’ tab on the Raspiblitz and enter the public key for your BTC Pay Server node. The public key can be found in the same location as your Bitcoin Address on the Zap wallet.
Once you have connected to your BTC Pay Server Node you will be able to open a Lightning Channel. Go to the ‘Channel’ tab on the Raspiblitz and select your BTC Pay Server Node. You will be asked to fund the channel by entering a specific amount of satoshis. I would recommend adding around 150000 sats for testing.
All of the heavy lifting is done!
On the Raspiblitz go to the ‘Receive’ tab create a Lightning invoice! To show the power of the Lightning Network, create a 1 satoshi invoice payment.
The invoice address will start with lnbc. After pressing the ‘Pay’ button in the Zap Wallet, copy this address and paste it into the destination address.
Welcome to the future.
Now that you know how to send and create Lightning payments, you are ready to start using Bitcoin in your website!
Payment Button with BTC Pay Server.
Having the ability for a user to be presented with a custom Lightning invoice is pretty powerful. BTC Pay Server allows you to easily create payment buttons so your customers can easily pay with Bitcoin on your website.
To create a payment button, go to your stores ‘Settings’ section of BTC Pay Server.
Once you have set the parameters of your payment invoice, scroll down to the ‘Auto Generated Embedded Code’. Copy the code and embed this button into your Squarespace website.
The finished product is a great looking, fully customizable button that creates Bitcoin Lightning Payment Invoices.
Lightning Powered Articles.
Alex Bosworth created ‘Unchained’, a tool to create your own Lightning-Powered HTML/JS article.. Just like the site Yalls.org, you can create your own Lighting-Powered articles that accept micropayment bitcoin transactions.
To access the articles on my website, you have to pay the Lighting invoice 100 satoshis or $0.0038 in USD.
To create these Lightning-powered articles, run the line of code at the bottom of the ‘Unchained’ webpage on your Raspiblitz.
This is an example of the code that will be displayed in pink above the create embedded code button.
Copy the code and head over to your Raspiblitz. Go to the last page on the startup screen marked X “Console/Terminal”.
Paste the lncli invoice code in the terminal. You will be given the output of an lncli invoice which you will need to copy and paste back into the “Payment Request to Unlock” area on the Unchained website.
With the Lightning Invoice pasted, press the ‘Create Embedded Code’ button on the ‘Unchained’ website. All the codes needed to paste in Squarespace are now below.
You have completed the Lightning Network Website Integration.
If you made it this far, I salute you! You are a reckless MF. If you pay the 1 satoshi Lighting invoice on my website and leave a return address, I will buy you a beer!