Published on: 2018-09-04T16:57:28+00:00
A recent proposal has been discussed on the bitcoin-dev mailing list regarding the addition of fields to the Partially Signed Bitcoin Transactions (PSBT) format tag. The purpose of this proposal is to support Hash Time-Locked Contracts (HTLCs) within the PSBT format. One suggestion put forward is to include two new fields in PSBT: a preimage request field and a revealed preimage field. The proposed workflow involves an updater recognizing an output/script that requires a preimage and subsequently adding a preimage request field to the input. This would be followed by a signer who knows the preimage adding a preimage field after verifying the secret. Finally, a compatible finalizer would combine all signatures and preimages into a final scriptSig/witness stack.However, the proposal acknowledges that dealing with multiple possible satisfactions could complicate matters, particularly when there are numerous combinations to consider. As an alternative approach, it has been suggested to use an easily-parsable subset of script, which includes elements such as and/or/threshold/pubkey/locktimes/hashlocks, instead of modifying the PSBT. The author of the proposal intends to provide more information on this topic soon.The author of the proposal has been actively working on HTLC scripts and has been experimenting with a format tag for Bitcoin Improvement Proposal 174 (BIP 174) to support them. The proposed format entails adding a new input type that defines elements to be inserted in the final p2sh/p2wsh stack, such as preimage or refund path flags. The process begins with the creation of a blank PSBT, which is then updated with redeem/witness scripts, sighashes, and partial signatures. Additional stack elements are attached for non-signature elements, followed by finalization to generate the final scriptSig and/or witness. Finally, the signed transaction is extracted for broadcasting.The author acknowledges that this approach may be overly generic and seeks to know if anyone else has considered utilizing PSBTs in an HTLC context.
Updated on: 2023-08-01T23:53:16.253419+00:00