익명 08:16

modified Hash Time Locked Contracts

modified Hash Time Locked Contracts

I'm currently working on implementing a modified version of Hash Time Locked Contracts (HTLC) in Bitcoin and would greatly appreciate any guidance or best practices from the community.

Objective: I aim to modify the standard HTLC to simplify the creation process. In my modified HTLC:

  1. The creator of the HTLC does not need to specify a hash lock initially.
  2. The creator specifies a party (which can be nullable) who will later add the hash lock to the pre-HTLC.
  3. Only the creator of the pre-HTLC and the specified party can add the hash lock.

Questions:

  1. Feasibility: Can this modification be implemented within the current Bitcoin scripting capabilities? Are there any inherent limitations I should be aware of?
  2. Security Considerations: What potential security risks should I consider with this modification? How can I mitigate these risks?


Top Answer/Comment:

You cannot broadcast an incomplete transaction and have another user modify it later, because an incomplete transaction is not valid and invalid transactions do not propagate on the network.

You could share an incomplete transaction out-of-band, e.g. on a message board, via a Partially signed Bitcoin transaction (PSBT) iff the inputs and outputs of the transaction creator are sufficient to enforce their expected outcome by using a SIGHASH_SINGLE | SIGHASH_ANYONECANPAY construction. The second participant would then be able to fill in the remaining inputs and outputs to achieve their intended outcome in addition.

However, if you want two participants to both have input on one output script, your protocol will require at least one round trip, as the original transaction creator cannot sign off on an incomplete output script, and therefore either the second participant would have the ability to unilaterally determine that output or the transaction would have to go back to the creator after the second participant adds their modification.

I must admit that I don’t fully understand what you are trying to achieve, and therefore may be missing a workaround or trick, but the above should cover the general situation. Your problem reminds me of how inscription market places use PSBTs to offer NFTs for sale, and if you are not familiar, it might be interesting to study that approach.

If you generally want to better understand how HTLCs work, you may want to take a look at Elle Mouton’s excellent HTLC Deep Dive, her other blog posts may also be interesting in the context of your line of inquiry.

상단 광고의 [X] 버튼을 누르면 내용이 보입니다