Comparability of hashed fields
In comparison with CTV, TEMPLATEHASH drops nInputs
, nOutputs
, and scriptSigs
;
and provides the taproot annex presence flag
and taproot annex
.
In comparison with SIGHASH_ANYSCRIPTANYPREVOUT|ALL, TEMPLATEHASH drops
hash_type
, this sequence
, key_version
, and codesep_pos
; and provides all sequences
.
This places TEMPLATEHASH in a fairly snug center floor between
CTV’s hash and ANYSCRIPTANYPREVOUT’s. It not directly commits to the
variety of inputs by way of sequences, is able to creating steady txids with
1 enter, and makes no concession to developing the hash on the stack
nor to legacy script.
Capabilities
All protocols which can be potential with CTV are potential with TEMPLATEHASH.
By committing to the taproot annex
, it does eradicate sure perverse methods of implementing annex extensions, however not any protocol utility which may use the annex. I.e. as soon as we’ve got an opcode that’s
anticipated for use in pre-committed transaction scripts within the wild, we
can not make a consensus rule that requires all taproot spends to have a
non-empty annex, however we will obtain the identical functionality in one other manner.
Effectivity
Normally protocols utilizing TEMPLATEHASH can be corresponding to or extra environment friendly than the identical utilizing CTV (or APO). It is because TEMPLATEHASH can be utilized with an equality examine or a signature examine with out taking a penalty for a wasted hash or a wasted signature within the reverse case. Concretely, I consider this makes TEMPLATEHASH+CSFS+IKEY 32WU extra environment friendly than LNHANCE(CTV+CSFS+IKEY+PAIRCOMMIT) for Lightning Symmetry power closure.
For protocols that might have used naked CTV, TEMPLATEHASH is 69WU much less
environment friendly, however as of this writing the one protocol that’s identified to
make the most of naked CTV is congestion management bushes. I’m not conscious
of any concrete proposal to implement these.
Compatibility
As a result of TEMPLATEHASH just isn’t out there in legacy bitcoin script or SegWit v0 scripts, it is just appropriate with Taproot wallets. This would possibly make it tougher for customers of legacy signing infrastucture comparable to HSMs to undertake, however these similar units might need issue signing scripts utilizing new opcodes even when they had been legacy scripts.