Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add miniscript implementation #1987

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Commits on Apr 24, 2024

  1. txscript: add support for miniscript in the P2WSH context

    Currently, only the P2WSH context is supported. Miniscript for Taproot
    was not yet well specified at the time of writing. Currently, there is
    an open PR for Bitcoin Core at
    bitcoin/bitcoin#27255 which, when merged, can
    be taken as a reference.
    
    This implementation contains:
    
    - miniscript parser
    - type checker
    - malleability check
    - script length limit check (P2WSH standardness rule)
    - op count check (P2WSH consensus rule)
    - duplicate pubkey check
    - script generation
    - witness generation (satisfactions)
    - unit tests that create receive addresses based on some miniscripts and spend from them again (see
    `TestRedeem()`).
    
    Unit tests exist to check that this implementation's type checking passes some of the unit tests of
    rust-miniscript. See [./testdata](./testdata).
    
    Missing/todo:
    - timelock mixing check
    - stack size check (P2WSH standardness rule)
    - witness generation for thresh/multi currently has a naive implementation that is very inefficient
    (exponential runtime). This should be replaced with a fast algorithm.
    - maybe more
    
    Co-authored-by: Oliver Gugger <gugger@gmail.com>
    benma and guggero committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    a203004 View commit details
    Browse the repository at this point in the history
  2. txscript: add unit tests and test vectors for miniscript

    This commit adds test vectors taken from
    https://github.com/rust-bitcoin/rust-miniscript/blob/a0648b3a4d63abbe53f621308614f97f04a04096/src/miniscript/ms_tests.rs
    to the miniscript implementation.
    
    Co-authored-by: Oliver Gugger <gugger@gmail.com>
    benma and guggero committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    a3e7dc3 View commit details
    Browse the repository at this point in the history