Miniscript
This project is a JavaScript implementation of Bitcoin Miniscript, a high-level language for describing Bitcoin spending conditions.
It includes a novel Miniscript Satisfier for generating explicit script witnesses that are decoupled from the tx signer, as well as a transpilation of Peter Wuille's C++ code for compiling spending policies into Miniscript and Bitcoin scripts.
Features
- Compile Policies into Miniscript and Bitcoin scripts.
- A Miniscript Satisfier that discards malleable solutions and is able to generate explicit witnesses from Miniscripts using variables, such as
pk(key)
.
Documentation
This module has detailed documentation available on its Github repository. In addition, you can use the playground on this page to experiment with the module and try out its features.
Playground
Let's consider the policies used for demonstration in Wuille's paper and add some more that include unknown pieces of information (referred to asunknowns
).- A single key
- One of two keys (equally likely)
- One of two keys (equally likely) - with unknown private key_2
- One of two keys (one likely, one unlikely)
- One of two keys (one likely, one unlikely) - with unknown unlikely private key
- A user and a 2FA service need to sign off, but after 90 days the user alone is enough
- A 3-of-3 that turns into a 2-of-3 after 90 days
- The BOLT #3 to_local policy
- The BOLT #3 offered HTLC policy
- The BOLT #3 offered HTLC policy - with no known preimage or revocation private key
- The BOLT #3 received HTLC policy
Loading Playground environment...