
URLs as Lightning invoices (bech32)
LNURL endpoints are all encoded with bech32 which is the same as bitcoin addresses and standard lightning invoices. Encoding endpoints like this allows for easy integration into existing LN services/apps since most of these would already have functionality built in to receive/send and encode/decode bech32 values.
For example, this endpoint:
https://service.com/api?q=3fc3645b439ce8e7f2553a69e5267081d96dcd340693afabe04be7b0ccd178df
Would be encoded to:
LNURL1DP68GURN8GHJ7UM9WFMXJCM99E3K7MF0V9CXJ0M385EKVCENXC6R2C35XVUKXEFCV5MKVV34X5EKZD3EV56NYD3HXQURZEPEXEJXXEPNXSCRVWFNV9NXZCN9XQ6XYEFHVGCXXCMYXYMNSERXFQ5FNS
When an LNURL-enabled app receives an LNURL-specific bech32 string, it would decode the string to get the URL and then send the appropriate requests to start the relevant LNURL flow.
Libraries #
Below are a list of libraries for encoding and decoding LNURLs.
- go-lnurl – lnurl helper structs, encode/decode, verify signatures, misc helpers.
- lnurl-platformio – Implementation of lnurl in C++ for PlatformIO.
- js-lnurl – Tools for adding lnurl support in a JavaScript wallet.
- php-lnurl – Easy PHP encoding and decoding of bech32 lnurls.
- python-lnurl – Tools for dealing with lnurl in Python.
- lnurl-ruby – A gem that provides helpers to work with lnurl from Ruby.
- lnurl-rust – Rust helpers for lnurl.
- dart_lnurl – Library for lnurl in Dart.