Skip to content

Tooling & Building with LNbits

arbadacarba edited this page Oct 4, 2023 · 328 revisions

LNbits has all sorts of open APIs and tools to program and connect to a lot of different devices for a gazillion of use-cases.

When you are new to building start with this MakerBits presentations from Ben Arc about building gadgets based on LNbits.

Come to the Makerbits Telegram Group if you need help with a project - we got you!

230720575-14365092-cbd4-46f7-a24a-3cc85bc81050


| Nostr Signing Device | Archade Machine | Gerty | Nostr Zap Lamp | ATM | LNPoS | Lightning Piggy | Hardware Wallet | Bitcoin Switch | Vending machine | Bolty | Nerdminer | Bitcoin Ticker | BTClock | Lora and Mesh Networking |

| HELPERS & RESOURCES |


NEW! LNbits flyer for merchants & builders

Want to hand over some basic info to a merchant or a building friend of yours ? We are very happy to announce our flyer for everyone to use


IMPORTANT:

  • LNbits works based on the LNURL protocol which requests are valid in two forms: either as https:// clearnet link (no self-signed certificates allowed) or as http:// v2/v3 onion link. To offer LNbits services like LNURLp/w QR codes or NFC Cards, that can be used in the wild, you will need to open LNbits to clearnet (https).
  • Only use DATA-Cables to power your esp32. Not all cables support data in addition to powering the esp. You wouldnt be the first if the cable that came with the esp is a power-only one
  • Make sure to not use a USB-Hub with other devices attached. This can lead to weird effects that are hard to debug (e.g. not starting or stopping).
  • To realize esp projects with a MacOS you will need an UART Bridge Driver. If you have problems with the driver on Mac or Linux systems, you can find those here or, if a TTGO Display is involved this one. If you are on windows and have problems connecting make sure to download the OLD version 11.1.0 because the newer one is not working! You can also find a serial terminal here to check your connection - set to baudrate 115200.
  • Though it is way more comfortable to use Platform.io (e.g. dependencies are installed automatically) we recommend using Arduino for everyone new to building.
  • TT-Go Display S3: The colour of the tab of the screen protector film tells you which controller exactly (ST7735_redtab, ST7735_blacktag, ST7735_greetab, greentab128, ..) has been used to build it. Keep it to be able to debug if you programm yourself and the screen does not display graphics correctly, e.g. colours wrong, mirrored images, or stray pixels at the edges. If you ever need to do this, there is an epic guide on adjusting for different displays
  • Always use lowercase lnurl239xx instead of LNURLl239xx
  • Adding lightning:lnurl1234xyz will create a QR that requests to open the users wallet for this invoice on scan (last installed lightning app on iOS, setting in Android)
  • If you are flashing an esp32 via web will only work with these browsers (TL:DR Chrome, Edge & Opera).
  • Please note this PIN-OUT reference for the esp
  • When you use FOSSoftware or FOSGuides pls always link the author. Everyone loves to watch their baby grow and it also initiates a building chain that is quite awesome to watch :)

NOSTR Signing Device

This very cheap off the shelf nostr signing device is designed to work with Lilygos Tdisplay. Install it onto your ESP32 with this installer. For connection to a Mac make sure to have a UART Bridge installed (see Important section ☝️).

For use with the horse browser extension https://github.com/fiatjaf/horse. The extension for Chrome can be downloaded here

Have a look at this tweet from Ben on how to set it up and use it. If you speak german also this video might help you.

Data is sent to/from the Signing Device over webdev Serial, not the most secure data transmission method, but x1000 better than storing the privatekey on a computer. Clients could support sending to the device directly.

Bildschirm­foto 2023-03-17 um 21 17 24

IMPORTANT: The derivation key is according to NIP-06 m/44'1237'/0`/0/0 As you see we are using the account number 0 (0'). This is very important if you need to restore your account/s.

Arcade machine

Build your own lightning powered arcade console games machine using the LNbits Bitcoin Switch with this kit from the LNbits shop or build your own.

Bildschirm­foto 2023-03-17 um 21 20 04

zap-lamp

Get a visual Zap when someone zaps you.

  • Show a signal when a zap is sent to one or all nostr npubs
  • Background brightness control
  • Easily configure to use your own nostr relay
  • Easy configuration to work with any npub

https://github.com/lnbits/nostr-zap-lamp

Gerty

Your personal bitcoin assistant! Gerty made by Black Coffee will keep you updated on all things related to the Bitcoin network. Gerty is connected to your own LNbits or the demo LNbits instance and displays what you configured it to show in the Gerty extension.

What does Gerty show?

  • Current block height
  • A list of Satoshi's quotes from bitcointalk.org
  • Your LNbits wallet balance
  • An onchain dashboard
  • A lightning dashboard
  • A mining dashboard
  • Current Bitcoin price in your preferred currency
  • Website status check
  • Mempool fees [coming soon]
  • Samourai Whirlpool dashboard [coming soon]

Gerty can run from it’s internal battery or can be powered via a USB-C connection and will update at regular intervals chosen by also you. You can get the kit from the LNbits shop or build your own. Hardware-Requirements and setup can be found in a separate repo.

226032862-677c3d95-60e0-493b-9c0e-622f03aaf613

ATM

Deposit and withdraw in your shop or meetup! The ATM has two versions, one for coins only and one for coins + papershitcoins.

Coins only

This is a do-it-yourself project consisting of a mini-computer (Raspberry Pi Zero), a coin acceptor, a display, a 3D printed case, and a Bitcoin Lightning wallet as a funding source. It exchanges fiat coins for valuable Bitcoin Lightning ⚡ Satoshis.

The user can pick up the Satoshis via QR code (LNURL-withdraw) on a mobile phone wallet. It works with LNbits as well based on BTCPay server, LNTXBOT is not longer an option. You can get the components as individual parts and build the case yourself e.g. from Fulmo who also made a guide on it. The code can be found on the ATM github project page and needs to be run with the extension LNURLdevice->POS.

readme_atm_pv

Big (FOSSA) ATM

The Fossa needs to be run with the extension LNURLdevice->ATM. Please be aware that the Fossa ATM uses another code base. Black Coffee made a nice enclosure for the Fossa ATM

Bildschirm­foto 2023-01-22 um 02 43 37

If you have questions on building the Fossa please check the github or come to the makerbits group.

Be creative with the casing !

photo_2023-06-29_00-37-05

IMG_0625.MOV

The Bat-ATM 🦇

Check this out

The wonderful Leigh has made this fun ATM. You can support the development here.

F3kXTUXW0AAtS1c

LNPoS Terminal

There are a few devices for this section. Let´s start with the offline terminal. The LNpos is a self-sufficient point of sale terminal which allows offline onchain payments and an offline Lightning ATM for withdrawals. Free and open source software, free from intermediaries, with integrated battery and WLAN. You can get the 3D print as well as the whole kit from the LNbits shop or build the LNpos from your own hardware. If this doesnt work right away check this guide on each single step.

It allows:

  • LNPoS Online interactive Lightning payments
  • LNURLPoS Offline Lightning Payments. Passive interaction, sharing a secret as evidence
  • OnChain For onchain payments. Generates an address and displays a link for verification
  • LNURLATM Offline Lightning Payouts. Generates LNURLw link to do withdrawals

You might ask yourself how it is possible to handle payments offline ? There is a checksum displayed as a pin. This pin is only presented to the buyer after payment. If the buyer reads the seller´s pin, it is a confirmation that the payment has been received by the node. TL:DR: So the trick is, that the PoS can be offline if the buyer is online :D

lnpos

If you are using a T-Display you can find a tutorial here.

Have a look also at the TinyPoS solution - a LNPoS on a keychain :)

There also is a version for the M5Stack.

Bildschirmfoto 2023-05-10 um 21 02 46

POS with NFC

We cannot provide a guide for this online-PoS version atm but we can hand you links on where to buy the right model (pls also look yourself for other vendors) All that is for sure is you need an app for the printing function and chrome browser (for web-nfc). We can though hand you the libraries and some general guides linked within Resources.

AliExpress

Amazon

Here you can see it in action

Bildschirm­foto 2023-03-31 um 20 01 36

**VERY IMPORTANT ** If you set up a boltcard for this do not, we repeat, do NOT delete your card/.json file or even the complete wallet with the keys unless your card is either physically destroyed or already overwritten!! You will need those keys to rewrite the card. If you lose them your card would be fixed to that forever.

Lightning Piggy

Bildschirmfoto 2023-07-30 um 19 55 59

The Lightning Piggy helps your kid saving. It comes with an own webinstaller that just works on the browsers that are mentioned in the important section.

Hardware Wallet

Build your own, stack harder! The hardwarewallet is a very cheap solution for builders. The projects´ code and installation instructions for the LNbits hardware wallet can be found on github.

hwwallet

Bitcoin Switch

Turn things on with bitcoin! Candy dispenser, vending machines (online), grabbing machines, jukeboxes, bandits and all sorts of other things have already been build with LNbits tools. Link to the Bitcoin Switch Github Repo and the most detailed guide around from Axel that also has a guide for a small plebtag-version for 5l keks driven by a linear motor. The official webinstaller can be found here.

If you want to build a beertap see different sort of codes in 👇 Resources.

lnbits-btc-switch.png

NOTE: Make sure to read the important section ☝️ at the beginning of this page.

If you need an offline-version standing in the wild, see the next chapter.

Vending machine

This code works similar to the LNpos (offline). Note that the setup-video for the vending machine misses the new way of installing it via the new LNURL device extension. The vending machine project code resides on github. A more up-to-date version would be this one from Axel.

Bildschirm­foto 2023-02-16 um 15 38 00

A few links where you can buy such


More Fun Projects

These do not use LNbits but the same hardware that we use and are incredibly interesting. If you wonder, if you can use another esp-type please check this comparison table of different esps

A watch - but cooler

An open source watch based on an esp32 sounds fun to you? There is an open sourced version called watchy you can also buy readymade. It also has an open source SDK Kits to develop own watch faces. You can find another watch here that actually is a stealth hardware wallet.

Bolty

A Boltcard Provisioning Device! You can write your card either with the Bolt Card Wallet or the Bolt Card App. Also you can do a device yourself (based on an esp32) that can write Boltcards.

Bildschirm­foto 2023-05-06 um 00 26 36

Watch a video tutorial here

Github-Code for Arduino can be found here and here the binaries for the esptool-js. Please note that the upload via Arduino or platform.io is not recommended and will possibly not work. If you can make the Arduino Library work for the NFC Module PN532 which you wiil find 👇🏼 in Resources you´re sort of a hero. Get your Bounty here if you made it https://geyser.fund/project/boltcard

**VERY IMPORTANT ** If you set up a boltcard for this do not, we repeat, do NOT delete your card/.json file or even the complete wallet with the keys unless your card is either physically destroyed or already overwritten!! You will need those keys to rewrite the card. If you lose them your card would be fixed to that forever.

photo_2023-05-18_20-29-43

1. Download bolty_binaries.zip and unzip it
2. connect ESP32 (TTGO) to the computer
3. open the page https://espressif.github.io/esptool-js/
4. select "Connect", set the correct connection / COM port and press "Connect".
5. select "Choose File" and choose the file 0x1000_bootloader.bin from the folder.
6. select "Add File", set flash address 0x8000, "Select File" and select 0x8000_partitions.bin
7. repeat this for the remaining three (firmware, spiffs, boot_app0)
8. select "Program" => the ESP32 is flashed. "Leaving..." means it is done! 9.
9. now press the reset button once or remove the ESP32 from the power supply once.
10. the Bolty is now reachable via Wifi, Access Point = SSID : Bolty / Password : wango123
11. in the browser enter the IP 192.168.4.1, this should bring up the Bolty website
12. for the setup it asks for a username and password: "bolty" for both

Nerdminer

Mining on an TTGO T-Display S3 is a thing 😅 You can find the GitHub of the newest version from Bitmaker and there also is a Nerdminer Pool.

You should in this case flash the esp with Bitmakers own web-flasher on Edge, Chrome or Opera. Try Edge first when you are on iOS.

NOTES:

  • If you get into trouble and it doesnt work properly try flashing the last file first and only afterwards the other three.
  • Make sure to bookmark the IP-address that is shown after installation when opening the webinterface for the first time. This is your future dashboard showing your mining process.
  • If the esptool flashing website doesnt work you can also try this tool
  • If this also doesnt work please joing the Nerdminer Telegram Group of Bitmaker for Troubleshooting
Bildschirm­foto 2023-05-06 um 00 27 49

Be creative with the casing and check this or that one for inspiration :) There also are some cases ready for print on Thingiverse.

Expect to find a block within 1 Trillion Years !

photo_2023-05-14_21-37-22

There now also is a solar-powered version and a 19" 1U Mining RACK PCB.

Bitcoin Ticker

In this repo you can find an e-Paper Bitcoin trading/stats display.

Egge also made a lamp that changes the colour on change of "the btc price".

BTClock

btlcock1

Djuri has build an absolute incredible Clock that shows the blocktime. And because he is a badass developer he even included a webUI to configure it and a link to an STL file on Thingiverse..

btclock2

What you need

  • 7x 2.13 b/w eInk screens (e.g. from https://aliexpress.com/item/1005004644515880.html or ebay) (the b/w/r don't have fast partial refresh)
  • MCU (preferably an ESP32)
  • 3D Printer
  • Soldering Iron (to solder the header pins)
  • Some dupont wires are handy, but if you chain them using the 2x8 pin headers you don't necessarily need them

photo_2023-05-10_18-54-14

Watch a video of the BTClock in action.

Djuris codebase and guide can be found here. Tick, Tock, next Clock 🕰️

LoRa

Lora and Mesh Networking also is a very interesting topic. Have a look at the following introductions, solutions, libraries and guides.

lora1

Bildschirm­foto 2023-05-06 um 00 23 38

There have been some pilot projects sending bitcoin via ham radio but no out-of-the-box solutions for lightning atm. Come and build with us in the Makerbits Telegram Group.


Resources

Guides

Code

Libraries

Concerning Nostr and LoRa also see LoRa section for a lib

Bots

  • Nostr Bot - control your BoltCard with a Nostr Bot

Hardware

PCB-Design

Casing

Other Helpers

Web-Page needed and no plan ?

Graphical QR Codes

Bitcoin Sounds



IF YOU ENCOUNTER TROUBLE DO NOT GIVE UP!

If you have checked this docu and your problem is not handled in the links given, come on over to the MakerBits or the german builders group.

photo_2023-04-08_14-25-23