Crates.io | bp-derive |
lib.rs | bp-derive |
version | 0.11.0-beta.9 |
source | src |
created_at | 2023-12-25 20:06:08.652076 |
updated_at | 2024-10-31 15:13:29.344228 |
description | Bitcoin addresses and invoices |
homepage | https://lnp-bp.org |
repository | https://github.com/BP-WG/bp-wallet |
max_upload_size | |
id | 1080419 |
size | 101,993 |
Modern, minimalistic & standard-compliant wallet-level libraries: an alternative
to rust-bitcoin
and BDK libraries from LNP/BP Standards Association.
The main goals of the libraries are:
bp-wallet
is
released;bp-primitives
] library (a part of [bp-core
] library),
which is planned to be more extensively audited and ossified alongside
bitcoin protocol (while this library will continue to evolve with better
APIs and to match new wallet standards);Send + Sync
, meaning that they can be used in any multi-thread or async
environment;rust-bitcoin
?The library doesn't rely on rust-bitcoin
crate. The reasons for that are:
rust-bitcoin
provides "all in one" solution, covering many parts of bitcoin ecosystem, like
bitcoin peer-to-peer protocol, not really used by a wallet;rust-bitcoin
with each release significantly breaks
APIs, being in constant refactoring since early 2022 - a process likely to
last for few years more; update of wallet libraries after each major change is
painful and takes a lot of developers time and effort, as well as introduces
API breaking changes downstream preventing all dependent libraries from
stabilization;zeroise
and other
approaches doesn't prevent that). Thus, providing secret keys alongside
other APIs may lead to non-secure design of the wallet and should be avoided;rust-bitcoin
provides next
to each other consensus-related structures and higher level wallet
abstractions, which contradicts to the design decision we are making in this
library;rust-bitcoin
doesn't
differentiate different forms of scripts (pubkey, sig, witness etc.), while
in this library we are using semantic type approach, providing type-safe
variants for each semantically-distinct entity even if it shares the same
representation with others.As one may see from the list, rust-bitcoin
design and maintenance approach
contradicts to the major aims of this project - in fact, this project was
created by Maxim Orlovsky (who was the most active contributor to
rust-bitcoin
since Q1 2019 till Q2 2022) in order to address these issues
using different set of trade-offs, providing an alternative to rust-bitcoin
to those who needs it.
Miniscript is great for many purposes, but it can't be used for many cases,
including representation of BOLT-3 lightning channel transaction outputs,
re-use of public key in different branches of pre-taproot scripts [1][ms-1].
Miniscript is also still unstable, having recent changes to the semantic due
to discovered bugs [2][ms-2] [3][ms-3]; meaning that the descriptors created
with miniscript before may not be able to deterministically reproduce the
structure of some wallet UTXOs in a future. Finally, the existing Rust
miniscript implementation [rust-miniscript
] inherits all rust-bitcoin
tradeoffs, and is much more unstable in terms of APIs and semantic. Thus, it was
decided to use this library to provide an alternative to miniscript with
introduction of [script templates][#script-templates] convertible to and from
miniscript representation - but with some externally-provided tools instead
of adding miniscript as a direct dependency here.
BDK is great, but it relies on rust-bitcoin
and rust-miniscript
and can't
be used outside of that ecosystem, inheriting all tradeoffs described above.
Since we try to address those trade-offs, we had to create a BDK alternative.
descriptor-wallet
?Descriptor wallet was an earlier project by the same
authors trying to address rust-bitcoin
issues by building on top of it. With
the recent v0.30 rust-bitcoin
release it became clear that the effort of
adoption to API-breaking changes is much higher than creating a new independent
project from scratch, while at the same time the new project may address
rust-bitcoin
issues in much more efficient and elegant way. Thus, it was
decided to discontinue descriptor-wallet
and start the new bp-wallet
project
instead.
Contribution guidelines can be found in CONTRIBUTING
Minimum supported rust compiler version (MSRV) is shown in rust-version
of Cargo.toml
.
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.
The libraries are distributed on the terms of Apache 2.0 opensource license. See LICENCE file for the license details.