/ e3 / 796c9ef2d3b9fe11a4cef714dcb2035d410b2b
796c9ef2d3b9fe11a4cef714dcb2035d410b2b
  1  Return-Path: <alex.bosworth@gmail.com>
  2  Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
  3  	[172.17.192.35])
  4  	by mail.linuxfoundation.org (Postfix) with ESMTPS id 14F07AA6
  5  	for <bitcoin-dev@lists.linuxfoundation.org>;
  6  	Tue,  4 Sep 2018 03:24:23 +0000 (UTC)
  7  X-Greylist: whitelisted by SQLgrey-1.7.6
  8  Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com
  9  	[209.85.219.175])
 10  	by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B1B035E2
 11  	for <bitcoin-dev@lists.linuxfoundation.org>;
 12  	Tue,  4 Sep 2018 03:24:22 +0000 (UTC)
 13  Received: by mail-yb1-f175.google.com with SMTP id t71-v6so779393ybi.7
 14  	for <bitcoin-dev@lists.linuxfoundation.org>;
 15  	Mon, 03 Sep 2018 20:24:22 -0700 (PDT)
 16  DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 17  	h=mime-version:from:date:message-id:subject:to;
 18  	bh=m0dueVg0KYxhDunIelNLbTFG2mTY8rnqXFgZR/3/yLQ=;
 19  	b=YipwZN3okOCx6J+iB2iIy0HTFNobNw+wXvkP/bsSU0yz57VpnxiQmxDivkYTvtj87T
 20  	VfqVVsTzGQj14V2+fsAfbQci+nw1GP9vLUdDA4PtORzttaVvVOm3lAAzpf2JhGHB4QqT
 21  	5GHXi3qIx9uUArhpMxLjxT3fwoHVyVRZ7oHU2QiPG60446FYaG4uoqt0uMv+hrbOJ1Ee
 22  	nQpHa+Wb979rbCK/5hBhfmz1VDc4Ia+2Kof7uHZSYmMfakU5myUL0sHV7tXWM/fnugqR
 23  	++IzbqPywurN0LSJ5RYXMTWx8ZU/QCNf+PhVC31no3BlfiSfF4Iejtjs8+R42t66x4A5
 24  	OWtg==
 25  X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 26  	d=1e100.net; s=20161025;
 27  	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 28  	bh=m0dueVg0KYxhDunIelNLbTFG2mTY8rnqXFgZR/3/yLQ=;
 29  	b=PeLDtInlvRNpsYgiU6d7SUYQJu3OckoSsImdcR5blkdgBRKDNWSh0lWUU67S+p40s1
 30  	cUSQsv/4lEZHg67zKTnrxt5dn31p69pkt/t92bBACtIXO/DrhHu9rUE6ZXZxDUiZ9HsF
 31  	UF0GhgUwCDnuM1ZCrFJV4i09xEi/2Ao63472NKG0BrIVIuIPQgG76PqWN67IQE0du2+c
 32  	ROsrw/YaKZhCfJnEteBvTB9gR9Ku1oVaAamA1os1F9z5Nx05bilE3h8VfHOdOS+2QlHQ
 33  	nNTGhPBRVYrnR26HCEinspZNo3+fRbheZkWplwCfgEGYog0Ai4GP0OulIFo8Zcg+w+iw
 34  	nbFQ==
 35  X-Gm-Message-State: APzg51DjIzQrjUPVam7hS/ZEF8abZ/OVxDqePr83wIAsOxmr/6xms5Rw
 36  	QwSnUha9pkESFYKF0jMK312q1AuSJvZ8IWOV/IH+XeY0
 37  X-Google-Smtp-Source: ANB0VdYfekBHriGFeoYJ2bnEhIEqnZCz25LyB3GBv2tf1x1nGuC62tPXGzEcBeqACGm7x+GeWuXNwWQQMmdTTSLBD90=
 38  X-Received: by 2002:a25:e709:: with SMTP id
 39  	e9-v6mr17748575ybh.358.1536031461860; 
 40  	Mon, 03 Sep 2018 20:24:21 -0700 (PDT)
 41  MIME-Version: 1.0
 42  Received: by 2002:a81:84c5:0:0:0:0:0 with HTTP;
 43  	Mon, 3 Sep 2018 20:24:01 -0700 (PDT)
 44  From: Alex Bosworth <alex.bosworth@gmail.com>
 45  Date: Mon, 3 Sep 2018 20:24:01 -0700
 46  Message-ID: <CAFLuHNFD8vTyYfF+64e2Xs_HympQs4ufzSAxQ96jkLZg=pdm7A@mail.gmail.com>
 47  To: bitcoin-dev@lists.linuxfoundation.org
 48  Content-Type: text/plain; charset="UTF-8"
 49  X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,
 50  	DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM,
 51  	RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1
 52  X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
 53  	smtp1.linux-foundation.org
 54  X-Mailman-Approved-At: Tue, 04 Sep 2018 11:32:01 +0000
 55  Subject: [bitcoin-dev] Extending BIP174 for HTLCs
 56  X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
 57  X-Mailman-Version: 2.1.12
 58  Precedence: list
 59  List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
 60  List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>,
 61  	<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
 62  List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
 63  List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
 64  List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
 65  List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>,
 66  	<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
 67  X-List-Received-Date: Tue, 04 Sep 2018 03:24:23 -0000
 68  
 69  I've been experimenting with a format tag for BIP 174 to help support
 70  HTLC scripts I've been working with.
 71  
 72  Not sure on the best format for this, but what I have been thinking
 73  about is a new input type that defines elements that should be
 74  inserted in the final p2sh/p2wsh stack such as a preimage or a refund
 75  path flag.
 76  
 77  Type: Additional Stack Element ADDITIONAL_STACK_ELEMENT = 0xXX
 78  
 79  Key: The index in the stack to insert a value (uint32 LE)
 80  
 81  {0xXX}|{Stack index}
 82  
 83  Value: The value to push into the stack for a redeem script or witness
 84  script at the specified index.
 85  
 86  {value}
 87  
 88  So my flow is:
 89  
 90  1. Create blank PSBT (attaching locktime, anticipating final weight to
 91  adjust outputs for fees)
 92  2. Update with redeem scripts and/or witness scripts
 93  3. Update with sighashes
 94  4. Sign: generate partial signature
 95  5. Attach additional stack elements for the required non-signature elements
 96  6. Finalize to create the final scriptsig and/or witness
 97  7. Extract the signed transaction for broadcast
 98  
 99  This may be overkill or overly generic, has anyone else thought of how
100  to use PSBTs in an HTLC context?
101  
102  -- 
103  Sent from my iPhone
104