Why Nostr? What is Njump?
2023-08-22 17:40:46

Nitesh on Nostr: OP_CHECKTEMPLATEVERIFY (CTV-BIP119) is a proposed soft fork into #Bitcoin that I'd ...

OP_CHECKTEMPLATEVERIFY (CTV-BIP119) is a proposed soft fork into #Bitcoin that I'd really love to see activated, here's what it is! šŸ‘‡

Before we get into the BIP, let's understand what covenants are because it's what BIP introduces. Generally if you want to spend your Bitcoin you just need to own keys to be able to spend them but covenants can introduce additional restrictions on coins maybe spent.

Like if you're passing on your Bitcoin (private keys) to your kids but you add a restriction saying it can only be spent after a certain block height which is like 10 years in the future. You could do savings accounts where you can only spend over a period of time.

Or advanced escrows where payments are released only when certain conditions are met. Exchanges can easily manage funds flowing between their cold and hot wallets. The use cases are endless, you can imagine so many different things that can be done.

Without CTV you can do some level of restrictions on how coins can be spent but nothing is straightforward and it's messy. Ok now let's get into the BIP.

The basic idea behind OP_CTV is to restrict on how a UTXO can be spent and it does this by committing to a "TEMPLATE" for the next transaction. In a regular bitcoin transaction to spend coins, you have to satisfy the script in the utxos like for example, these utxos can only be spent if they are signed by some X public key but ctv restricts the structure of the next transaction that spends these utxos. What does this mean? When you spend a utxo with op_ctv the transaction must satisfy the committed template, like specific outputs, amounts and other parts of the spending transaction.

The way all this is done is, you build a template for the future transaction, put all the crap you want to put inside of it, hash the template and then shove the hash in the utxo's script. Remember you have to satisfy the script in the outputs to spend them, now only way to spend them is to satisfy the op_ctv script. The spending tx must hash to the committed hash when you pull stuff from the template and hash them. In short if a utxo has op_checktemplateverify in it, the spending tx must satisfy it.

Criticism: One big criticism that people have said about covenants is the risk of fungibility where coins could have permanent restriction on how they can/cannot be spent. Ctv introduces very simple covenants where your templates are restricted to be very simple where outputs are known at the time of creation of the template. Based on a destructuring argument, it is only possible to create templates which expand in a finite number of steps.

CTV also enables several other cool things like payment pools where multiple people can own one utxo, it is a massive privacy benefit because when that utxo is being spent it will appear on chain as the whole utxo is being spent when in real someone is spending their portion.

Another cool thing is ctv can enable vaults in Bitcoin which would look something like this giving so much more security and peace of mind.

You can read a lot more on this website:
https://bitcoinops.org/en/topics/op_checktemplateverify/

Overall I think op_ctv is a really cool upgrade to Bitcoin and could prove to be very valuable and seems like the only only soft fork right now most people are happy with.

Here's the BIP and the authors are
Jeremy Rubin and James O'Beirne.

https://github.com/bitcoin/bips/blob/master/bip-0119.mediawiki






Author Public Key
npub1qgwhaaa2lsp54rl0hfx7qa3z678ax6wlre0em475rhpvl7n54cpqgg7y7n