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:
Would be encoded to:
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.
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.
- 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.