Author: Salvatore Ingala 2023-07-30 21:37:49+00:00
Published on: 2023-07-30T21:37:49+00:00
Salvatore Ingala has presented a complete proposal for the core opcodes of MATT, making the opcode functionally complete with revised and improved implementation. The code is implemented in the bitcoin-inquisition repo fork, which includes OP_CHECKTEMPLATEVERIFY. The diff provides details on the implementation and includes basic functional tests. The changes compared to the previous draft include replacing OP_CHECK{IN, OUT}CONTRACTVERIFY with a single opcode, OP_CHECKCONTRACTVERIFY (CCV), and introducing an additional `flags` parameter to specify if the opcode operates on an input or an output. The default behavior for outputs includes a deferred checks mechanism for amounts, where the input amounts with CCV towards the same output are summed and act as a lower bound for that output's amount. A flag can disable this behavior. The order of parameters is also modified for better script writing. The new OP_CHECKCONTRACTVERIFY takes five parameters from the stack and checks if the -th input/output's scriptPubKey is a P2TR with a public key obtained from , optionally tweaked with , and optionally tap-tweaked with . Special values of the parameters are defined, such as using a fixed NUMS point if is empty, using the current input's taproot internal key if is -1, and using the current input's index if is -1. There are also defined flags, including CCV_FLAG_CHECK_INPUT and CCV_FLAG_IGNORE_OUTPUT_AMOUNT. After evaluating all inputs, it is verified that each output's amount is greater than or equal to the total amount in the bucket of that output, validating the deferred checks. The author notes that while some special values may not be useful in applications, they were included for flexibility. With the new opcode, the full generality of MATT, including fraud proofs, can be achieved with just two opcodes: OP_CHECKCONTRACTVERIFY and OP_CAT. However, additional opcodes and introspection may benefit certain applications.
Updated on: 2023-07-31T02:08:57.645643+00:00