This is the first article in a series of deep diving in individual covenant proposals that have reached a point of maturity that deserves a deep degradation.
CheckTemplatersify (CTV), made by Jeremy Rubin with BIP 119, is the most mature and fully elaborated pact proposal, not only out of the suggestions we want to cover, but out of all the covenant proposals in their entirety. As I mentioned in the introduction article to this series, there are many concerns in the ecosystem of covenants that are too flexible, allowing things to win up with very detrimental consequences for Bitcoin.
CTV was specifically designed to limit its capabilities close enough to avoid any of these concerns. To first understand how CTV works, we need to understand the individual parts of a Bitcoin transaction.
This is a very high level of a Bitcoin transaction. It has input, or unspent coins (UTXOS), and emits, the new unspent coins that the transaction will create when confirmed in a block. There are many more pieces we will go through, but this is the highest level of a transaction structure.
Each transaction also has a version number field for the entire transaction, indicating the usability of new versions of rules or functions. There is also the cursor and flag set to specific values ​​to indicate that the transaction is using Segwit. After this, the input count is the number of inputs in the transaction. Then comes the actual input.
Each input contains a txide of the transaction that created the unused coin used, a vout that marks what output in this transaction is used, the size of script and scriptig, which is the unlocking script proving that input used is approved by its lock script -rules, and finally a sequence number used to ensure that input is used, Time rules. ie Input has existed for a certain number of blocks or times since its creation.
The output count is the next piece of data, the number of outputs in the transaction. After this comes the actual outputs that contain a multitude of satoshis assigned to the output, scriptpubkey size and the actual scriptpubkey, which is the locking script for that output. Finally, the NlockTime field uses a time value in time stamp or block height that applies to the entire transaction.
Each Segwit transaction also contains a witness section where each input has a similar witness containing a poor topic where many things will be placed on the script stack, a size field for each element and the actual data element to go on the stack.
How CTV works
CTV is an opcode that enables the most basic form of introspection and forward -looking data that performs all covenant suggestions. It allows a script to take a predefined 32 byte hash and compare it against a hash of most of the fields in the expense transaction. If cannabis derived from the actual expense transaction does not match the predefined hashish, the transaction is invalid.
The fields it commits to are:
- Nversion
- NlockTime
- Entrance count
- A hash of all nessequence -fields
- Output counting
- A hash of all output
- Entry index (the place where the entrance has in the transaction, 1. Input, 2nd, etc.)
These are all the fields obliged to by CTV -HASH, in their entirety and without any ability to choose and choose. This is the degree of introspection CTV enables, “makes hash of these fields in the consumption transaction Hash in the locking script for input used,” that’s it. Hash commits to essentially the entire transaction except the actual inputs. There is a reason why hashish does not include input. To lock an output to a 32 byte HASH with CTV, you need to know hash of the transaction you ensure is the only way to use it. The entrance locked with CTV used must include this hash to be verified against CTV. It takes to have hash of this transaction before You create the complete transaction. It’s not possible.
You can also wake CTV scripts, ie. Has an initial CTV script obliges to a transaction with output that also includes CTV scripts. This is what allows CTV to “continue” data. However, in practice, all that goes forward is regardless of the data contained in the chain of transactions. You can do this in theory to an infinite depth, but you are limited in practice to a final depth because the heck must be generated backwards from the end. This is because each level or “hop” must have hashish of the transaction moving to the next, otherwise you will not be able to create the locking script in the first place. If you do not already know the next transaction, you cannot generate the previous one.
What is ctv useful for
CTV allows you to limit an output so that it can only be used according to consensus rules in an accurate predefined transaction. Some of you might ask what the Big Deal is, we can already pretend transactions. If the level of introspection is so limited that it can only achieve something we can already do just in -law, what is the value addition?
First, pre -signed transactions always allow the possibility that the key holder (s) sign new transactions and use these coins in a different way. You have to trust that the key holder will not do this or will delete the key needed to sign with (which you also have to trust them). CTV removes this confidence completely. Once the expense transaction is defined and the output locked to the CTV HASH is created, there is no possibility of being used in another way, enforced by consensus.
Currently, the only way to gain confidence to be involved in the deterioration of transactions even using Multisig. Then you can be absolutely sure that unless you choose to sign yourself, no other valid transaction can be created that uses a coin in a different way. The problem is that the more people are involved, the more difficult and unreliable coordination of everyone to prevent a transaction at the same time. In the past small sizes, solving reliably becomes a completely impractical problem.
CTV gives a way for people to know that a set of transactions is committed without everyone having to come online at the same time to sign them. It simplifies the coordination process to a great extent by allowing everyone to get the necessary information for anyone else when they can, and when this person has everyone’s information, they can create the chain of CTV transactions without other people’s commitment, and everyone can verify and make sure that the correct result is the only possible.
It is incredibly valuable on your own, but CTV can also enable even more valuable things in combination with other opcodes that we see in the next article.
Closing thoughts
CTV is a densely limited covenant that enables a degree of introspection and forward -looking data that is so limited that it does not exceed the actual functionality of something that can be done with predicted transactions. The value proposition is not to enable new functionality in itself, but improves drastic efficiency, scalability and security guarantees for what can be built at the moment using foreskin transactions. This alone is a massive advantage for almost any current implemented protocol using pre -empted transactions.
Here are some of the projects that show how thoroughly intertwined and explored this particular covenant is compared to the others:
- A basic payment pool example of Stutxo.
- A CTV Vault implementation of James O’Beirne, who continued to suggest up_vault (which still uses CTV).
- A proof-of-concept port for the foreskin transaction-based sheet implementation from second by Steven Roose to use CTV instead.
- The SAPIO language of Jeremy Rubin himself, a higher-level language for building contracts with CTV (also supports the use of predicted transactions instead).
- Timeout Trees, a proposal for a very basic Coinpool design by John Law.
- Numerous other possible protocols such as optimized discreet log contracts (DLCs), non-interactive lightning channels, one party could open without the other and even decentralized ways for miners to gather together.
CTV is an incredibly mature proposal at this time, with a high value added and no risk of enabling anything that drives the worries around pacts. This should not only be very seriously considered, but in my personal opinion should have been activated many years ago.