Skip to content

Instantly share code, notes, and snippets.

@darosior
Last active February 14, 2023 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darosior/89e4fa5c84f41f957a0f50e247358f55 to your computer and use it in GitHub Desktop.
Save darosior/89e4fa5c84f41f957a0f50e247358f55 to your computer and use it in GitHub Desktop.
Notes on adapting Miniscript for Tapscript

(Contains input from many people, not my own ideas)

Notes

  • Forbid multi, have a new multi_a itself forbidden in other contexts
  • We now need to care about the maximum stack size (1000). With Taproot it's now also checked before executing the Script.
  • We could have a new d: wrapper that is u because the MINIMALIF rule is consensus
  • It doesn't look like there is interesting combinations of the new CHECKSIGADD opcode with existing fragment. Maybe we could have used it for thresh to save an OP_ADD if the sub was a CHECKSIG, but the arguments aren't in the right order for this.
  • No need to check for the Script size anymore
  • I don't think we need to take the sigop budget into account, as we can't create a Script that would duplicate the signatures.
  • When calculating sizes, keep in mind the signature length is now 64
  • At the descriptor level, we should not forbid key duplicates across branches? As the signature for one branch cannot be replayed on the other
  • Standard witness size is still bounded by MAX_NUM_STACK_ELEMENTS * MAX_STACK_ELEM_SIZE, that's effectively 8kWU
@darosior
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment