Skip to content

A 3-of-3 that turns into a 2-of-3 after 90 days #341

Answered by apoelstra
kanishk779 asked this question in Q&A
Discussion options

You must be logged in to vote

@kanishk779 this is a pretty cool construction. It took me a bit to reverse-engineer what Miniscript is doing here but it is correct:

First, we have this CHECKSIG ADD SWAP idiom, which takes an accumulator, adds the result of CHECKSIG (which will be 0 if the signature failed or 1 if it passed), and then moves it one space back in the stack to make room for the next signature. After each of these, the second-to-top stack element will contain a count of how many signatures have passed, and the top stack element will be a witness for the next check.

After several of these we have the construction DUP IF <timelock check> ENDIF. This takes as witness either a 0 or 1. If it's a 0 the whole bloc…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@apoelstra
Comment options

@darosior
Comment options

@kanishk779
Comment options

@apoelstra
Comment options

Answer selected by kanishk779
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants