13 unstable releases (4 breaking)

0.9.0 Jan 25, 2023
0.9.0-rc.1 Dec 26, 2022
0.9.0-alpha.1 Nov 17, 2022
0.8.0 Jun 30, 2022
0.5.0 Nov 27, 2021

#8 in #bech32

Download history 55/week @ 2023-12-05 111/week @ 2023-12-12 89/week @ 2023-12-19 58/week @ 2023-12-26 29/week @ 2024-01-02 82/week @ 2024-01-09 63/week @ 2024-01-16 73/week @ 2024-01-23 29/week @ 2024-01-30 66/week @ 2024-02-06 80/week @ 2024-02-13 52/week @ 2024-02-20 121/week @ 2024-02-27 81/week @ 2024-03-05 98/week @ 2024-03-12 72/week @ 2024-03-19

380 downloads per month
Used in 29 crates (2 directly)

MIT license

22KB
429 lines

LNP/BP Library

Build Tests Lints codecov

crates.io Docs unsafe forbidden MIT licensed

The repository represents a set of libraries implementing LNP/BP specifications https://github.com/LNP-BP/LNPBPs not fitting into a scope of other existing LNP/BP core libraries (client-side-validation, BP, LNP, RGB, invoicing). It can be used to simplify development of layer 2 & 3 solutions on top of Lightning Network and Bitcoin blockchain.

Currently, the repository contains the following crates:

  • lnpbp_bech32: library implementing LNPBP-14 standard of Bech32 encoding for client-side-validated data.
  • lnpbp_chain: library providing chain parameters for bitcoin-related blockchains;
  • lnpbp_elgamal: library implementing LNPBP-31 standard for ElGamal encryption using Secp256k1 curve;
  • LNPBP umbrella crate containing all aforementioned libraries.

Other libraries, implementing LNP/BP specifications, not included in this crate:

The current list of the projects based on these libraries include:

  • RGB Node
  • LNP Node enabling:
    • RGB extensions
    • DLC extensions
    • Lightspeed payments
    • Multi-peer channels
    • Faster lightning experiments (quicker adoption of eltoo, Taproot etc)
  • BP Node: Indexing service for bitcoin blockchain; more efficient & universal Electrum server replacement. In perspective - validating Bitcoin network node (using libbitcoinconsus)

Potentially, with LNP/BP libraries you can simplify the development of

  • Discreet log contracts
  • Implement experimental lightning features
  • Do complex multi-threaded or elastic/dockerized client-service microservice architectures

The development of the libraries is supported by LNP/BP Standards Association.

Install

Clone and compile library

Minimum supported rust compiler version (MSRV): 1.59.0.

git clone https://github.com/lnp-bp/rust-lnpbp
cd rust-lnpbp
cargo build --release --all-features

The library can be found in target/release directory.

You can run full test suite with:

cargo test --workspace --all-features

Please refer to the cargo documentation for more detailed instructions.

Use library in other projects

Add these lines to your Cargo.toml file at the very end of the [dependecies] section:

lnpbp = "~0.5.0"
lnpbp_bech32 = "~0.5.0"
lnpbp_chain = "~0.5.0"
lnpbp_elgamal = "~0.5.0"

Contributing

Contribution guidelines can be found in a separate CONTRIBUTING file

More information

Policy on Altcoins/Altchains

Altcoins and "blockchains" other than Bitcoin blockchain/Bitcoin protocols are not supported and not planned to be supported; pull requests targeting them will be declined.

Licensing

See LICENCE file.


lib.rs:

Library implementing LNPBP-14 standard: Bech32 encoding for client-side-validated data.

Types that need to have data1... and z1... bech 32 implementation according to LNPBP-14 must implement ToBech32Payload and FromBech32Payload traits.

Bech32 id1... representation is provided automatically only for hash types implementing bitcoin_hashes::Hash trait

Dependencies

~11MB
~158K SLoC