public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Alex Bosworth <alex.bosworth@gmail.com>
To: bitcoin-dev@lists.linuxfoundation.org
Subject: [bitcoin-dev] Extending BIP174 for HTLCs
Date: Mon, 3 Sep 2018 20:24:01 -0700	[thread overview]
Message-ID: <CAFLuHNFD8vTyYfF+64e2Xs_HympQs4ufzSAxQ96jkLZg=pdm7A@mail.gmail.com> (raw)

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


             reply	other threads:[~2018-09-04  3:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-04  3:24 Alex Bosworth [this message]
2018-09-04 16:57 ` [bitcoin-dev] Extending BIP174 for HTLCs Pieter Wuille

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFLuHNFD8vTyYfF+64e2Xs_HympQs4ufzSAxQ96jkLZg=pdm7A@mail.gmail.com' \
    --to=alex.bosworth@gmail.com \
    --cc=bitcoin-dev@lists.linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox