This project is the culmination of the search to find a recipe to enable real world events to be triggered from a Bitcoin Lightning Network payment.
I call it the “Lightning Network Do Something Module”.
It all started when I saw a video of a Lightning Network (LN) payment triggering a beer to be dispensed from a tap. How awesome? A large part of my interests revolve around the blending of natural and digital worlds. So getting a LN payment to trigger a real world event was of serious interest!
A few notes about the underlying technology before proceeding.
The Lightning Network is a Layer 2 protocol built on top of Bitcoin, which is Layer 1. It enables smaller payments to be transacted nearly instantly, for nearly free, anywhere across the world. You can read more via the white paper here. For a video explanation Andreas Antonopoulos has a great Non-Technical Video and also a Technical Video.
A good starting point was this video by ArcBTC where he used an ESP32 microcontroller to handle a LN payment whereby it then dispensed candy from a machine. More searching led to some of his latest projects, LNtrigger, where the M5Stack was used for it had an integrated display for showing a QR code while still using the ESP32 chip. Nice.
This kind of innovation enables the proverbial “coffee” to finally be purchased with Bitcoin. It’s also what enables entire nations like El Salvador to use Bitcoin on a daily basis as legal tender.
Besides the ability to send value to anyone on the internet it does so in a way that incurs a virtually non-existent fee. Something akin to 0.01%, usually less than 10 Satoshis. Compare to Visa’s 2.5-3%. Additionally, Visa is purported to be able to handle 24,000 transactions a second while the Lightning Network can handle up to 25 million transactions a second.
What’s more is that the Lightning Network is free, open source, can be self-hosted, and is easy to setup on all sorts of computers, phones, servers, IOT devices, and microcontrollers. This flexibility allows for other hardware and codebases to integrate with it and further innovate. Hence, this project!
Okay now that we have some of the technicals out of the way let us discuss this project in particular.
In the video below you can see this in all it’s glory where I hooked up a blender to be turned on after a successful payment.