Skip to content

Add Output Descriptor library#2568

Open
guggero wants to merge 5 commits into
btcsuite:masterfrom
guggero:miniscript
Open

Add Output Descriptor library#2568
guggero wants to merge 5 commits into
btcsuite:masterfrom
guggero:miniscript

Conversation

@guggero

@guggero guggero commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

I wasn't able to reopen the old PR, so I'm resurrecting it here.
After using https://github.com/benma/descriptors-go in a mobile project, the limitations of using a WASM interpreter showed to be too restricting. So I'm giving it another try, this time with quite a bit of agentic help (I gave up on #1987 because I'm not smart enough for compiler-level stuff, but apparently Claude is quite capable).

Description

Adds a miniscript library (originally authored by @benma in https://github.com/benma/miniscript-go) and then adds full Output Descriptor support on top.
The code is modeled after the rust-miniscript implementation and a lot of test vectors for diferential unit tests were extracted from that implementation.

The miniscript feature set should be equivalent with rust-miniscript 13.1.0. The descriptors features are currently limited to feature parity with https://github.com/benma/descriptors-go.

Implementation disclaimer

The code in this PR is more or less a supervised re-implementation of rust-miniscript. I spent a lot of tokens on differential code review and bug hunting, including large amounts of test vectors extracted from the original Rust code.
There are also seeded fuzz tests that have been running for several hours on a 12-core machine.
All commits are hand-crafted and conform to the repository's code style. But apart from that, the code is not mine (I'd guess about 60% original miniscript code by @benma and the rest added by Claude Opus 4.8).

@kcalvinalvin

kcalvinalvin commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Me looking at the number of lines changed

IMG_0802

.
.
.
.
.
.
.
.
.

Would be awesome to have though! I'll start slowly going through...

@guggero

guggero commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Me looking at the number of lines changed

Yeah, it's a junky boyyy... A lot of the added lines are test vectors. But lots of Go code as well, I agree.
Would be nice if you could take a look, thanks!

benma and others added 5 commits July 7, 2026 17:49
This commit adds a fully-featured miniscript implementation that is
modeled after the rust-bitcoin/rust-miniscript repository.
The miniscript functionality is equivalent to the rust-miniscript
implementation at version 13.1.0 and all test vectors (introduced
in the next commit) are extracted from the Rust reference implementation
to ensure full compatibility and feature-completeness.

Co-authored-by: Oli <gugger@gmail.com>
This commit adds test vectors taken from
https://github.com/rust-bitcoin/rust-miniscript/blob/59ad2ed/src/miniscript/ms_tests.rs
to the miniscript implementation.

Co-authored-by: Oli <gugger@gmail.com>
This commit adds descriptor parsing, checksum calculation and
validation and several methods to the Descriptor struct:
 - AddressAt()
 - Keys()
 - DescType()
 - MaxWeightToSatisfy()
 - MultipathLen()
 - ScriptCodeAt()
 - String()
This commit adds the Lift() and PlanAt() methods to the
Descriptor struct.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants