#script #bitcoin #crypto #string-format

no-std miniscript

Miniscript: a subset of Bitcoin Script designed for analysis

54 releases (23 stable)

12.2.0 Aug 6, 2024
12.1.0 Jul 10, 2024
12.0.0 May 22, 2024
11.2.0 Jul 23, 2024
0.1.0 Nov 13, 2018

#9 in #bitcoin

Download history 8417/week @ 2024-07-29 8353/week @ 2024-08-05 7415/week @ 2024-08-12 7822/week @ 2024-08-19 9328/week @ 2024-08-26 7793/week @ 2024-09-02 7169/week @ 2024-09-09 7569/week @ 2024-09-16 8561/week @ 2024-09-23 7582/week @ 2024-09-30 8829/week @ 2024-10-07 10162/week @ 2024-10-14 9120/week @ 2024-10-21 8991/week @ 2024-10-28 9833/week @ 2024-11-04 8947/week @ 2024-11-11

37,370 downloads per month
Used in 168 crates (54 directly)

CC0 license

4.5MB
46K SLoC

Build

Minimum Supported Rust Version: 1.56.1

Miniscript

Library for handling Miniscript, which is a subset of Bitcoin Script designed to support simple and general tooling. Miniscripts represent threshold circuits of spending conditions, and can therefore be easily visualized or serialized as human-readable strings.

High-Level Features

This library supports

  • Output descriptors including embedded Miniscripts
  • Parsing and serializing descriptors to a human-readable string format
  • Compilation of abstract spending policies to Miniscript (enabled by the compiler flag)
  • Semantic analysis of Miniscripts and spending policies, with user-defined public key types
  • Encoding and decoding Miniscript as Bitcoin Script, given key types that are convertible to bitcoin::PublicKey
  • Determining satisfiability, and optimal witnesses, for a given descriptor; completing an unsigned bitcoin::TxIn with appropriate data
  • Determining the specific keys, hash preimages and timelocks used to spend coins in a given Bitcoin transaction
  • no_std support enabled by disabling the default-features and enabling "no-std". See embedded/ for an example.

More information can be found in the documentation or in the examples/ directory

Building

The cargo feature std is enabled by default. At least one of the features std or no-std or both must be enabled.

Enabling the no-std feature does not disable std. To disable the std feature you must disable default features. The no-std feature only enables additional features required for this crate to be usable without std. Both can be enabled without conflict.

Minimum Supported Rust Version (MSRV)

This library should always compile with any combination of features on Rust 1.56.1.

Some dependencies do not play nicely with our MSRV, if you are running the tests you may need to pin some dependencies. See ./contrib/test.sh for current pinning.

Contributing

Contributions are generally welcome. If you intend to make larger changes please discuss them in an issue before PRing them to avoid duplicate work and architectural mismatches. If you have any questions or ideas you want to discuss please join us in ##miniscript on Libera.

Benchmarks

We use a custom Rust compiler configuration conditional to guard the bench mark code. To run the bench marks use: RUSTFLAGS='--cfg=bench' cargo +nightly bench.

Release Notes

See CHANGELOG.md.

Licensing

The code in this project is licensed under the Creative Commons CC0 1.0 Universal license. We use the SPDX license list and SPDX IDs.

Dependencies

~7.5MB
~96K SLoC