CTV++ OP_TEMPLATEHASH and OP_INPUTAMOUNTS

OP_TEMPLATEHASH actually seems pretty nice to work with on the whole. It “probably” gives you something like OP_PAIRCOMMIT if you were to abuse e.g. the outputs field… but I don’t think that’s the most interesting way to consider it.

I think it’s more interesting to compare this to e.g. working with TXHASH or OP_CAT, and it seems like it’s pretty ergonomic! I would maybe consider enabling a way to pass a sha256 midstate in for the sequence and output (maybe a negative index means n-more after midstate?), because then you can do more compact stuff…

I would also consider an OP_PUSHTEMPLATE and OP_TEMPLATEHASH which would decrease txn size, rather than needing to replicate the entire tx on the witness stack.

(less sure about the input amount opcode, holding comment for now)/

1 Like