Add Tipping to your Site with LNBits

I've been looking for a way to add Lightning tipping to my blog since I started it. The only options I knew of were BTCPayServer, or rolling your own with a full node and Lightning on a VPS. BTCPayServer is really powerful and I know a lot of people use it. As far as I know it requires a full node to run which means $100+ dollar month bill for hosting on a VPS, or exposing your local network to the outside and running it at home.

None of these options appealed to me. I have a node at home but I don't want to expose it to the outside world more than I have to. And I don't think it's worth it to pay for a full node on Azure (or whatever your preferred cloud hosting provider is). There is one more option which would be using a 3rd party service, but that sort of defeated the whole purpose of what I was trying to do. I had moved on from thinking about how to do this, assuming I would come across a better way. And when I started watching some of Ben Arc's videos about the hardware he was building using LNBits, I realized this is what I had been looking for.

LNBits

image lnbits

If you've never heard of LNBits it's described as a "free and open-source lightning-network wallet/accounts system". Links for all thse projects are listed at the bottom BTW. I had heard of it, and actually installed it on an old Umbrel node I had. I think I had opened it up and just decided I didn't have a need for creating accounts within my own Lightning wallet and never really looked at it again. But what I didn't realize is that LNBits is a lot more than just creating multiple wallets or accounts. If you have a Lightning node and want to do some project with it, chances are LNBits can help you do that.

LNBits Extensions

What I didn't realize is that when you create a wallet in LNBits you can add extensions to it.

image

There are quite a few extensions available. One of them is actually called "Tip Jar" which sounded like what I was looking for. I actually ended up using LNURLp but that would have worked too.

So it seemed like I had found the solution I was looking for. But, there still remained the issue of where to host this. I could install this on my node at home but then I would have to expose it to the internet. I didn't really want to do that. But, l was interested enough to keep learning more about LNBits and how people used it. That's when I came across this YouTube video:

image 25min LNbits/C-lightning VPS install with domain and SSL!!!

In this video Ben goes through the process of setting up LNBits on a VPS with CoreLightning as the Lightning node backing it. The important part about this setup that he describes is the use of a CoreLightning plugin called Trustedcoin from fiatjaf.

As I mentioned earlier, running a full bitcoin node with CoreLightning etc. on a VPS is pretty expensive and not something I was willing to pay for. What Trustedcoin does is provide block headers to CoreLightning from online block explorers instead of a local full Bitcoin node. Obviously there is a security trade-off here but as long as you withdraw your tips occasionally I think it's worth it.

This means the VPS needed to run this setup is pretty much the cheapest possible option out there. I'm currently running mine on Azure, with a few other things running on there too and it looks like it will be around $12 a month.

I won't go through the whole setup here, the video does a really job explaining it. Including getting SSL setup.

Once I had LNBits running on my VPS I created a wallet, added the LNURLp extension. Created a Pay Link QR code and put it on my site. And that was it.

As the name of the extension suggests the Pay Link uses LNURLp. It is supported by most Lightning wallets and allows you to set a range of sats for a tip, you can also setup a webhook if you want to be notified each time you get a tip.

And that was pretty much it. You can see it below, try it out on your wallet (whether or not you actually leave a tip) so you can see for yourself.

Conclusion

This is just one of the many extensions available on LNBits. Now that you can set this up so easily, and cheaply it really opens it up to a lot more people. LNBits is a really powerful project and I think a lot of people aren't aware of everything you can do with it. Hopefully this will encourage more of you to try it out.

Thanks to Ben Arc, fiatjaf, and everyone working on these projects for us to use.

Links

Leave a tip