Hi all,

Since there's recently been a lot more interest in discussing covenants and alternative covenant proposals because of CTV, I figured I'd bring up my own proposed covenant opcode again while the urge is still fresh. 

To be clear upfront, this opcode has a spec, but nothing else. No tests. No implementation. No signet. No tooling. While this is a serious proposal that I think has a lot of benefits over any other covenant opcode proposal, I am not suggesting that this should supplant CTV. I also don't have any plans to work on an implementation of OP_CONSTRAINDESTINATION, and I certainly wouldn't without more interest and an equal partner on a project like this.  I think CTV is a quite useful opcode that is simple and incremental. OP_CD on the other hand is significantly more powerful, which would be likely to lead to even more contention than what CTV has had.

To the opcode itself, there is already plenty of exposition about it in the spec:

https://github.com/fresheneesz/bip-efficient-bitcoin-vaults/blob/main/cd/bip-constraindestination.md

So I wanted to discuss it from the perspective of what it enables, pros and cons, and key considerations:

OP_CONSTRAINDESTINATION alone
The wallet vaults that can be created using this are more flexible than ones that can be created with OP_CTV:
One less-than-ideal property shared with CTV wallet vaults:
  • If the hot wallet / intermediate wallet key is stolen, the attacker can steal funds after the owner initiates a normal spend.
The opcode requires some mechanism for fee limiting:
The downsides compared to CTV:

OP_CONSTRAINDESTINATION + OP_PUSHOUTPUTSTACK
OP_PUSHOUTPUTSTACK is an opcode that allows a script to dynamically add local state to an output being created.
The wallet vaults that can be created with this combination of opcodes is a bit better than ones with just OP_CD on its own:
However, the complexity is substantially higher:
Summary

These opcodes would allow the creation of wallet vaults that could be intuitively used in almost the same way that a standard wallet can be used, including mixing in arbitrary inputs and outputs (including ones you don't own). With one more opcode, funds could be sent directly out of a wallet vault in a single transaction (whereas most wallet vaults require two transactions to send money out to an arbitrary destination).  

The opcodes are significantly more complex and powerful than OP_CTV, and also substantially less developed. However, I think they demonstrate a number of important considerations for covenants in the context of wallet vaults. Please feel free to respond or ask questions here or as a github issue. 

I think wallet vaults in particular are a very important mechanism to enable much more secure self-custody setups without sacrificing so much usability as normal multisig wallets require. Wallet vaults could enable significantly faster growth in the rate of bitcoin holders who self-custody. CTV is the only opcode that is ready, and no other opcode is even being developed, let alone close to being ready. I don't see APO as a good practical covenant mechanism as currently defined. Any "next" covenant opcode would likely be 4-6 years out. I believe centralized custody is a huge problem in the bitcoin ecosystem, so I think making it easier for people to securely self-custody their bitcoins is an incredibly important area of development. I believe even *if* some other covenant opcode makes CTV completely obsolete (which it isn't at all clear to me is a likely scenario), a 4-6 year head start on better self-custody mechanisms could go a long way to saving a lot of people who need bitcoin a lot of pain (from both custodial shenanigans and self-custody mishaps). 

Cheers,
BT