This project shows an illustrative use case for Internet of Things (IoT) control using the Bitcoin Lightning payment network. Payments of a certain amount to a Lightning address trigger various functions in a TESLA Model 3. In addition to functions such as honking, flashing lights or winking with the fuel cap, the car plays music on request or lets the payer get in and drive.
The advantage of IoT control via the Lightning network is that it works completely decentrally via any Lightning-enabled app. It is therefore not necessary to build a separate infrastructure with user interfaces and data communication. This results in the following advantages:
- Reliability through use of the decentralized infrastructure of the Lightning Network
- Reduced effort through use of existing infrastructure in terms of data transport or development and provision of applications
- Increased usability because the user can use their usual app and not need a separate app for each application.
Technologies used
- Bitcoin Core Node
- Core Lightning nodes
- btcpay server for lnurl addresses and shop deployments
- Python with pyln-client lib, which connects directly to the Core Lightning Node and listens for incoming payments and controls the Tesla via the teslapy library
Implementation
A Python program runs on the server and continuously listens for incoming payments at the Lightning Node. When a payment is received, the program checks the amount of the payment. Depending on the payment amount, a certain function is triggered in the car via the TESLA API. It was important to ensure that the signal comes directly from the Lightning Node and that no other intermediary software such as a btcpay server is used in order to guarantee maximum stability.
A btcpay server comes into play to offer the functions via the shop system. An lnurl address is also provided via the btcpay server, as BOLT12 payments are not yet supported by the common Lightning apps. If something goes wrong at this point, the payment could at most not be made. In any case, control takes place directly via the incoming payment on the Lightning Node.
Discussion and outlook
This project is intended to provide an outlook on the possibilities of the Bitcoin network that go beyond simply processing payments. Since the Lightning Network makes it possible to make the smallest payments in monetary amounts, payments can be used as Internet of Things tax signals. It would be possible, for example, to make a fleet of cars available for trips without this having to be managed via a central location. The customer does not need a special application or registration with associated data protection issues. He pays the necessary amount (which may also include a security that will be repaid), the car opens the doors and lets the customer drive. The concept can be used in many areas, such as access to hotel rooms.