Revisiting Multi-Commitments
Based on my conversations with @JeremyRubin, @salvatoshi and @reardencode this is an attempt to sum up the perceived tradeoffs of different approaches to proposed multi-commitments in bitcoin script.
OP_CAT:<x1> <x2> OP_CATOP_PAIRCOMMIT:<x1> <x2> OP_PAIRCOMMITOP_VECTORCOMMIT:<x1> .. <xn> <n> OP_VECTORCOMMITOP_TWEAKADD:<t> <pub> OP_TWEAKADD(counts as SigOp)OP_SHA256TAGGED:<msg> <tag> OP_SHA256TAGGEDOP_SHA256STREAM:OP_SHA256INIT <x1> OP_SHA256STREAM .. <xn> OP_SHA256STREAM OP_SHA256FINALIZE
In a world where script is restored (GSR):
OP_CATwe naturally have, so all the concerns regarding introspection are already moot, big drawback is the witness malleability often requiring additional inefficiency introduced to scripts using it
Preferred:
OP_TWEAKADDis pretty evidently useful.OP_CATalready enables state carrying with caboose, this would make it much neater (unlocks MATT).OP_TWEAKADDnecessarily counts as a SigOp and as a multi-commitment has worse witness malleability (as per BIP) issues thanOP_CAT.OP_SHA256STREAMmakes certainOP_CATandOP_SHA256heavy scripts more streamlined, does not suffer from stack element size limit for overall message length, post GSR the execution cost assigned to all operations ensures safety.
Neutral:
OP_SHA256TAGGEDis a minor optimization of<msg> <tag> OP_SHA256 OP_DUP OP_CAT OP_CAT OP_SHA256where tagged midstates can be pre-computed or cached for efficiency.
Bad fit:
OP_PAIRCOMMITandOP_VECTORCOMMITare built around the assumption that consensus onOP_CATcan not be reached due to it being computationally complete with the other opcodes; thus making it hard to reason about second order effects.
In a world without CAT (no state carrying):
Preferred:
OP_PAIRCOMMITdoes not enable- fine-grained introspection
- state-carrying covenants
- bigint operations
- new arithmetic capabilities using lookup tables
- manipulation of the taptree
Neutral:
OP_VECTORCOMMITmore general form, provides optimization over multiple calls ofOP_PAIRCOMMIT, for larger number of smaller pieces the cost benefits are more significantOP_SHA256TAGGEDin the absence ofOP_TWEAKADDandOP_CATthis opcode serves as a mildly less efficient but adequate pair-commitment
Bad fit:
OP_SHA256STREAMwould introduce a lot if not most of the capabilities (or shenanigans) that serve as rationale for not activatingOP_CAT, trivially allows for transaction and parent transaction introspection via CAT tricks I and CAT tricks II
In a world without CAT (but with MATT):
Preferred:
OP_TWEAKADDandOP_VECTORCOMMITare the basic building primitives for MATT, vector state carrying can also be achieved with multiple calls toOP_TWEAKADDbut witness malleability could be a problem as per BIP and complicate scripts unnecessarily.
Neutral:
OP_PAIRCOMMITin @salvatoshi’s opinion MATT is expected to carry a more complex state than 2 elementsOP_SHA256TAGGEDwhile it sounds more generally helpful, does not really enable the inspection or manipulation of the taproot script tree paired withOP_TWEAKADDdue to lack of internal concatenation on the message part, still it is an adequate substitute forOP_PAIRCOMMITandOP_VECTORCOMMIT
Bad fit:
OP_SHA256STREAMsame rationale for all cases withoutOP_CAT
Feedback and preferences or corrections and alternative suggestions are welcome!