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

Taproot support? #56

Open
NicolasDorier opened this issue Jul 8, 2021 · 3 comments
Open

Taproot support? #56

NicolasDorier opened this issue Jul 8, 2021 · 3 comments

Comments

@NicolasDorier
Copy link

Will miniscript be adapted for taproot?
I guess a few things should change for taproot, as now we need the tap scripts, and not using OP_CHECKMULTISIG.

@sipa
Copy link
Owner

sipa commented Jul 8, 2021

Yes, eventually.

But really this work should get integrated into Bitcoin Core first, things are blocked on that to make more progress.

Note that there already is tr() descriptor support independent of miniscript - it'll eventually be able to plug in there.

@NicolasDorier
Copy link
Author

NicolasDorier commented Jul 8, 2021

This work, you mean miniscript integrated to bitcoin core?
I think it's quite unrelated.

Now that taproot is locked in, protocols built on top of bitcoin will evolve, and if those protocol could express their scripts as a miniscript rather than several handcrafted tap scripts, I think it would make it harder to shoot themselves in the foot, easier to review.

If you wait miniscript to be integrated to bitcoin core first before starting taproot integration in this repo, I fear those protocols will fallback to hand crafted scripts when being rewritten.

@sipa
Copy link
Owner

sipa commented Jul 8, 2021

This repository (and Miniscript as a research project in general) is different things, so it depends what you're talking about:

  • It contains the specification of the Miniscript language (which is an extension to the output descriptor language, which was first introduced in Bitcoin Core, and is now being BIP'ed; see https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-June/019151.html). Adding Taproot support to descriptors consists of a few different things:
    • Adding tr() descriptors (already done, and unrelated to Miniscript; see https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md), though some aspects are missing (in particular, easy construction of descriptors without intended key path spend).
    • Adding support x-only pubkeys (also already done).
    • Defining a Miniscript-variant for Taproot (which would lack the OP_CHECKMULTISIG(VERIFY) based scripts, can rely on stronger anti-malleability).
    • Adding support for MuSig(2) to descriptor key expressions; that's orthogonal to Miniscript, but also intersects with PSBT extensions for it to make it usable etc.
  • It contains one of the two Miniscript implementations (the other being rust-miniscript) that I know of, one mostly based on the Bitcoin Core script code, and is intended to be at least partially integrated with it. Currently that's sort of in limbo, as the code on itself here is hard to test, and extending it further may risk further divergence. This is the part that makes me hesitant about adding Taproot support for, as I'd much rather see it integrated into its "final" form in Core, but this will take time (and reviewers/contributors).
  • It contains a policy-to-miniscript compiler. If the miniscript logic itself is extended to support taproot, it wouldn't be hard to make the compiler do the same, but to be actually interesting it'd need to consider the ability to compile a single policy into a tree of scripts rather than a single script. I think doing this optimally is still an open research question.
  • It contains the code for the compiler/analysis demo on the http://bitcoin.sipa.be/miniscript website.

So while I don't think it's much work per se to extend the Miniscript "specification" to support Taproot & BIP342 scripts, it's unclear to me how useful that is without implementations that can deal with it and target it. And at least as far as the C++ implementation here is concerned, I'd very much want to see it further along in integrating into Bitcoin Core before adding even more here. Rust-miniscript may be in a better position to start adding support for that.

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

No branches or pull requests

2 participants