-
Notifications
You must be signed in to change notification settings - Fork 5
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
Not compatible with hardware wallets - templates should define Miniscripts, not policies #12
Comments
I agree that would be good, but one problem might be that Miniscripts/Output descriptors cannot be parametrized like policies can. Changing for example thresholds or number of participants etc. in a policy can result in a totally different Miniscript. So templates might have to be defined for fixed policies without parameters that structurally impact the Miniscript. As far as I can tell, the current mintts in #11 follow this, but it's something to be mindful of in the future.
It's not only about the feasibility of bundling a compiler in the HWW, it does not make sense to do it in general: changing a Miniscript (which can happen with different compilers) changes the derived pkScripts/adresses, which would break the wallet (previous UTXOs not accessible anymore, etc). Fyi, here is an example of compilers not agreeing on the Miniscript output (both are valid, but different): sipa/miniscript#139
👍 |
It is possible for a HWW to work only with descriptors/miniscripts and still present the user a policy, by "lifting" the miniscript to policy. This is a much simpler operation than compilation and has a unique output. (You can do it by hand by dropping the It may be that we want to make mints independent of the specific miniscript, in which case if the HWW uses any miniscript which lifts to a give mint, it would display the mint rather than the script to the user. |
I concur with @apoelstra - to reduce maintenance overhead long term - this repo should limit its scope. Each HWW can provide specifics of their implementation in their own documentation. |
In this case though we should write a spec defining the policy language and the process of "lifting". Which is a bunch of work...but IMHO ultimately less work than attempting to specify actual miniscripts (which will be messy, risks us codifying something inefficient and having vendors ignore us to save fees, risks us codifying a tradeoff between privacy/efficiency that wallets don't agree with, makes it impossible for us to adapt to branches which are more or less likely to be taken, etc). FWIW the policy language consists of:
And the lifting process is very straightforward. (It's not quite "just drop the This may even be worth an actual BIP (or BIN or whatever). There are a couple technical questions we'd need to answer:
|
It MINTTS specified the Miniscript/descriptor, it could lead to improved UX and security with backups, in that users could backup the MINTT number and the keys in use instead of needing to understand output descriptors. Similar to how multisig users often backup the keys and "2-of-3 PW2SH multisig", which is easy to understand and verify for users. Output descriptors containing Miniscripts are very hard for users to verify.
It does sound like a ton of work for everyone with lots of difficulties, and code bloat in hardware signers. Issues with specific MINTTs like your examples could be fixed by simply specifying new ones. This sounds much easier to me while keeping the benefits of knowing the exact output descriptor (e.g. better UX/security for wallet backups, see above). |
Hi all. I applaud the efforts to improve the UX for users of miniscript policies (with the ultimate goal being: not having to show the actual policy to the user in most cases); however, I agree with @benma's concerns. More generally, I'm skeptical that any approach based on human-compiled lists of templates can make substantial progress on the matter.
It's unclear that showing the lifted policy is generally safe, as it's been pointed out. It opens the door to malware swapping your actual miniscript while keeping the lifted policy unchanged, something you would only discover when you try to recover from your backup. That enables ransom attacks ("I know where your funds are, and I'll help you recover for a price"). The only way to make this reasonably safe, in my view, would be to:
That should be enough to deter such attacks. One concern is that in taproot trees where each leaf is miniscript, you would lift each leaf independently. If each leaf has Finally, the reason I'm not excited about this direction is that even if all the concerns above are addressed (which already seems to require a substantial amount of work!), I don't see showing to the user something like
as a substantial improvement over
The first is surely a tad more developer-friendly, but still very unfriendly for any non-technical person. |
This is true, and I take your point that we can't realistically try to limit the number of combinations, because as soon as the user composes things there'll be a combinatorial blowup.
The user wouldn't see either of these -- though what they do see would look closer to the first than the second, regardless of whether MINTTs specify descriptors or policies. The problem in the descriptor+miniscript case is that the MINTT itself needs to be much more complicated: it needs to specify the exact miniscript, describe under what parameter sets the miniscript changes (because we always want to be recommending the fee-minimizing form of the policy). |
To chime in here, I am greatly appreciative of the input of @benma, @bigspider, and @scgbckbone around the hardware wallet perspective. Having used all three of your products regularly, my intent with the minscript template/mint project was to provide a framework where some of the complexities associated with an end user could be abstracted away by standardizing common types of miniscript output descriptors Reading through the comments here, my takeaways on how to improve this with hardware wallet functionality in mind:
|
Ok, this greatly simplifies things. (Yeah, fine if timelocks are "parameters" since they don't meaningfully change the structure of the descriptor.) In this case I agree with others that we should be encoding descriptors, not policies (though maybe we want a policy as a sort of reference, as you suggest). And in that case all my further comments are moot. But FWIW, Miniscript itself supports ANYONECANSPEND and NOBODYCANSPEND. Not because there is any use case, but because it comes out of the desire that Miniscript as a language doesn't really distinguish between top-level descriptors (in which case these fragments have no value) and leaf nodes (in which case they're sometimes useful to help with composeability, e.g. in the case that you do
I think that if we're specifying descriptors then equivalence should mean equality. No reordering or functional equivalence or anything. If we were to consider reordering etc. then that's a step toward a potentially-ambiguous "policy language". Which as others have said, could be a DoS/ransom risk.
Yeah, agreed. So we could maybe specify something like "Miniscript with placeholder keys". Though I would argue that this is an obvious enough extension that we don't need to specify it. |
(this issue is converted from this PR comment: #11 (comment))
Hi
Nice effort, being able to abstract policies/Miniscripts from users and still give them access to its power is very much needed.
A policy can be compiled to many different Miniscripts that encode the same semantics, and the output of the policy compilation can change between compilers and even between compiler versions.
Hardware wallets generally work at the Miniscript/descriptor level and don't compile policies.
It would help if you could describe how Miniscript templates should work with hardware wallets in more detail. Ideally the hardware wallet user sees a high level description of the semantics based on these templates, but then the templates can't be policies (only), as the compiled Miniscript/descriptor could unexpectedly change.
Another point where guidance would help is with backups: the user needs to have a valid backup of the full descriptor to be able to restore, and at the same time not trust their computer to display the correct information.
Did you already brainstorm solutions to these?
The text was updated successfully, but these errors were encountered: