What is Nostr?
Alex Bosworth [ARCHIVE] /
npub19un…zcc5
2023-06-07 18:14:36
in reply to nevent1q…9m0q

Alex Bosworth [ARCHIVE] on Nostr: 📅 Original date posted:2018-09-04 📝 Original message:I've been experimenting ...

📅 Original date posted:2018-09-04
📝 Original message:I've been experimenting with a format tag for BIP 174 to help support
HTLC scripts I've been working with.

Not sure on the best format for this, but what I have been thinking
about is a new input type that defines elements that should be
inserted in the final p2sh/p2wsh stack such as a preimage or a refund
path flag.

Type: Additional Stack Element ADDITIONAL_STACK_ELEMENT = 0xXX

Key: The index in the stack to insert a value (uint32 LE)

{0xXX}|{Stack index}

Value: The value to push into the stack for a redeem script or witness
script at the specified index.

{value}

So my flow is:

1. Create blank PSBT (attaching locktime, anticipating final weight to
adjust outputs for fees)
2. Update with redeem scripts and/or witness scripts
3. Update with sighashes
4. Sign: generate partial signature
5. Attach additional stack elements for the required non-signature elements
6. Finalize to create the final scriptsig and/or witness
7. Extract the signed transaction for broadcast

This may be overkill or overly generic, has anyone else thought of how
to use PSBTs in an HTLC context?

--
Sent from my iPhone
Author Public Key
npub19unua7zugqhkaxlqmxnyh20a3nk0g9xv54nlraffe383f98e0d0shmzcc5