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

Templates 000,001,002 Submission #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RandyMcMillan
Copy link

No description provided.

@RandyMcMillan
Copy link
Author

squashed #2 PR @apoelstra request.

SUBMISSIONS.md Outdated Show resolved Hide resolved
mint-002.md Outdated Show resolved Hide resolved
@RandyMcMillan RandyMcMillan force-pushed the 1702998694/b512072/32807f2-rob1ham/main branch 3 times, most recently from d445da0 to 8fcaeb3 Compare December 21, 2023 17:38
@RandyMcMillan

This comment was marked as outdated.

@RandyMcMillan RandyMcMillan force-pushed the 1702998694/b512072/32807f2-rob1ham/main branch from 8fcaeb3 to 1dbaa33 Compare December 21, 2023 19:06
@RandyMcMillan
Copy link
Author

RandyMcMillan commented Dec 21, 2023

@RandyMcMillan RandyMcMillan force-pushed the 1702998694/b512072/32807f2-rob1ham/main branch from 1dbaa33 to ab8f15b Compare December 21, 2023 19:22
@RandyMcMillan
Copy link
Author

RandyMcMillan commented Dec 21, 2023

ab8f15b: applied spelling and markdown changes the linter detected.

Ought to be ready for review.

Thanks for the feedback so far! @apoelstra @Rob1Ham

@apoelstra
Copy link
Member

ab8f15b looks great! I have only a couple nits.

mint-001.md Outdated Show resolved Hide resolved

- Max duration epoch time relative timelock (\~388 days)

Below is a reference diagram on how the 3 Key Time Layered Multisig operates across time:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ab8f15b:

I'm not sure where this should go, but somewhere in this doc we should say that the first timelock should be less than the second. This doesn't matter at all semantically but it's good to tighten the spec wherever we can, and it'd be potentially confusing to have the timelocks in an arbitrary order.

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been using the term "Cascading Timelocks" in some of my own template proposals.
We are on the same page with this!

@RandyMcMillan

This comment was marked as outdated.

@RandyMcMillan RandyMcMillan force-pushed the 1702998694/b512072/32807f2-rob1ham/main branch from ab8f15b to b1d0de1 Compare January 4, 2024 17:13
@RandyMcMillan RandyMcMillan force-pushed the 1702998694/b512072/32807f2-rob1ham/main branch from b1d0de1 to cf0b6bf Compare January 5, 2024 18:19

- It is suggested that the first **Relative Epoch Timelock** occurs prior to the next. "Cascading" the time locks sequentially is not necessary but eases reasoning about the intended purpose and resulting [Bitcoin Script](https://en.bitcoin.it/wiki/Script) structure.

<!--
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I introduce the terminology "Cascading TimeLock" and give a short explanation on why TimeLocks should be sequential.

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK cf0b6bf

@apoelstra
Copy link
Member

This looks great! Thanks for all your iteration!


## Objectives

1. Each `MinT` (MiniScript Template) [^mint] [^mintt] will provide a common MiniScript policy.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi

Nice effort, being able to abstract policies/Miniscripts from users and still give them access to its power is very much needed.

Let me know if I should open an issue instead, I was not sure if I should comment here on the approved PR or open an issue.

provide a common MiniScript policy.

A policy can be compiled to many different Miniscripts that encode the same semantics, and the output of the policy compliation 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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @benma. Great question, and I think @Rob1Ham is better positioned than me to answer it.

For my part: in rust-miniscript we have a lift function which takes an arbitrary miniscript and drops the specific combinators to obtain a policy. We recommend users use this to compare Miniscripts for semantic equivalence. So the idea is that two Miniscripts that differ only in e.g. their choice of or constructions will be considered "the same" and if they matched a MINT in this repo, could be displayed to the user as that MINT.

This is potentially dangerous because it will show users policies that are "the same" even if they actually produce different addresses.

If we want to canonize this strategy then you're right that we need a document explaining (a) how wallets are supposed to manage things and present to users, and (b) a specification for this "lift"ing procedure. (It's super simple: you can do it textually by dropping all the letters before : or after _ in a combinator name.)

An alternate strategy would be to run every policy in these documents through the compiler to get an actual Miniscript (I think for these three MINTs there is actually only one possible sensible compilation, so this is an easy case) (where "sensible" means, like, not chaining a tons of ls and us on each other for no reason).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did notice this while working on this documentation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have additional tooling which is ommited from this PR. I recommend limiting the scope of this PR (to keep things moving) and creating an issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great points @benma.

Given the variation of policies that can result in effectively the same spending policies, but different script construction and therefore resulting in different addresses, it probably is best to default to an Output Descriptor post compilation.

Especially for the interoperation with Hardware Wallets, we want to have an explicit predetermined way that a given MINT would align with hardware wallets, and not have to have hardware wallet firmware/software wallet versions whenever the compiler comes out with new versions.

My ultimate goal with this project is to have a repository of known and validated application of miniscript templates which enable a synergy between users, hardware wallet signers, and software wallet developers. We remove uncertainty and opportunities for user error by deciding on a specific output descriptor for everyone to align on.

Around backups: In theory, if you knew an output descriptor followed a particular MINT, you'd be able to have some kind of compression on the data to be stored, but up to now that hasn't been discussed. One could store the XPUBs, and timelock details and have sufficient information to recover a wallet, but it isn't something I've explicitly put thought into beyond just storing the entire descriptor, happy to brainstorm ways to optimize this @benma!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I converted this into an issue at #12 as requested. Let's continue there, thanks!

@RandyMcMillan
Copy link
Author

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.

4 participants