Skip to main content

Lightning BOLT11 utils

github-tests-badge github-mypy-badge codecov-badge pypi-badge pypi-versions-badge license-badge

This is an implementation of the Lightning BOLT11 specification, based on previous work by Rusty Russell, the Electrum Wallet team, and the LNbits bolt11 helpers created by @fiatjaf.

resources

installing

$ git clone https://github.com/lnbits/bolt11
$ cd bolt11
$ poetry install

running CLI

$ poetry run bolt11 --help
$ poetry run bolt11 decode

run all checks and tests

$ make

using pre-commit as git hook

$ poetry run pre-commit install

running CLI

$ poetry run bolt11 --help

running CLI decode

$ poetry run bolt11 decode lnbc20m1pvjluez.....
{
  "currency": "bc",
  "amount": 2000000000,
  "timestamp": 1496314658,
  "signature": "6a6586db4e8f6d40e3a5bb92e4df5110c627e9ce493af237e20a046b4e86ea200178c59564ecf892f33a9558bf041b6ad2cb8292d7a6c351fbb7f2ae2d16b54e",
  "description_hash": "3925b6f67e2c340036ed12093dd44e0368df1b6ea26c53dbe4811f58fd5db8c1",
  "features": {
    "var_onion_optin": "required",
    "payment_secret": "required"
  },
  "fallback": "1RustyRX2oai4EYYDpQGWvEL62BBGqN9T",
  "route_hints": [
    {
      "public_key": "029e03a901b85534ff1e92c43c74431f7ce72046060fcf7a95c37e148f78c77255",
      "short_channel_id": "66051x263430x1800",
      "base_fee": 1,
      "ppm_fee": 20,
      "cltv_expiry_delta": 3
    },
    {
      "public_key": "039e03a901b85534ff1e92c43c74431f7ce72046060fcf7a95c37e148f78c77255",
      "short_channel_id": "197637x395016x2314",
      "base_fee": 2,
      "ppm_fee": 30,
      "cltv_expiry_delta": 4
    }
  ],
  "min_final_cltv_expiry": 9,
  "payment_hash": "0001020304050607080900010203040506070809000102030405060708090102",
  "payment_secret": "1111111111111111111111111111111111111111111111111111111111111111",
  "payee": "03e7156ae33b0a208d0744199163177e909e80176e55d97a2f221ede0f934dd9ad"
}

running CLI encode

$ poetry run bolt11 encode '{
  "currency": "bc",
  "amount_msat": 1000,
  "date": 1590000000,
  "payment_hash": "0001020304050607080900010203040506070809000102030405060708090102",
  "payment_secret": "1111111111111111111111111111111111111111111111111111111111111111",
  "description": "description"
}' e126f68f7eafcc8b74f54d269fe206be715000f94dac067d1c04a8ca3b2db734

Release files for bolt11 2.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bolt11 2.0.6
File Size Uploaded
bolt11-2.0.6.tar.gz 14.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bolt11 2.0.6
File Interpreter ABI Platform
bolt11-2.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 31.5 kB

Release files / bolt11-2.0.6.tar.gz

Download URL bolt11-2.0.6.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
02d7e6273a8869911504dbcb732894d58e1d8c96b53ed0e968a9c5f90ab5c5a7
BLAKE2b-256 checksum
How to use checksums
7109a7d6be38655c18803e660dc56fb695c091562a80f16ff1c8549cb20b5374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1021-azure

Release files / bolt11-2.0.6-py3-none-any.whl

Download URL bolt11-2.0.6-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a1b4d33e028ce110bd3e5a2b8a95d8a2c5221f2e0dd64cbccb8c70153e7d643
BLAKE2b-256 checksum
How to use checksums
2a37b366b6457e9a50be76f2fc3d635693d3bc1ac4a59c6de99a55f3ace8c579
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1021-azure

Release history Release notifications | RSS feed

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

This release

2.0.6 This release

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page